diff options
author | André Arko <mail@arko.net> | 2015-06-01 19:32:39 +0800 |
---|---|---|
committer | André Arko <mail@arko.net> | 2015-06-01 19:32:39 +0800 |
commit | b6e038cffdbc862ffa48edca82340760fcd27aba (patch) | |
tree | ceac27bf963763e5179ee66ebdf199fdf26bce5e | |
parent | 16584038c2e7948e14df59c7b77141f970612f58 (diff) | |
parent | 98f7976a6beb6d655c9a59f0830ce17a978f03f2 (diff) | |
download | bundler-b6e038cffdbc862ffa48edca82340760fcd27aba.tar.gz |
Merge pull request #3694 from bundler/seg-inline-load-paths
[EndpointSpecification] Return local load paths
-rw-r--r-- | lib/bundler/endpoint_specification.rb | 19 | ||||
-rw-r--r-- | lib/bundler/inline.rb | 1 | ||||
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 7 | ||||
-rw-r--r-- | spec/bundler/rubygems_integration_spec.rb | 4 | ||||
-rw-r--r-- | spec/install/gemfile/path_spec.rb | 2 | ||||
-rw-r--r-- | spec/runtime/inline_spec.rb | 22 |
6 files changed, 38 insertions, 17 deletions
diff --git a/lib/bundler/endpoint_specification.rb b/lib/bundler/endpoint_specification.rb index 31365e5b42..b27b0f5040 100644 --- a/lib/bundler/endpoint_specification.rb +++ b/lib/bundler/endpoint_specification.rb @@ -29,6 +29,16 @@ module Bundler end end + # needed for inline + def load_paths + # remote specs aren't installed, and can't have load_paths + if _local_specification + _local_specification.load_paths + else + super + end + end + # needed for binstubs def executables if @remote_specification @@ -61,14 +71,19 @@ module Bundler end def _local_specification - eval(File.read(local_specification_path)) if @loaded_from && File.exist?(local_specification_path) + if @loaded_from && File.exist?(local_specification_path) + eval(File.read(local_specification_path)).tap do |spec| + spec.loaded_from = @loaded_from + end + end end def __swap__(spec) @remote_specification = spec end - private + private + def local_specification_path "#{base_dir}/specifications/#{full_name}.gemspec" end diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb index 99ee98db04..3eff45b4c4 100644 --- a/lib/bundler/inline.rb +++ b/lib/bundler/inline.rb @@ -51,7 +51,6 @@ def gemfile(install = false, &gemfile) end runtime = Bundler::Runtime.new(nil, definition) - runtime.setup_environment runtime.setup.require bundler_module = class << Bundler; self; end diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 99799fa48b..6ea18b2949 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -462,10 +462,9 @@ module Bundler end def validate(spec) - # Missing summary is downgraded to a warning in later versions, - # so we set it to an empty string to prevent an exception here. - spec.summary ||= "" - Bundler.ui.silence { spec.validate } + # These versions of RubyGems always validate in "packaging" mode, + # which is too strict for the kinds of checks we care about. As a + # result, validation is disabled on versions of RubyGems below 1.7. end end diff --git a/spec/bundler/rubygems_integration_spec.rb b/spec/bundler/rubygems_integration_spec.rb index 26f0de5a1e..0c69c3b161 100644 --- a/spec/bundler/rubygems_integration_spec.rb +++ b/spec/bundler/rubygems_integration_spec.rb @@ -8,8 +8,8 @@ describe Bundler::RubygemsIntegration do context "#validate" do let(:spec) { double("spec", :summary => "") } - it "validates without arguments", :rubygems => "< 1.7" do - expect(spec).to receive(:validate).with(no_args) + it "skips overly-strict gemspec validation", :rubygems => "< 1.7" do + expect(spec).to_not receive(:validate) Bundler.rubygems.validate(spec) end diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb index d754674e89..b07038136f 100644 --- a/spec/install/gemfile/path_spec.rb +++ b/spec/install/gemfile/path_spec.rb @@ -141,7 +141,7 @@ describe "bundle install with explicit source paths" do should_be_installed "premailer 1.0.0" end - it "errors on invalid specs" do + it "errors on invalid specs", :rubygems => "1.7" do build_lib "foo" gemspec = lib_path("foo-1.0").join("foo.gemspec").to_s diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb index 1e07692636..ec465b5ae8 100644 --- a/spec/runtime/inline_spec.rb +++ b/spec/runtime/inline_spec.rb @@ -2,7 +2,10 @@ require "spec_helper" describe "bundler/inline#gemfile" do def script(code, options = {}) - @out = ruby("require 'bundler/inline'\n\n" << code, options) + requires = ['bundler/inline'] + requires.unshift File.expand_path('../../support/artifice/'+options.delete(:artifice)+'.rb', __FILE__) if options.key?(:artifice) + requires = requires.map { |r| "require '#{r}'" }.join("\n") + @out = ruby("#{requires}\n\n" << code, options) end before :each do @@ -44,12 +47,6 @@ describe "bundler/inline#gemfile" do build_lib "four", "1.0.0" do |s| s.write "lib/four.rb", "puts 'four'" end - - @gemfile = <<-G - path "#{lib_path}" - gem "two" - gem "four", :require => false - G end it "requires the gems" do @@ -84,5 +81,16 @@ describe "bundler/inline#gemfile" do expect(out).to include("Rack's post install message") expect(exitstatus).to be_zero if exitstatus + + script <<-RUBY, :artifice => 'endpoint' + gemfile(true) do + source "https://rubygems.org" + gem "activesupport", :require => true + end + RUBY + + expect(out).to include("Installing activesupport") + expect(err).to eq("") + expect(exitstatus).to be_zero if exitstatus end end |