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

Commit 32a4159

Browse files
Merge #7547
7547: Release 2.1.4 r=deivid-rodriguez a=deivid-rodriguez This PR gets out there two more bug fixes in the 2.1 line. Specifically #7529 and #7537. Co-authored-by: Bundlerbot <[email protected]> Co-authored-by: David Rodríguez <[email protected]>
2 parents 14c5584 + f73e11e commit 32a4159

File tree

12 files changed

+74
-45
lines changed

12 files changed

+74
-45
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 2.1.4 (January 5, 2020)
2+
3+
Bugfixes:
4+
5+
- Fix `net-http-pipeline` no longer being allowed in Gemfiles if already installed in the system due to our vendored version of `net-http-persistent` optionally requiring it [#7529](https://github.com/bundler/bundler/pull/7529)
6+
- Fix inline gems no longer being requirable if no Gemfile is present in the directory hierarchy [#7537](https://github.com/bundler/bundler/pull/7537)
7+
18
## 2.1.3 (January 2, 2020)
29

310
Bugfixes:

lib/bundler/inline.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def definition.lock(*); end
7878
if old_gemfile
7979
ENV["BUNDLE_GEMFILE"] = old_gemfile
8080
else
81-
ENV.delete("BUNDLE_GEMFILE")
81+
ENV["BUNDLE_GEMFILE"] = ""
8282
end
8383
end
8484
end

lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb

-22
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
require 'cgi' # for escaping
44
require_relative '../../../../connection_pool/lib/connection_pool'
55

6-
begin
7-
require 'net/http/pipeline'
8-
rescue LoadError
9-
end
10-
116
autoload :OpenSSL, 'openssl'
127

138
##
@@ -773,23 +768,6 @@ def normalize_uri uri
773768
(uri =~ /^https?:/) ? uri : "http://#{uri}"
774769
end
775770

776-
##
777-
# Pipelines +requests+ to the HTTP server at +uri+ yielding responses if a
778-
# block is given. Returns all responses received.
779-
#
780-
# See
781-
# Net::HTTP::Pipeline[http://docs.seattlerb.org/net-http-pipeline/Net/HTTP/Pipeline.html]
782-
# for further details.
783-
#
784-
# Only if <tt>net-http-pipeline</tt> was required before
785-
# <tt>net-http-persistent</tt> #pipeline will be present.
786-
787-
def pipeline uri, requests, &block # :yields: responses
788-
connection_for uri do |connection|
789-
connection.http.pipeline requests, &block
790-
end
791-
end
792-
793771
##
794772
# Sets this client's SSL private key
795773

lib/bundler/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: false
22

33
module Bundler
4-
VERSION = "2.1.3".freeze
4+
VERSION = "2.1.4".freeze
55

66
def self.bundler_major_version
77
@bundler_major_version ||= VERSION.split(".").first.to_i

spec/commands/pristine_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999

100100
it "reinstall gemspec dependency" do
101101
spec = Bundler.definition.specs["baz-dev"].first
102-
changed_file = Pathname.new(spec.full_gem_path).join("lib/baz-dev.rb")
102+
changed_file = Pathname.new(spec.full_gem_path).join("lib/baz/dev.rb")
103103
diff = "#Pristine spec changes"
104104

105105
File.open(changed_file, "a") {|f| f.puts "#Pristine spec changes" }

spec/install/gemfile/gemspec_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
build_lib("foo", :path => bundled_app)
211211
gemspec = bundled_app("foo.gemspec").read
212212
bundled_app("foo.gemspec").open("w") do |f|
213-
f.write "#{gemspec.strip}.tap { gem 'rack-obama'; require 'rack-obama' }"
213+
f.write "#{gemspec.strip}.tap { gem 'rack-obama'; require 'rack/obama' }"
214214
end
215215

216216
install_gemfile! <<-G

spec/plugins/source/example_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,14 @@ def install(spec, opts)
125125
end
126126

127127
it "installs the gem executables" do
128-
build_lib "gem-with-bin" do |s|
128+
build_lib "gem_with_bin" do |s|
129129
s.executables = ["foo"]
130130
end
131131

132132
install_gemfile <<-G
133133
source "#{file_uri_for(gem_repo2)}" # plugin source
134-
source "#{lib_path("gem-with-bin-1.0")}", :type => :mpath do
135-
gem "gem-with-bin"
134+
source "#{lib_path("gem_with_bin-1.0")}", :type => :mpath do
135+
gem "gem_with_bin"
136136
end
137137
G
138138

@@ -451,7 +451,7 @@ def installed?
451451
bundle "install"
452452

453453
run <<-RUBY
454-
require 'ma-gitp-gem'
454+
require 'ma/gitp/gem'
455455
puts "WIN" unless defined?(MAGITPGEM_PREV_REF)
456456
RUBY
457457
expect(out).to eq("WIN")
@@ -462,7 +462,7 @@ def installed?
462462
bundle "update ma-gitp-gem"
463463

464464
run <<-RUBY
465-
require 'ma-gitp-gem'
465+
require 'ma/gitp/gem'
466466
puts "WIN" if defined?(MAGITPGEM_PREV_REF)
467467
RUBY
468468
expect(out).to eq("WIN")

spec/runtime/inline_spec.rb

+17
Original file line numberDiff line numberDiff line change
@@ -333,4 +333,21 @@ def confirm(msg, newline = nil)
333333
expect(last_command).to be_success
334334
expect(out).to include("BUNDLE_GEMFILE is empty")
335335
end
336+
337+
it "resets BUNDLE_GEMFILE to the empty string if it wasn't set previously" do
338+
ENV["BUNDLE_GEMFILE"] = nil
339+
script <<-RUBY
340+
gemfile do
341+
source "#{file_uri_for(gem_repo1)}"
342+
gem "rack"
343+
end
344+
345+
puts "BUNDLE_GEMFILE is empty" if ENV["BUNDLE_GEMFILE"].empty?
346+
system("#{Gem.ruby} -w -e '42'") # this should see original value of BUNDLE_GEMFILE
347+
exit $?.exitstatus
348+
RUBY
349+
350+
expect(last_command).to be_success
351+
expect(out).to include("BUNDLE_GEMFILE is empty")
352+
end
336353
end

spec/runtime/require_spec.rb

-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@
168168
build_lib "jquery-rails", "1.0.0" do |s|
169169
s.write "lib/jquery/rails.rb", "puts 'jquery/rails'"
170170
end
171-
lib_path("jquery-rails-1.0.0/lib/jquery-rails.rb").rmtree
172171
end
173172

174173
it "requires gem names that are namespaced" do
@@ -241,7 +240,6 @@
241240
build_lib "load-fuuu", "1.0.0" do |s|
242241
s.write "lib/load/fuuu.rb", "raise LoadError.new(\"cannot load such file -- load-bar\")"
243242
end
244-
lib_path("load-fuuu-1.0.0/lib/load-fuuu.rb").rmtree
245243

246244
gemfile <<-G
247245
path "#{lib_path}" do

spec/runtime/setup_spec.rb

+25-4
Original file line numberDiff line numberDiff line change
@@ -899,17 +899,17 @@ def clean_load_path(lp)
899899

900900
describe "with git gems that don't have gemspecs" do
901901
before :each do
902-
build_git "no-gemspec", :gemspec => false
902+
build_git "no_gemspec", :gemspec => false
903903

904904
install_gemfile <<-G
905-
gem "no-gemspec", "1.0", :git => "#{lib_path("no-gemspec-1.0")}"
905+
gem "no_gemspec", "1.0", :git => "#{lib_path("no_gemspec-1.0")}"
906906
G
907907
end
908908

909909
it "loads the library via a virtual spec" do
910910
run <<-R
911-
require 'no-gemspec'
912-
puts NOGEMSPEC
911+
require 'no_gemspec'
912+
puts NO_GEMSPEC
913913
R
914914

915915
expect(out).to eq("1.0")
@@ -1263,6 +1263,27 @@ def lock_with(ruby_version = nil)
12631263
expect(out).to eq("{}")
12641264
end
12651265

1266+
it "does not load net-http-pipeline too early" do
1267+
build_repo4 do
1268+
build_gem "net-http-pipeline", "1.0.1"
1269+
end
1270+
1271+
system_gems "net-http-pipeline-1.0.1", :gem_repo => gem_repo4 do
1272+
gemfile <<-G
1273+
source "#{file_uri_for(gem_repo4)}"
1274+
gem "net-http-pipeline", "1.0.1"
1275+
G
1276+
1277+
bundle "config set --local path vendor/bundle"
1278+
1279+
bundle! :install
1280+
1281+
bundle! :check
1282+
1283+
expect(out).to eq("The Gemfile's dependencies are satisfied")
1284+
end
1285+
end
1286+
12661287
Gem::Specification.select(&:default_gem?).map(&:name).each do |g|
12671288
it "activates newer versions of #{g}" do
12681289
skip if exemptions.include?(g)

spec/support/builders.rb

+14-6
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ def @spec.validate(*); end
611611
unless options[:no_default]
612612
gem_source = options[:source] || "path@#{path}"
613613
@files = _default_files.
614-
merge("lib/#{name}/source.rb" => "#{Builders.constantize(name)}_SOURCE = #{gem_source.to_s.dump}").
614+
merge("lib/#{entrypoint}/source.rb" => "#{Builders.constantize(name)}_SOURCE = #{gem_source.to_s.dump}").
615615
merge(@files)
616616
end
617617

@@ -627,15 +627,20 @@ def @spec.validate(*); end
627627
end
628628

629629
def _default_files
630-
@_default_files ||= begin
631-
platform_string = " #{@spec.platform}" unless @spec.platform == Gem::Platform::RUBY
632-
{ "lib/#{name}.rb" => "#{Builders.constantize(name)} = '#{version}#{platform_string}'" }
633-
end
630+
@_default_files ||= { "lib/#{entrypoint}.rb" => "#{Builders.constantize(name)} = '#{version}#{platform_string}'" }
631+
end
632+
633+
def entrypoint
634+
name.tr("-", "/")
634635
end
635636

636637
def _default_path
637638
@context.tmp("libs", @spec.full_name)
638639
end
640+
641+
def platform_string
642+
" #{@spec.platform}" unless @spec.platform == Gem::Platform::RUBY
643+
end
639644
end
640645

641646
class GitBuilder < LibBuilder
@@ -755,7 +760,10 @@ def _default_path
755760

756761
class PluginBuilder < GemBuilder
757762
def _default_files
758-
@_default_files ||= super.merge("plugins.rb" => "")
763+
@_default_files ||= {
764+
"lib/#{name}.rb" => "#{Builders.constantize(name)} = '#{version}#{platform_string}'",
765+
"plugins.rb" => "",
766+
}
759767
end
760768
end
761769

spec/support/matchers.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def indent(string, padding = 4, indent_character = " ")
128128
groups << opts
129129
@errors = names.map do |name|
130130
name, version, platform = name.split(/\s+/)
131-
require_path = name == "bundler" ? "#{lib_dir}/bundler" : name
131+
require_path = name == "bundler" ? "#{lib_dir}/bundler" : name.tr("-", "/")
132132
version_const = name == "bundler" ? "Bundler::VERSION" : Spec::Builders.constantize(name)
133133
begin
134134
run! "require '#{require_path}.rb'; puts #{version_const}", *groups
@@ -145,7 +145,7 @@ def indent(string, padding = 4, indent_character = " ")
145145
next unless source
146146
begin
147147
source_const = "#{Spec::Builders.constantize(name)}_SOURCE"
148-
run! "require '#{name}/source'; puts #{source_const}", *groups
148+
run! "require '#{require_path}/source'; puts #{source_const}", *groups
149149
rescue StandardError
150150
next "#{name} does not have a source defined:\n#{indent(e)}"
151151
end

0 commit comments

Comments
 (0)