aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support/rubygems_ext.rb
diff options
context:
space:
mode:
authorCarlhuda <carlhuda@engineyard.com>2010-02-16 14:47:22 -0800
committerCarlhuda <carlhuda@engineyard.com>2010-02-16 14:47:22 -0800
commitc4ad73c30d74904c851ada8132970da798c86aa9 (patch)
treea51bd493c5d4cc070269e81f2d76a492310d8c3c /spec/support/rubygems_ext.rb
parentc731f79af1dd6bf83a3facc0421dc6e4ccfc0e1c (diff)
downloadbundler-c4ad73c30d74904c851ada8132970da798c86aa9.tar.gz
Fix Bundler on 1.9
Diffstat (limited to 'spec/support/rubygems_ext.rb')
-rw-r--r--spec/support/rubygems_ext.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb
new file mode 100644
index 00000000..7c534c3a
--- /dev/null
+++ b/spec/support/rubygems_ext.rb
@@ -0,0 +1,29 @@
+module Spec
+ module Rubygems
+ def self.setup
+ Gem.clear_paths
+
+ ENV['GEM_HOME'] = ENV['GEM_PATH'] = Path.base_system_gems.to_s
+ ENV['PATH'] = "#{Path.system_gem_path}/bin:#{ENV['PATH']}"
+
+ unless File.exist?("#{Path.base_system_gems}")
+ FileUtils.mkdir_p(Path.base_system_gems)
+ puts "running `gem install builder --no-rdoc --no-ri`"
+ `gem install builder --no-rdoc --no-ri`
+ end
+
+ ENV['HOME'] = Path.home.to_s
+
+ Gem::DefaultUserInteraction.ui = Gem::SilentUI.new
+ end
+
+ def gem_command(command, args = "", options = {})
+ if command == :exec && !options[:no_quote]
+ args = args.gsub(/(?=")/, "\\")
+ args = %["#{args}"]
+ end
+ lib = File.join(File.dirname(__FILE__), '..', '..', 'lib')
+ %x{#{Gem.ruby} -I#{lib} -rubygems -S gem --backtrace #{command} #{args}}.strip
+ end
+ end
+end \ No newline at end of file