Skip to content
Browse files

Better usage of merb_rake_helper.rb

  • Loading branch information...
1 parent 14999ff commit b5b270f14c58f832fbfefa2c38775d9c05e872a5 @fabien fabien committed May 27, 2008
Showing with 15 additions and 13 deletions.
  1. +5 −9 Rakefile
  2. +1 −2 lib/merb-core/tasks/merb.rb
  3. +9 −2 lib/merb-core/tasks/merb_rake_helper.rb
View
14 Rakefile
@@ -19,17 +19,13 @@ NAME = "merb-core"
require "lib/merb-core/version"
require "lib/merb-core/test/run_specs"
+require 'lib/merb-core/tasks/merb_rake_helper'
##############################################################################
# Packaging & Installation
##############################################################################
CLEAN.include ["**/.*.sw?", "pkg", "lib/*.bundle", "*.gem", "doc/rdoc", ".config", "coverage", "cache"]
-windows = (PLATFORM =~ /win32|cygwin/) rescue nil
-install_home = ENV['GEM_HOME'] ? "-i #{ENV['GEM_HOME']}" : ""
-
-SUDO = windows ? "" : "sudo"
-
desc "Packages up Merb."
task :default => :package
@@ -72,17 +68,17 @@ end
desc "Run :package and install the resulting .gem"
task :install => :package do
- sh %{#{SUDO} gem install #{install_home} --local pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
+ sh %{#{sudo} gem install #{install_home} --local pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
end
desc "Run :package and install the resulting .gem with jruby"
task :jinstall => :package do
- sh %{#{SUDO} jruby -S gem install #{install_home} pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
+ sh %{#{sudo} jruby -S gem install #{install_home} pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
end
desc "Run :clean and uninstall the .gem"
task :uninstall => :clean do
- sh %{#{SUDO} gem uninstall #{NAME}}
+ sh %{#{sudo} gem uninstall #{NAME}}
end
namespace :github do
@@ -143,7 +139,7 @@ namespace :doc do
desc "rdoc to rubyforge"
task :rubyforge do
# sh %{rake doc}
- sh %{#{SUDO} chmod -R 755 doc} unless windows
+ sh %{#{sudo} chmod -R 755 doc} unless windows?
sh %{/usr/bin/scp -r -p doc/rdoc/* ezmobius@rubyforge.org:/var/www/gforge-projects/merb}
end
View
3 lib/merb-core/tasks/merb.rb
@@ -1,2 +1 @@
-Dir[File.dirname(__FILE__) / '*.rake'].each { |ext| load ext }
-
+Dir[File.dirname(__FILE__) / '*.rake'].each { |ext| load ext }
View
11 lib/merb-core/tasks/merb_rake_helper.rb
@@ -1,5 +1,12 @@
def sudo
- windows = (PLATFORM =~ /win32|cygwin/) rescue nil
ENV['MERB_SUDO'] ||= "sudo"
- sudo = windows ? "" : ENV['MERB_SUDO']
+ sudo = windows? ? "" : ENV['MERB_SUDO']
+end
+
+def windows?
+ (PLATFORM =~ /win32|cygwin/) rescue nil
+end
+
+def install_home
+ ENV['GEM_HOME'] ? "-i #{ENV['GEM_HOME']}" : ""
end

0 comments on commit b5b270f

Please sign in to comment.
Something went wrong with that request. Please try again.