Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Fix Bundler on 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlhuda committed Feb 16, 2010
1 parent c731f79 commit c4ad73c
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 5 deletions.
5 changes: 4 additions & 1 deletion lib/bundler/dsl.rb
Expand Up @@ -80,11 +80,14 @@ def _version?(version)
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)
Expand Down
3 changes: 3 additions & 0 deletions lib/bundler/installer.rb
Expand Up @@ -12,6 +12,9 @@ def run(options)
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} "
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/runtime.rb
Expand Up @@ -256,7 +256,7 @@ def cripple_rubygems(specs)
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

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/source.rb
Expand Up @@ -236,7 +236,7 @@ def specs
# 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}))
Expand Down
5 changes: 5 additions & 0 deletions lib/bundler/templates/environment.erb
Expand Up @@ -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
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions spec/runtime/environment_rb_spec.rb
Expand Up @@ -16,6 +16,7 @@
it "does not pull in system gems" do
run <<-R, :lite_runtime => true
require 'rubygems'
begin;
require 'rack'
rescue LoadError
Expand Down
4 changes: 3 additions & 1 deletion spec/spec_helper.rb
Expand Up @@ -10,7 +10,9 @@
require file
end

$debug = false
$debug = false
$show_err = false

Spec::Rubygems.setup
FileUtils.rm_rf(Spec::Path.gem_repo1)

Expand Down
2 changes: 1 addition & 1 deletion spec/support/helpers.rb
Expand Up @@ -44,7 +44,7 @@ def bundle(cmd, options = {})
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
Expand Down
File renamed without changes.

0 comments on commit c4ad73c

Please sign in to comment.