bundler 1.12.6 → 1.13.0.pre.1

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.

Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +15 -13
  3. data/.travis.yml +2 -2
  4. data/CHANGELOG.md +40 -3
  5. data/CONTRIBUTING.md +9 -5
  6. data/DEVELOPMENT.md +30 -18
  7. data/ISSUES.md +26 -22
  8. data/Rakefile +15 -4
  9. data/bin/rubocop +1 -1
  10. data/bundler.gemspec +2 -2
  11. data/exe/bundle +7 -0
  12. data/lib/bundler.rb +6 -3
  13. data/lib/bundler/capistrano.rb +1 -1
  14. data/lib/bundler/cli.rb +27 -10
  15. data/lib/bundler/cli/binstubs.rb +2 -0
  16. data/lib/bundler/cli/exec.rb +1 -1
  17. data/lib/bundler/cli/install.rb +87 -56
  18. data/lib/bundler/cli/lock.rb +5 -0
  19. data/lib/bundler/cli/open.rb +3 -1
  20. data/lib/bundler/cli/outdated.rb +8 -8
  21. data/lib/bundler/cli/plugin.rb +23 -0
  22. data/lib/bundler/cli/update.rb +2 -2
  23. data/lib/bundler/cli/viz.rb +3 -0
  24. data/lib/bundler/definition.rb +72 -16
  25. data/lib/bundler/dsl.rb +19 -7
  26. data/lib/bundler/endpoint_specification.rb +2 -2
  27. data/lib/bundler/env.rb +2 -2
  28. data/lib/bundler/errors.rb +15 -1
  29. data/lib/bundler/fetcher.rb +5 -2
  30. data/lib/bundler/fetcher/compact_index.rb +2 -2
  31. data/lib/bundler/fetcher/dependency.rb +8 -4
  32. data/lib/bundler/fetcher/downloader.rb +1 -1
  33. data/lib/bundler/friendly_errors.rb +1 -1
  34. data/lib/bundler/index.rb +29 -36
  35. data/lib/bundler/inline.rb +14 -4
  36. data/lib/bundler/installer.rb +22 -3
  37. data/lib/bundler/installer/gem_installer.rb +1 -1
  38. data/lib/bundler/installer/standalone.rb +1 -1
  39. data/lib/bundler/mirror.rb +4 -4
  40. data/lib/bundler/plugin.rb +156 -0
  41. data/lib/bundler/plugin/api.rb +56 -0
  42. data/lib/bundler/plugin/dsl.rb +29 -0
  43. data/lib/bundler/plugin/index.rb +88 -0
  44. data/lib/bundler/plugin/installer.rb +99 -0
  45. data/lib/bundler/plugin/installer/git.rb +38 -0
  46. data/lib/bundler/plugin/installer/rubygems.rb +27 -0
  47. data/lib/bundler/plugin/source_list.rb +24 -0
  48. data/lib/bundler/postit_trampoline.rb +54 -0
  49. data/lib/bundler/psyched_yaml.rb +1 -1
  50. data/lib/bundler/remote_specification.rb +5 -5
  51. data/lib/bundler/resolver.rb +27 -29
  52. data/lib/bundler/ruby_version.rb +29 -3
  53. data/lib/bundler/rubygems_ext.rb +3 -1
  54. data/lib/bundler/rubygems_integration.rb +10 -4
  55. data/lib/bundler/runtime.rb +1 -16
  56. data/lib/bundler/settings.rb +19 -15
  57. data/lib/bundler/setup.rb +1 -0
  58. data/lib/bundler/shared_helpers.rb +3 -0
  59. data/lib/bundler/source.rb +4 -3
  60. data/lib/bundler/source/gemspec.rb +13 -0
  61. data/lib/bundler/source/git.rb +4 -3
  62. data/lib/bundler/source/git/git_proxy.rb +9 -5
  63. data/lib/bundler/source/path.rb +11 -2
  64. data/lib/bundler/source/rubygems.rb +28 -15
  65. data/lib/bundler/source_list.rb +5 -1
  66. data/lib/bundler/spec_set.rb +3 -3
  67. data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +21 -0
  68. data/lib/bundler/ssl_certs/rubygems.org/{AddTrustExternalCARoot-2048.pem → AddTrustExternalCARoot.pem} +0 -0
  69. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +54 -29
  70. data/lib/bundler/templates/newgem/newgem.gemspec.tt +5 -2
  71. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +3 -3
  72. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -2
  73. data/lib/bundler/ui/shell.rb +4 -0
  74. data/lib/bundler/ui/silent.rb +3 -0
  75. data/lib/bundler/uri_credentials_filter.rb +36 -0
  76. data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +1 -1
  77. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +50 -0
  78. data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +80 -0
  79. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +56 -144
  80. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +35 -0
  81. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +58 -0
  82. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +61 -0
  83. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +53 -0
  84. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +114 -0
  85. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +45 -0
  86. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +35 -0
  87. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +123 -0
  88. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  89. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +46 -51
  90. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +4 -2
  91. data/lib/bundler/vendor/postit/lib/postit.rb +15 -0
  92. data/lib/bundler/vendor/postit/lib/postit/environment.rb +44 -0
  93. data/lib/bundler/vendor/postit/lib/postit/installer.rb +28 -0
  94. data/lib/bundler/vendor/postit/lib/postit/parser.rb +21 -0
  95. data/lib/bundler/vendor/postit/lib/postit/setup.rb +12 -0
  96. data/lib/bundler/vendor/postit/lib/postit/version.rb +3 -0
  97. data/lib/bundler/version.rb +1 -1
  98. data/lib/bundler/vlad.rb +1 -1
  99. data/lib/bundler/yaml_serializer.rb +67 -0
  100. data/man/bundle-install.ronn +10 -5
  101. data/man/bundle-package.ronn +7 -6
  102. data/man/bundle-platform.ronn +1 -1
  103. data/man/bundle-update.ronn +5 -2
  104. data/man/bundle.ronn +5 -5
  105. data/man/gemfile.5.ronn +32 -28
  106. metadata +37 -12
  107. data/lib/bundler/ssl_certs/Fastly.pem +0 -82
  108. data/lib/bundler/ssl_certs/GlobalSignOrganizationValidationCA.pem +0 -26
  109. data/lib/bundler/ssl_certs/GlobalSignRoot.pem +0 -18
  110. data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRoot.pem +0 -18
@@ -106,14 +106,8 @@ module Bundler
106
106
  specs.values
107
107
  end
108
108
 
109
- def activate_platform(platform)
110
- unless @activated.include?(platform)
111
- if for?(platform, nil)
112
- @activated << platform
113
- return __dependencies[platform] || []
114
- end
115
- end
116
- []
109
+ def activate_platform!(platform)
110
+ @activated << platform if !@activated.include?(platform) && for?(platform, nil)
117
111
  end
118
112
 
119
113
  def name
@@ -131,7 +125,7 @@ module Bundler
131
125
  def for?(platform, required_ruby_version)
132
126
  if spec = @specs[platform]
133
127
  if required_ruby_version && spec.respond_to?(:required_ruby_version) && spec_required_ruby_version = spec.required_ruby_version
134
- spec_required_ruby_version.satisfied_by?(required_ruby_version.gem_version)
128
+ spec_required_ruby_version.satisfied_by?(required_ruby_version.to_gem_version_with_patchlevel)
135
129
  else
136
130
  true
137
131
  end
@@ -240,8 +234,6 @@ module Bundler
240
234
  Bundler.ui.info ".", false
241
235
  end
242
236
 
243
- private
244
-
245
237
  include Molinillo::SpecificationProvider
246
238
 
247
239
  def dependencies_for(specification)
@@ -252,28 +244,34 @@ module Bundler
252
244
  platform = dependency.__platform
253
245
  dependency = dependency.dep unless dependency.is_a? Gem::Dependency
254
246
  search = @search_for[dependency] ||= begin
255
- index = @source_requirements[dependency.name] || @index
247
+ index = index_for(dependency)
256
248
  results = index.search(dependency, @base[dependency.name])
257
249
  if vertex = @base_dg.vertex_named(dependency.name)
258
250
  locked_requirement = vertex.payload.requirement
259
251
  end
260
252
  if results.any?
261
- version = results.first.version
262
- nested = [[]]
253
+ nested = []
263
254
  results.each do |spec|
264
- if spec.version != version
265
- nested << []
266
- version = spec.version
255
+ version, specs = nested.last
256
+ if version == spec.version
257
+ specs << spec
258
+ else
259
+ nested << [spec.version, [spec]]
267
260
  end
268
- nested.last << spec
269
261
  end
270
- groups = nested.map {|a| SpecGroup.new(a) }
271
- !locked_requirement ? groups : groups.select {|sg| locked_requirement.satisfied_by? sg.version }
262
+ nested.reduce([]) do |groups, (version, specs)|
263
+ next groups if locked_requirement && !locked_requirement.satisfied_by?(version)
264
+ groups << SpecGroup.new(specs)
265
+ end
272
266
  else
273
267
  []
274
268
  end
275
269
  end
276
- search.select {|sg| sg.for?(platform, @ruby_version) }.each {|sg| sg.activate_platform(platform) }
270
+ search.select {|sg| sg.for?(platform, @ruby_version) }.each {|sg| sg.activate_platform!(platform) }
271
+ end
272
+
273
+ def index_for(dependency)
274
+ @source_requirements[dependency.name] || @index
277
275
  end
278
276
 
279
277
  def name_for(dependency)
@@ -293,7 +291,7 @@ module Bundler
293
291
  end
294
292
 
295
293
  def requirement_satisfied_by?(requirement, activated, spec)
296
- requirement.matches_spec?(spec)
294
+ requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec)
297
295
  end
298
296
 
299
297
  def sort_dependencies(dependencies, activated, conflicts)
@@ -308,20 +306,20 @@ module Bundler
308
306
  end
309
307
  end
310
308
 
309
+ private
310
+
311
311
  def amount_constrained(dependency)
312
312
  @amount_constrained ||= {}
313
313
  @amount_constrained[dependency.name] ||= begin
314
314
  if (base = @base[dependency.name]) && !base.empty?
315
315
  dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1
316
316
  else
317
- base_dep = Dependency.new dependency.name, ">= 0.a"
318
- all = search_for(DepProxy.new base_dep, dependency.__platform).size.to_f
319
- if all.zero?
320
- 0
321
- elsif (search = search_for(dependency).size.to_f) == all && all == 1
322
- 0
317
+ all = index_for(dependency).search(dependency.name).size
318
+ if all <= 1
319
+ all
323
320
  else
324
- search / all
321
+ search = search_for(dependency).size
322
+ search - all
325
323
  end
326
324
  end
327
325
  end
@@ -38,6 +38,22 @@ module Bundler
38
38
  output
39
39
  end
40
40
 
41
+ # @private
42
+ PATTERN = /
43
+ ruby\s
44
+ ([\d.]+) # ruby version
45
+ (?:p(\d+))? # optional patchlevel
46
+ (?:\s\((\S+)\s(.+)\))? # optional engine info
47
+ /xo
48
+
49
+ # Returns a RubyVersion from the given string.
50
+ # @param [String] the version string to match.
51
+ # @return [RubyVersion,Nil] The version if the string is a valid RubyVersion
52
+ # description, and nil otherwise.
53
+ def self.from_string(string)
54
+ new($1, $2, $3, $4) if string =~ PATTERN
55
+ end
56
+
41
57
  def single_version_string
42
58
  to_s(gem_version)
43
59
  end
@@ -64,7 +80,7 @@ module Bundler
64
80
  # 2. ruby_version
65
81
  # 3. engine_version
66
82
  def diff(other)
67
- raise ArgumentError, "Can only diff with a RubyVersion" unless other.is_a?(RubyVersion)
83
+ raise ArgumentError, "Can only diff with a RubyVersion, not a #{other.class}" unless other.is_a?(RubyVersion)
68
84
  if engine != other.engine && @input_engine
69
85
  [:engine, engine, other.engine]
70
86
  elsif versions.empty? || !matches?(versions, other.gem_version)
@@ -87,9 +103,11 @@ module Bundler
87
103
  # not defined in ruby 1.8.7
88
104
  "ruby"
89
105
  end
106
+ # :sob: mocking RUBY_VERSION breaks stuff on 1.8.7
107
+ ruby_version = ENV.fetch("BUNDLER_SPEC_RUBY_VERSION") { RUBY_VERSION }.dup
90
108
  ruby_engine_version = case ruby_engine
91
109
  when "ruby"
92
- RUBY_VERSION.dup
110
+ ruby_version
93
111
  when "rbx"
94
112
  Rubinius::VERSION.dup
95
113
  when "jruby"
@@ -97,7 +115,15 @@ module Bundler
97
115
  else
98
116
  raise BundlerError, "RUBY_ENGINE value #{RUBY_ENGINE} is not recognized"
99
117
  end
100
- @ruby_version ||= RubyVersion.new(RUBY_VERSION.dup, RUBY_PATCHLEVEL.to_s, ruby_engine, ruby_engine_version)
118
+ @ruby_version ||= RubyVersion.new(ruby_version, RUBY_PATCHLEVEL.to_s, ruby_engine, ruby_engine_version)
119
+ end
120
+
121
+ def to_gem_version_with_patchlevel
122
+ @gem_version_with_patch ||= begin
123
+ Gem::Version.create("#{@gem_version}.#{@patchlevel}")
124
+ rescue ArgumentError
125
+ @gem_version
126
+ end
101
127
  end
102
128
 
103
129
  private
@@ -22,9 +22,11 @@ module Gem
22
22
  alias_method :rg_full_gem_path, :full_gem_path
23
23
  alias_method :rg_loaded_from, :loaded_from
24
24
 
25
+ attr_writer :full_gem_path unless instance_methods.include?(:full_gem_path=)
26
+
25
27
  def full_gem_path
26
28
  if source.respond_to?(:path)
27
- Pathname.new(loaded_from).dirname.expand_path(Bundler.root).to_s.untaint
29
+ Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.untaint
28
30
  else
29
31
  rg_full_gem_path
30
32
  end
@@ -212,7 +212,7 @@ module Bundler
212
212
  # Fetch all specs, minus prerelease specs
213
213
  spec_list = fetch_specs(true, false)
214
214
  # Then fetch the prerelease specs
215
- fetch_prerelease_specs.each {|k, v| spec_list[k].push(*v) }
215
+ fetch_prerelease_specs.each {|k, v| spec_list[k].concat(v) }
216
216
 
217
217
  spec_list.values.first
218
218
  ensure
@@ -462,8 +462,14 @@ module Bundler
462
462
  end
463
463
 
464
464
  def redefine_method(klass, method, &block)
465
- if klass.instance_methods(false).include?(method)
466
- klass.send(:remove_method, method)
465
+ begin
466
+ if klass.instance_method(method) && method != :initialize
467
+ # doing this to ensure we also get private methods
468
+ klass.send(:remove_method, method)
469
+ end
470
+ rescue NameError
471
+ # method isn't defined
472
+ nil
467
473
  end
468
474
  klass.send(:define_method, method, &block)
469
475
  end
@@ -605,7 +611,7 @@ module Bundler
605
611
  specs = fetch_specs(source, remote, "specs")
606
612
  pres = fetch_specs(source, remote, "prerelease_specs") || []
607
613
 
608
- specs.push(*pres)
614
+ specs.concat(pres)
609
615
  end
610
616
 
611
617
  def download_gem(spec, uri, path)
@@ -107,14 +107,6 @@ module Bundler
107
107
  end
108
108
  end
109
109
 
110
- def dependencies_for(*groups)
111
- if groups.empty?
112
- dependencies
113
- else
114
- dependencies.select {|d| (groups & d.groups).any? }
115
- end
116
- end
117
-
118
110
  alias_method :gems, :specs
119
111
 
120
112
  def cache(custom_path = nil)
@@ -125,16 +117,9 @@ module Bundler
125
117
 
126
118
  Bundler.ui.info "Updating files in #{Bundler.settings.app_cache_path}"
127
119
 
128
- # Do not try to cache specification for the gem described by the .gemspec
129
- root_gem_name = nil
130
- if gemspec_cache_hash = Bundler.instance_variable_get(:@gemspec_cache)
131
- gemspec = gemspec_cache_hash.values.first
132
- root_gem_name = gemspec.name unless gemspec.nil?
133
- end
134
-
135
120
  specs.each do |spec|
136
121
  next if spec.name == "bundler"
137
- next if !Dir.glob("*.gemspec").empty? && spec.source.class == Bundler::Source::Path && root_gem_name && spec.name == root_gem_name
122
+ next if spec.source.is_a?(Source::Gemspec)
138
123
  spec.source.send(:fetch_gem, spec) if Bundler.settings[:cache_all_platforms] && spec.source.respond_to?(:fetch_gem, true)
139
124
  spec.source.cache(spec, custom_path) if spec.source.respond_to?(:cache)
140
125
  end
@@ -3,7 +3,7 @@ require "uri"
3
3
 
4
4
  module Bundler
5
5
  class Settings
6
- BOOL_KEYS = %w(frozen cache_all no_prune disable_local_branch_check disable_shared_gems ignore_messages gem.mit gem.coc silence_root_warning no_install).freeze
6
+ BOOL_KEYS = %w(frozen cache_all no_prune disable_local_branch_check disable_shared_gems ignore_messages gem.mit gem.coc silence_root_warning no_install plugins).freeze
7
7
  NUMBER_KEYS = %w(retry timeout redirect ssl_verify_mode).freeze
8
8
  DEFAULT_CONFIG = { :retry => 3, :timeout => 10, :redirect => 5 }.freeze
9
9
 
@@ -201,8 +201,8 @@ module Bundler
201
201
  hash.delete(key) if value.nil?
202
202
  SharedHelpers.filesystem_access(file) do |p|
203
203
  FileUtils.mkdir_p(p.dirname)
204
- require "bundler/psyched_yaml"
205
- File.open(p, "w") {|f| f.puts YAML.dump(hash) }
204
+ require "bundler/yaml_serializer"
205
+ p.open("w") {|f| f.write(YAMLSerializer.dump(hash)) }
206
206
  end
207
207
  end
208
208
 
@@ -221,25 +221,29 @@ module Bundler
221
221
  Pathname.new(@root).join("config") if @root
222
222
  end
223
223
 
224
+ CONFIG_REGEX = %r{ # rubocop:disable Style/RegexpLiteral
225
+ ^
226
+ (BUNDLE_.+):\s # the key
227
+ (?: !\s)? # optional exclamation mark found with ruby 1.9.3
228
+ (['"]?) # optional opening quote
229
+ (.* # contents of the value
230
+ (?: # optionally, up until the next key
231
+ (\n(?!BUNDLE).+)*
232
+ )
233
+ )
234
+ \2 # matching closing quote
235
+ $
236
+ }xo
237
+
224
238
  def load_config(config_file)
225
239
  SharedHelpers.filesystem_access(config_file, :read) do
226
240
  valid_file = config_file && config_file.exist? && !config_file.size.zero?
227
241
  return {} if ignore_config? || !valid_file
228
- config_regex = /^(BUNDLE_.+): (['"]?)(.*(?:\n(?!BUNDLE).+)?)\2$/
229
- config_pairs = config_file.read.scan(config_regex).map do |m|
230
- key, _, value = m
231
- [convert_to_backward_compatible_key(key), value.gsub(/\s+/, " ").tr('"', "'")]
232
- end
233
- Hash[config_pairs]
242
+ require "bundler/yaml_serializer"
243
+ YAMLSerializer.load config_file.read
234
244
  end
235
245
  end
236
246
 
237
- def convert_to_backward_compatible_key(key)
238
- key = "#{key}/" if key =~ /https?:/i && key !~ %r{/\Z}
239
- key = key.gsub(".", "__") if key.include?(".")
240
- key
241
- end
242
-
243
247
  # TODO: duplicates Rubygems#normalize_uri
244
248
  # TODO: is this the correct place to validate mirror URIs?
245
249
  def self.normalize_uri(uri)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ require "bundler/postit_trampoline" unless ENV["BUNDLE_DISABLE_POSTIT"]
2
3
  require "bundler/shared_helpers"
3
4
 
4
5
  if Bundler::SharedHelpers.in_bundle?
@@ -109,6 +109,8 @@ module Bundler
109
109
  raise TemporaryResourceError.new(path, action)
110
110
  rescue Errno::EPROTO
111
111
  raise VirtualProtocolError.new
112
+ rescue *[const_get_safely(:ENOTSUP, Errno)].compact
113
+ raise OperationNotSupportedError.new(path, action)
112
114
  end
113
115
 
114
116
  def const_get_safely(constant_name, namespace)
@@ -167,6 +169,7 @@ module Bundler
167
169
 
168
170
  # Set BUNDLE_GEMFILE
169
171
  ENV["BUNDLE_GEMFILE"] = find_gemfile.to_s
172
+ ENV["BUNDLER_VERSION"] = Bundler::VERSION
170
173
  end
171
174
 
172
175
  def set_path
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
  module Bundler
3
3
  class Source
4
- autoload :Rubygems, "bundler/source/rubygems"
5
- autoload :Path, "bundler/source/path"
4
+ autoload :Gemspec, "bundler/source/gemspec"
6
5
  autoload :Git, "bundler/source/git"
6
+ autoload :Path, "bundler/source/path"
7
+ autoload :Rubygems, "bundler/source/rubygems"
7
8
 
8
9
  attr_accessor :dependency_names
9
10
 
@@ -18,7 +19,7 @@ module Bundler
18
19
  locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name }
19
20
  locked_spec_version = locked_spec.version if locked_spec
20
21
  if locked_spec_version && spec.version != locked_spec_version
21
- message += " (was #{locked_spec_version})"
22
+ message += " (#{Bundler.ui.add_color("was #{locked_spec_version}", :green)})"
22
23
  end
23
24
  end
24
25
 
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ class Source
4
+ class Gemspec < Path
5
+ attr_reader :gemspec
6
+
7
+ def initialize(options)
8
+ super
9
+ @gemspec = options["gemspec"]
10
+ end
11
+ end
12
+ end
13
+ end
@@ -86,6 +86,7 @@ module Bundler
86
86
  def install_path
87
87
  @install_path ||= begin
88
88
  git_scope = "#{base_name}-#{shortref_for_path(revision)}"
89
+
89
90
  path = Bundler.install_path.join(git_scope)
90
91
 
91
92
  if !path.exist? && Bundler.requires_sudo?
@@ -146,7 +147,7 @@ module Bundler
146
147
  changed
147
148
  end
148
149
 
149
- # TODO: actually cache git specs
150
+ # TODO: cache git specs
150
151
  def specs(*)
151
152
  set_local!(app_cache_path) if has_app_cache? && !local?
152
153
 
@@ -227,8 +228,8 @@ module Bundler
227
228
  end
228
229
 
229
230
  def serialize_gemspecs_in(destination)
230
- expanded_path = destination.expand_path(Bundler.root)
231
- Dir["#{expanded_path}/#{@glob}"].each do |spec_path|
231
+ destination = destination.expand_path(Bundler.root) if destination.relative?
232
+ Dir["#{destination}/#{@glob}"].each do |spec_path|
232
233
  # Evaluate gemspecs and cache the result. Gemspecs
233
234
  # in git might require git or other dependencies.
234
235
  # The gemspecs we cache should already be evaluated.
@@ -86,12 +86,12 @@ module Bundler
86
86
  def checkout
87
87
  if path.exist?
88
88
  return if has_revision_cached?
89
- Bundler.ui.info "Fetching #{uri}"
89
+ Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
90
90
  in_path do
91
91
  git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*")
92
92
  end
93
93
  else
94
- Bundler.ui.info "Fetching #{uri}"
94
+ Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
95
95
  SharedHelpers.filesystem_access(path.dirname) do |p|
96
96
  FileUtils.mkdir_p(p)
97
97
  end
@@ -145,10 +145,14 @@ module Bundler
145
145
  end
146
146
 
147
147
  def git(command, check_errors = true, error_msg = nil)
148
- raise GitNotAllowedError.new(command) unless allow?
148
+ command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
149
+ raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
150
+
149
151
  out = SharedHelpers.with_clean_git_env { `git #{command}` }
150
- raise GitCommandError.new(command, path, error_msg) if check_errors && !$?.success?
151
- out
152
+
153
+ stdout_with_no_credentials = URICredentialsFilter.credential_filtered_string(out, uri)
154
+ raise GitCommandError.new(command_with_no_credentials, path, error_msg) if check_errors && !$?.success?
155
+ stdout_with_no_credentials
152
156
  end
153
157
 
154
158
  def has_revision_cached?
@@ -60,8 +60,8 @@ module Bundler
60
60
  end
61
61
 
62
62
  def eql?(other)
63
- other.instance_of?(Path) &&
64
- expanded_path == expand(other.path) &&
63
+ return unless other.class == Path || other.class == Gemspec
64
+ expanded_path == expand(other.path) &&
65
65
  version == other.version
66
66
  end
67
67
 
@@ -107,6 +107,14 @@ module Bundler
107
107
  name
108
108
  end
109
109
 
110
+ def root
111
+ Bundler.root
112
+ end
113
+
114
+ def is_a_path?
115
+ instance_of?(Path)
116
+ end
117
+
110
118
  private
111
119
 
112
120
  def expanded_path
@@ -186,6 +194,7 @@ module Bundler
186
194
  # Some gem authors put absolute paths in their gemspec
187
195
  # and we have to save them from themselves
188
196
  spec.files = spec.files.map do |p|
197
+ next p unless p =~ /\A#{Pathname::SEPARATOR_PAT}/
189
198
  next if File.directory?(p)
190
199
  begin
191
200
  Pathname.new(p).relative_path_from(gem_dir).to_s