bundler 1.7.7 → 1.7.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a89eb823ec7cbdb414f00ff9332326cfc87dee65
4
- data.tar.gz: 547184539810c8c7c3ff1bfb5f7863c7408360e1
3
+ metadata.gz: adfd35f4416630e7c51fc82b523f4f6def3bc717
4
+ data.tar.gz: 198dfe3a2a9841f9bf269ce3a21156acbaf584ac
5
5
  SHA512:
6
- metadata.gz: d8c4602184d1fae30a6feb1cd9b798737ef3d1dc03bdc42d917283232c3527d4f16242af034ace71a701973acc77c207ae7b12c6e0ae40893e795b299b85cc9b
7
- data.tar.gz: a5246b6165e3463a9e38edb0fd7cf8c28db10c97a60f5e8c7a668d0336dd8b28e2bbf79b9d92b36e8d505130b2d8170f8b19f5db8e084c01c3010403b1c8c821
6
+ metadata.gz: e6d8cb12624484c125a154268bc1f02ec058353ce05b1a487cedf53504380a34ac33a8ed131e203bd4dd63b29d39e3bc2b19afd3d572106370dd3748f0c6ebce
7
+ data.tar.gz: bd488989524220b9b6b9bf096ba93199e3c27e4d823c34972156aabeee8d4b8f593504308131177196036f8fd30bffc3aee95d05bf005ce53695f9fa0161884b
@@ -1,3 +1,9 @@
1
+ ## 1.7.8 (2014-12-06)
2
+
3
+ Bugfixes:
4
+
5
+ - Hide credentials while warning about gems with ambiguous sources (#3256, @tmoore)
6
+
1
7
  ## 1.7.7 (2014-11-19)
2
8
 
3
9
  Bugfixes:
@@ -12,6 +12,7 @@ module Bundler
12
12
  preserve_gem_path
13
13
  ORIGINAL_ENV = ENV.to_hash
14
14
 
15
+ autoload :AnonymizableURI, 'bundler/anonymizable_uri'
15
16
  autoload :Definition, 'bundler/definition'
16
17
  autoload :Dependency, 'bundler/dependency'
17
18
  autoload :DepProxy, 'bundler/dep_proxy'
@@ -0,0 +1,16 @@
1
+ module Bundler
2
+ class AnonymizableURI
3
+ attr_reader :original_uri,
4
+ :without_credentials
5
+
6
+ def initialize(original_uri)
7
+ @original_uri = original_uri.freeze
8
+ @without_credentials ||=
9
+ if original_uri.userinfo
10
+ original_uri.dup.tap { |uri| uri.user = uri.password = nil }.freeze
11
+ else
12
+ original_uri
13
+ end
14
+ end
15
+ end
16
+ end
@@ -96,8 +96,7 @@ module Bundler
96
96
  @max_retries = 3 # How many retries for the API call
97
97
 
98
98
  @remote_uri = Bundler::Source.mirror_for(remote_uri)
99
- @public_uri = @remote_uri.dup
100
- @public_uri.user, @public_uri.password = nil, nil # don't print these
99
+ @anonymizable_uri = AnonymizableURI.new(@remote_uri.dup) unless @remote_uri.nil?
101
100
 
102
101
  Socket.do_not_reverse_lookup = true
103
102
  connection # create persistent connection
@@ -131,7 +130,7 @@ module Bundler
131
130
  end
132
131
 
133
132
  def uri
134
- @public_uri
133
+ @anonymizable_uri.without_credentials unless @anonymizable_uri.nil?
135
134
  end
136
135
 
137
136
  # fetch a gem specification
@@ -186,7 +185,7 @@ module Bundler
186
185
  spec = RemoteSpecification.new(name, version, platform, self)
187
186
  end
188
187
  spec.source = source
189
- spec.source_uri = @remote_uri
188
+ spec.source_uri = @anonymizable_uri
190
189
  index << spec
191
190
  end
192
191
 
@@ -387,6 +386,7 @@ module Bundler
387
386
  raise AuthenticationRequiredError.new(uri) if auth.nil?
388
387
 
389
388
  @remote_uri.user, @remote_uri.password = *auth.split(":", 2)
389
+ @anonymizable_uri = AnonymizableURI.new(@remote_uri.dup)
390
390
  yield
391
391
  end
392
392
 
@@ -83,9 +83,8 @@ module Bundler
83
83
  # by rubygems.org are broken and wrong.
84
84
  if spec.source_uri
85
85
  # Check for this spec from other sources
86
- uris = [spec.source_uri]
86
+ uris = [spec.source_uri.without_credentials]
87
87
  uris += source_uris_for_spec(spec)
88
- uris.compact!
89
88
  uris.uniq!
90
89
  Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
91
90
 
@@ -186,14 +185,15 @@ module Bundler
186
185
  end
187
186
  end
188
187
 
189
- protected
188
+ private
190
189
 
191
190
  def source_uris_for_spec(spec)
192
- specs.search_all(spec.name).map{|s| s.source_uri }
191
+ specs.search_all(spec.name).inject([]) do |uris, spec|
192
+ uris << spec.source_uri.without_credentials if spec.source_uri
193
+ uris
194
+ end
193
195
  end
194
196
 
195
- private
196
-
197
197
  def cached_gem(spec)
198
198
  cached_gem = cached_path(spec)
199
199
  unless cached_gem
@@ -330,7 +330,7 @@ module Bundler
330
330
 
331
331
  def fetch_gem(spec)
332
332
  return false unless spec.source_uri
333
- Fetcher.download_gem_from_uri(spec, spec.source_uri)
333
+ Fetcher.download_gem_from_uri(spec, spec.source_uri.original_uri)
334
334
  end
335
335
 
336
336
  def builtin_gem?(spec)
@@ -2,5 +2,5 @@ module Bundler
2
2
  # We're doing this because we might write tests that deal
3
3
  # with other versions of bundler and we are unsure how to
4
4
  # handle this better.
5
- VERSION = "1.7.7" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.7.8" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -0,0 +1,32 @@
1
+ require 'spec_helper'
2
+ require 'bundler/anonymizable_uri'
3
+
4
+ describe Bundler::AnonymizableURI do
5
+ let(:anonymizable_uri) { Bundler::AnonymizableURI.new(original_uri) }
6
+
7
+ describe "#without_credentials" do
8
+ context "when the original URI has no credentials" do
9
+ let(:original_uri) { URI('https://rubygems.org') }
10
+
11
+ it "returns the original URI" do
12
+ expect(anonymizable_uri.without_credentials).to eq(original_uri)
13
+ end
14
+ end
15
+
16
+ context "when the original URI has a username and password" do
17
+ let(:original_uri) { URI("https://username:password@gems.example.com") }
18
+
19
+ it "returns the URI without username and password" do
20
+ expect(anonymizable_uri.without_credentials).to eq(URI("https://gems.example.com"))
21
+ end
22
+ end
23
+
24
+ context "when the original URI has only a username" do
25
+ let(:original_uri) { URI("https://SeCrEt-ToKeN@gem.fury.io/me/") }
26
+
27
+ it "returns the URI without username and password" do
28
+ expect(anonymizable_uri.without_credentials).to eq(URI("https://gem.fury.io/me/"))
29
+ end
30
+ end
31
+ end
32
+ end
@@ -444,6 +444,19 @@ describe "gemcutter's dependency API" do
444
444
  expect(out).not_to include("#{user}:#{password}")
445
445
  end
446
446
 
447
+ it "strips http basic auth creds when warning about ambiguous sources" do
448
+ gemfile <<-G
449
+ source "#{basic_auth_source_uri}"
450
+ source "file://#{gem_repo1}"
451
+ gem "rack"
452
+ G
453
+
454
+ bundle :install, :artifice => "endpoint_basic_authentication"
455
+ expect(out).to include("Warning: the gem 'rack' was found in multiple sources.")
456
+ expect(out).not_to include("#{user}:#{password}")
457
+ should_be_installed "rack 1.0.0"
458
+ end
459
+
447
460
  it "does not pass the user / password to different hosts on redirect" do
448
461
  gemfile <<-G
449
462
  source "#{basic_auth_source_uri}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.7
4
+ version: 1.7.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-11-21 00:00:00.000000000 Z
14
+ date: 2014-12-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: mustache
@@ -95,6 +95,7 @@ files:
95
95
  - bin/bundler
96
96
  - bundler.gemspec
97
97
  - lib/bundler.rb
98
+ - lib/bundler/anonymizable_uri.rb
98
99
  - lib/bundler/capistrano.rb
99
100
  - lib/bundler/cli.rb
100
101
  - lib/bundler/cli/binstubs.rb
@@ -264,6 +265,7 @@ files:
264
265
  - man/bundle.ronn
265
266
  - man/gemfile.5.ronn
266
267
  - man/index.txt
268
+ - spec/bundler/anonymizable_uri_spec.rb
267
269
  - spec/bundler/bundler_spec.rb
268
270
  - spec/bundler/cli_spec.rb
269
271
  - spec/bundler/definition_spec.rb
@@ -397,6 +399,7 @@ signing_key:
397
399
  specification_version: 4
398
400
  summary: The best way to manage your application's dependencies
399
401
  test_files:
402
+ - spec/bundler/anonymizable_uri_spec.rb
400
403
  - spec/bundler/bundler_spec.rb
401
404
  - spec/bundler/cli_spec.rb
402
405
  - spec/bundler/definition_spec.rb