diff options
author | Adrian Gomez <adri4n.steam@gmail.com> | 2017-05-12 12:36:48 -0300 |
---|---|---|
committer | Adrian Gomez <adri4n.steam@gmail.com> | 2017-08-02 21:22:45 -0300 |
commit | c9c4f23e46673ac953b34774934447c779b25e0b (patch) | |
tree | 3b89eac6efc87629aa60e388f0fc3594a83bcf6d /lib/bundler/source | |
parent | 92f7781eda8e429a189c1d2ebc642ec4f8febdbf (diff) | |
download | bundler-c9c4f23e46673ac953b34774934447c779b25e0b.tar.gz |
Allow to add username and password to a remote during a deployment
Diffstat (limited to 'lib/bundler/source')
-rw-r--r-- | lib/bundler/source/path.rb | 4 | ||||
-rw-r--r-- | lib/bundler/source/rubygems.rb | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index 310a30f1ec..806ba81935 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -116,10 +116,6 @@ module Bundler Bundler.root end - def is_a_path? - instance_of?(Path) - end - def expanded_original_path @expanded_original_path ||= expand(original_path) end diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 511216a5c5..70dc5ac038 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -219,13 +219,21 @@ module Bundler @remotes.unshift(uri) unless @remotes.include?(uri) end - def replace_remotes(other_remotes) + def equivalent_remotes?(other_remotes) + other_remotes.map(&method(:remove_auth)) == @remotes.map(&method(:remove_auth)) + end + + def replace_remotes(other_remotes, allow_equivalent = false) return false if other_remotes == @remotes + equivalent = allow_equivalent && equivalent_remotes?(other_remotes) + @remotes = [] other_remotes.reverse_each do |r| add_remote r.to_s end + + !equivalent end def unmet_deps @@ -297,7 +305,7 @@ module Bundler end def suppress_configured_credentials(remote) - remote_nouser = remote.dup.tap {|uri| uri.user = uri.password = nil }.to_s + remote_nouser = remove_auth(remote) if remote.userinfo && remote.userinfo == Bundler.settings[remote_nouser] remote_nouser else @@ -305,6 +313,10 @@ module Bundler end end + def remove_auth(remote) + remote.dup.tap {|uri| uri.user = uri.password = nil }.to_s + end + def installed_specs @installed_specs ||= Index.build do |idx| Bundler.rubygems.all_specs.reverse_each do |spec| |