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

Commit

Permalink
Phase 1 of rubygems/bundler reintegration
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Phoenix committed Apr 18, 2011
1 parent 8b2649e commit 5f4a8f3
Show file tree
Hide file tree
Showing 13 changed files with 370 additions and 176 deletions.
14 changes: 14 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,26 @@ begin
system("git checkout #{rg}")
system("git pull origin master") if rg == "master"
end
puts "Running bundler specs against rubygems '#{rg}'"
ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems/lib")} #{rubyopt}"
end

task rg => "clone_rubygems_#{rg}"
task "rubygems:all" => rg
end

desc "Run specs under a Rubygems checkout (set RG=path)"
RSpec::Core::RakeTask.new("co") do |t|
t.rspec_opts = %w(-fs --color)
t.ruby_opts = %w(-w)
end

task "setup_co" do
ENV["RUBYOPT"] = "-I#{File.expand_path ENV['RG']} #{rubyopt}"
end

task "co" => "setup_co"
task "rubygems:all" => "co"
end

namespace :ruby do
Expand Down
12 changes: 7 additions & 5 deletions lib/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

require 'yaml'
require 'bundler/rubygems_ext'
require 'bundler/rubygems_integration'
require 'bundler/version'

module Bundler
Expand Down Expand Up @@ -137,11 +138,11 @@ def definition(unlock = nil)
end

def ruby_scope
"#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}"
"#{Bundler.rubygems.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}"
end

def user_bundle_path
Pathname.new(Gem.user_home).join(".bundler")
Pathname.new(Bundler.rubygems.user_home).join(".bundler")
end

def home
Expand Down Expand Up @@ -258,16 +259,17 @@ def configure_gem_home_and_path
if settings[:disable_shared_gems]
ENV['GEM_PATH'] = ''
ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
elsif Gem.dir != bundle_path.to_s
paths = [Gem.dir, Gem.path].flatten.compact.uniq.reject{|p| p.empty? }
elsif Bundler.rubygems.gem_dir != bundle_path.to_s
possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
paths = possibles.flatten.compact.uniq.reject { |p| p.empty? }
ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
ENV["GEM_HOME"] = bundle_path.to_s
end

# TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
FileUtils.mkdir_p bundle_path.to_s rescue nil

Gem.clear_paths
Bundler.rubygems.clear_paths
end

def upgrade_lockfile
Expand Down
5 changes: 1 addition & 4 deletions lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
require 'rubygems/user_interaction'
require 'rubygems/config_file'

# Work around a RubyGems bug
Gem.configuration

module Bundler
class CLI < Thor
include Thor::Actions
Expand All @@ -16,7 +13,7 @@ def initialize(*)
the_shell = (options["no-color"] ? Thor::Shell::Basic.new : shell)
Bundler.ui = UI::Shell.new(the_shell)
Bundler.ui.debug! if options["verbose"]
Gem::DefaultUserInteraction.ui = UI::RGProxy.new(Bundler.ui)
Bundler.rubygems.ui = UI::RGProxy.new(Bundler.ui)
end

check_unknown_options! unless ARGV.include?("exec") || ARGV.include?("config")
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def initialize(lockfile, dependencies, sources, unlock)
@unlock[:gems] ||= []
@unlock[:sources] ||= []

current_platform = Gem.platforms.map { |p| generic(p) }.compact.last
current_platform = Bundler.rubygems.platforms.map { |p| generic(p) }.compact.last
@new_platform = !@platforms.include?(current_platform)
@platforms |= [current_platform]

Expand Down
6 changes: 1 addition & 5 deletions lib/bundler/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,9 @@ def run(options)
# next
# end

begin
old_args = Gem::Command.build_args
Gem::Command.build_args = [Bundler.settings["build.#{spec.name}"]]
Bundler.rubygems.with_build_args [Bundler.settings["build.#{spec.name}"]] do
spec.source.install(spec)
Bundler.ui.debug "from #{spec.loaded_from} "
ensure
Gem::Command.build_args = old_args
end

Bundler.ui.info ""
Expand Down

0 comments on commit 5f4a8f3

Please sign in to comment.