diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-02-16 14:47:22 -0800 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2010-02-16 14:47:22 -0800 |
commit | c4ad73c30d74904c851ada8132970da798c86aa9 (patch) | |
tree | a51bd493c5d4cc070269e81f2d76a492310d8c3c | |
parent | c731f79af1dd6bf83a3facc0421dc6e4ccfc0e1c (diff) | |
download | bundler-c4ad73c30d74904c851ada8132970da798c86aa9.tar.gz |
Fix Bundler on 1.9
-rw-r--r-- | lib/bundler/dsl.rb | 5 | ||||
-rw-r--r-- | lib/bundler/installer.rb | 3 | ||||
-rw-r--r-- | lib/bundler/runtime.rb | 2 | ||||
-rw-r--r-- | lib/bundler/source.rb | 2 | ||||
-rw-r--r-- | lib/bundler/templates/environment.erb | 5 | ||||
-rw-r--r-- | spec/runtime/environment_rb_spec.rb | 1 | ||||
-rw-r--r-- | spec/spec_helper.rb | 4 | ||||
-rw-r--r-- | spec/support/helpers.rb | 2 | ||||
-rw-r--r-- | spec/support/rubygems_ext.rb (renamed from spec/support/rubygems.rb) | 0 |
9 files changed, 19 insertions, 5 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index c08b22e2a3..1064981f8c 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -80,11 +80,14 @@ module Bundler end def _normalize_hash(opts) - opts.each do |k, v| + # Cannot modify a hash during an iteration in 1.9 + opts.keys.each do |k| next if String === k + v = opts[k] opts.delete(k) opts[k.to_s] = v end + opts end def _normalize_options(name, version, opts) diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index dbc47c8b6c..2da82ab05e 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -12,6 +12,9 @@ module Bundler return end + # Ensure that BUNDLE_PATH exists + FileUtils.mkdir_p(Bundler.bundle_path) + specs.sort_by { |s| s.name }.each do |spec| # unless spec.source.is_a?(Source::SystemGems) Bundler.ui.info "Installing #{spec.name} (#{spec.version}) from #{spec.source} " diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index 863188c4e6..319229219c 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -256,7 +256,7 @@ module Bundler source_index_class.send(:define_method, :from_gems_in) do |*args| source_index = Gem::SourceIndex.new source_index.spec_dirs = *args - source_index.add_specs *specs + source_index.add_specs(*specs) source_index end diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index 7dd16ef3f9..75da44f8f8 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -236,7 +236,7 @@ module Bundler # Loop over the lines and extract the relative path and the # git hash lines.each do |line| - next unless line =~ %r{^(\d+) (blob|tree) ([a-zf0-9]+)\t(.*)$} + next unless line =~ %r{^(\d+) (blob|tree) ([a-f0-9]+)\t(.*)$} hash, file = $3, $4 # Read the gemspec if spec = eval(%x(git cat-file blob #{$3})) diff --git a/lib/bundler/templates/environment.erb b/lib/bundler/templates/environment.erb index 545c521499..19df5502ac 100644 --- a/lib/bundler/templates/environment.erb +++ b/lib/bundler/templates/environment.erb @@ -31,6 +31,7 @@ module Bundler def self.setup(*groups) match_fingerprint + clean_load_path SPECS.each do |spec| spec[:load_paths].each { |path| $LOAD_PATH.unshift path } end @@ -53,6 +54,10 @@ module Bundler end def self.patch_rubygems + Kernel.class_eval do + private + def gem(*) ; end + end Gem.source_index # ensure RubyGems is fully loaded specs = SPECS diff --git a/spec/runtime/environment_rb_spec.rb b/spec/runtime/environment_rb_spec.rb index c172fc3ea9..c7a3ba0c2f 100644 --- a/spec/runtime/environment_rb_spec.rb +++ b/spec/runtime/environment_rb_spec.rb @@ -16,6 +16,7 @@ describe "environment.rb file" do it "does not pull in system gems" do run <<-R, :lite_runtime => true require 'rubygems' + begin; require 'rack' rescue LoadError diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 58f35c7b2e..0c8e1b922e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,7 +10,9 @@ Dir["#{File.expand_path('../support', __FILE__)}/*.rb"].each do |file| require file end -$debug = false +$debug = false +$show_err = false + Spec::Rubygems.setup FileUtils.rm_rf(Spec::Path.gem_repo1) diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index ac259cec97..7083fabd4d 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -44,7 +44,7 @@ module Spec gemfile = File.expand_path('../../../bin/bundle', __FILE__) input, out, err, waitthread = Open3.popen3("#{Gem.ruby} -I#{lib} #{gemfile} #{cmd}#{args}") @err = err.read.strip - puts @err if $debug && !err.empty? + puts @err if $show_err && !@err.empty? @out = out.read.strip @exitstatus = nil @exitstatus = waitthread.value.to_i if waitthread diff --git a/spec/support/rubygems.rb b/spec/support/rubygems_ext.rb index 7c534c3a44..7c534c3a44 100644 --- a/spec/support/rubygems.rb +++ b/spec/support/rubygems_ext.rb |