diff options
author | Andre Arko <andre@arko.net> | 2012-11-29 18:39:14 -0800 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2012-11-29 18:39:14 -0800 |
commit | ea4ed0913efa81ff9e962a1c43aa61b789620bc7 (patch) | |
tree | de2b7f4d5ec6a6cb323ea9674da7ef4ae9576dc0 | |
parent | ed3974d6fdc006f2000163666c65eb15bb0ce379 (diff) | |
download | bundler-ea4ed0913efa81ff9e962a1c43aa61b789620bc7.tar.gz |
actually move gem building into RubygemsIntegration
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 22 | ||||
-rw-r--r-- | spec/support/builders.rb | 9 |
2 files changed, 13 insertions, 18 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 22ff1d4133..8dcee69a6e 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -1,3 +1,5 @@ +require 'rubygems' + module Bundler class RubygemsIntegration def loaded_specs(name) @@ -113,16 +115,18 @@ module Bundler def spec_from_gem(path) require 'rubygems/format' - Gem::Format.from_file_by_path(path).spec rescue Gem::Package::FormatError raise Bundler::GemspecError, "Could not read gem at #{path}. It may be corrupted." end + def build(spec) + require 'rubygems/builder' + Gem::Builder.new(spec).build + end + def build_gem(gem_dir, spec) - Dir.chdir(gem_dir) do - Gem::Builder.new(spec).build - end + Dir.chdir(gem_dir) { build(spec) } end def download_gem(spec, uri, path) @@ -387,6 +391,8 @@ module Bundler # Rubygems 2.0 class Future < RubygemsIntegration + require 'rubygems/package' + def stub_rubygems(specs) Gem::Specification.all = specs @@ -421,17 +427,13 @@ module Bundler end def spec_from_gem(path) - require 'rubygems/package' - Gem::Package.new(path).spec rescue Gem::Package::FormatError raise Bundler::GemspecError, "Could not read gem at #{path}. It may be corrupted." end - def build_gem(gem_dir, spec) - Dir.chdir(gem_dir) do - Gem::Package.build(spec) - end + def build(spec) + Gem::Package.build(spec) end end diff --git a/spec/support/builders.rb b/spec/support/builders.rb index 17119d7419..12049fee1a 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -1,5 +1,3 @@ -require 'rubygems/package' - module Spec module Builders def self.constantize(name) @@ -589,12 +587,7 @@ module Spec @spec.authors = ["that guy"] end - if Gem::Package.respond_to? :build then - Gem::Package.build(@spec) - else # 1.8.x and older - require 'rubygems/builder' - Gem::Builder.new(@spec).build - end + Bundler.rubygems.build(@spec) if opts[:to_system] `gem install --ignore-dependencies #{@spec.full_name}.gem` else |