Permalink
Browse files

Phase 1 of rubygems/bundler reintegration

  • Loading branch information...
1 parent 8b2649e commit 5f4a8f3c7184237cb5ce4c0045b59178706b4e68 Evan Phoenix committed Apr 18, 2011
View
@@ -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
View
@@ -9,6 +9,7 @@
require 'yaml'
require 'bundler/rubygems_ext'
+require 'bundler/rubygems_integration'
require 'bundler/version'
module Bundler
@@ -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
@@ -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
View
@@ -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
@@ -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")
@@ -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]
View
@@ -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 ""
Oops, something went wrong.

0 comments on commit 5f4a8f3

Please sign in to comment.