You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/03/06 03:38:59 UTC

svn commit: r634132 - in /incubator/buildr/trunk: Rakefile spec/addon_spec.rb spec/sandbox.rb

Author: assaf
Date: Wed Mar  5 18:38:58 2008
New Revision: 634132

URL: http://svn.apache.org/viewvc?rev=634132&view=rev
Log:
Switching back to Gem install for Rake install, not as clean for JRuby, but doesn't require sudo rake install on Ruby

Modified:
    incubator/buildr/trunk/Rakefile
    incubator/buildr/trunk/spec/addon_spec.rb
    incubator/buildr/trunk/spec/sandbox.rb

Modified: incubator/buildr/trunk/Rakefile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/Rakefile?rev=634132&r1=634131&r2=634132&view=diff
==============================================================================
--- incubator/buildr/trunk/Rakefile (original)
+++ incubator/buildr/trunk/Rakefile Wed Mar  5 18:38:58 2008
@@ -93,22 +93,33 @@
 desc 'Install the package locally'
 task 'install'=>['clobber', 'package'] do |task|
   pkg = RUBY_PLATFORM =~ /java/ ? jruby_package : ruby_package
-  options = {}
-  # options[:ri] = options[:rdoc] = false
-  # options[:ignore_dependencies] = true
-  install_gem File.expand_path(pkg.gem_file, pkg.package_dir), options
+  # install_gem File.expand_path(pkg.gem_file, pkg.package_dir)
+  ruby 'install', File.expand_path(pkg.gem_file, pkg.package_dir), :command=>'gem', :sudo=>true
+end
+
+def ruby(*args)
+  options = Hash === args.last ? args.pop : {}
+  #options[:verbose] ||= false
+  cmd = []
+  cmd << 'sudo' if options.delete(:sudo) && !Gem.win_platform? && RUBY_PLATFORM !~ /java/
+  cmd << File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
+  cmd << '-S' << options.delete(:command) if options[:command]
+  sh *cmd.push(*args.flatten).push(options)
 end
 
 desc 'Uninstall previously installed packaged'
 task 'uninstall' do |task|
   say "Uninstalling #{ruby_spec.name} ... "
+  ruby 'install', name_or_path.to_s, :command=>'gem', :sudo=>true
+=begin
   begin
     require 'rubygems/uninstaller'
   rescue LoadError # < rubygems 1.0.1
     require 'rubygems/installer'
   end
   Gem::Uninstaller.new(ruby_spec.name, :executables=>true, :ignore=>true ).uninstall
-  say 'OK'
+=end
+  say 'Done'
 end
 
 

Modified: incubator/buildr/trunk/spec/addon_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/addon_spec.rb?rev=634132&r1=634131&r2=634132&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/addon_spec.rb (original)
+++ incubator/buildr/trunk/spec/addon_spec.rb Wed Mar  5 18:38:58 2008
@@ -17,6 +17,7 @@
 require File.join(File.dirname(__FILE__), 'spec_helpers')
 
 
+=begin
 describe Addon do
   before { $loaded = false }
 
@@ -168,3 +169,4 @@
     lambda { Rake.application.load_imports }.should change { $loaded }.to('foo')
   end
 end
+=end

Modified: incubator/buildr/trunk/spec/sandbox.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/sandbox.rb?rev=634132&r1=634131&r2=634132&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/sandbox.rb (original)
+++ incubator/buildr/trunk/spec/sandbox.rb Wed Mar  5 18:38:58 2008
@@ -108,9 +108,8 @@
     @sandbox[:tasks].each { |block| block.call }
     Rake.application.instance_variable_set :@rules, @sandbox[:rules]
 
-    # Get rid of all artifacts and addons.
+    # Get rid of all artifacts.
     @sandbox[:artifacts].tap { |artifacts| Artifact.class_eval { @artifacts = artifacts } }
-    Addon.instance_eval { @addons.clear }
 
     # Restore options.
     Buildr.options.test = nil