bundler 1.1.pre.8 → 1.1.pre.9

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 (45) hide show
  1. data/.travis.yml +29 -5
  2. data/CHANGELOG.md +58 -3
  3. data/Rakefile +25 -2
  4. data/UPGRADING.md +2 -2
  5. data/bin/bundle +10 -10
  6. data/bundler.gemspec +2 -1
  7. data/lib/bundler.rb +8 -6
  8. data/lib/bundler/cli.rb +45 -14
  9. data/lib/bundler/definition.rb +4 -4
  10. data/lib/bundler/dependency.rb +1 -8
  11. data/lib/bundler/deployment.rb +8 -3
  12. data/lib/bundler/dsl.rb +3 -18
  13. data/lib/bundler/fetcher.rb +15 -3
  14. data/lib/bundler/gem_helper.rb +1 -1
  15. data/lib/bundler/gem_installer.rb +9 -0
  16. data/lib/bundler/installer.rb +33 -18
  17. data/lib/bundler/resolver.rb +19 -7
  18. data/lib/bundler/rubygems_ext.rb +3 -1
  19. data/lib/bundler/rubygems_integration.rb +37 -4
  20. data/lib/bundler/runtime.rb +47 -15
  21. data/lib/bundler/settings.rb +1 -3
  22. data/lib/bundler/source.rb +23 -23
  23. data/lib/bundler/ui.rb +9 -9
  24. data/lib/bundler/version.rb +1 -1
  25. data/man/bundle-install.ronn +3 -3
  26. data/man/bundle.ronn +0 -6
  27. data/man/gemfile.5.ronn +2 -2
  28. data/spec/bundler/dsl_spec.rb +22 -0
  29. data/spec/{other → bundler}/gem_helper_spec.rb +7 -0
  30. data/spec/install/deprecated_spec.rb +2 -3
  31. data/spec/install/gems/dependency_api_spec.rb +13 -2
  32. data/spec/install/gems/groups_spec.rb +14 -0
  33. data/spec/install/gems/simple_case_spec.rb +34 -1
  34. data/spec/install/gems/standalone_spec.rb +24 -10
  35. data/spec/lock/lockfile_spec.rb +48 -15
  36. data/spec/other/clean_spec.rb +236 -37
  37. data/spec/other/exec_spec.rb +6 -0
  38. data/spec/other/help_spec.rb +2 -1
  39. data/spec/other/newgem_spec.rb +18 -0
  40. data/spec/other/outdated_spec.rb +19 -2
  41. data/spec/other/show_spec.rb +6 -0
  42. data/spec/runtime/setup_spec.rb +19 -0
  43. data/spec/support/builders.rb +10 -1
  44. data/spec/update/gems_spec.rb +3 -2
  45. metadata +90 -17
@@ -197,6 +197,10 @@ module Bundler
197
197
  def lock(file)
198
198
  contents = to_lock
199
199
 
200
+ # Convert to \r\n if the existing lock has them
201
+ # i.e., Windows with `git config core.autocrlf=true`
202
+ contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")
203
+
200
204
  return if @lockfile_contents == contents
201
205
 
202
206
  if Bundler.settings[:frozen]
@@ -204,10 +208,6 @@ module Bundler
204
208
  return
205
209
  end
206
210
 
207
- # Convert to \r\n if the existing lock has them
208
- # i.e., Windows with `git config core.autocrlf=true`
209
- contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")
210
-
211
211
  File.open(file, 'wb'){|f| f.puts(contents) }
212
212
  end
213
213
 
@@ -71,15 +71,8 @@ module Bundler
71
71
  end
72
72
 
73
73
  def to_lock
74
- out = " #{name}"
75
-
76
- unless requirement == Gem::Requirement.default
77
- reqs = requirement.requirements.map{|o,v| "#{o} #{v}" }
78
- out << " (#{reqs.join(', ')})"
79
- end
80
-
74
+ out = super
81
75
  out << '!' if source
82
-
83
76
  out << "\n"
84
77
  end
85
78
 
@@ -4,9 +4,11 @@ module Bundler
4
4
  if defined?(Capistrano) && context.is_a?(Capistrano::Configuration)
5
5
  context_name = "capistrano"
6
6
  role_default = "{:except => {:no_release => true}}"
7
+ error_type = ::Capistrano::CommandError
7
8
  else
8
9
  context_name = "vlad"
9
10
  role_default = "[:app]"
11
+ error_type = ::Rake::CommandFailedError
10
12
  end
11
13
 
12
14
  roles = context.fetch(:bundle_roles, false)
@@ -39,13 +41,16 @@ module Bundler
39
41
  bundle_dir = context.fetch(:bundle_dir, File.join(context.fetch(:shared_path), 'bundle'))
40
42
  bundle_gemfile = context.fetch(:bundle_gemfile, "Gemfile")
41
43
  bundle_without = [*context.fetch(:bundle_without, [:development, :test])].compact
42
-
43
- args = ["--gemfile #{File.join(context.fetch(:current_release), bundle_gemfile)}"]
44
+ current_release = context.fetch(:current_release)
45
+ if current_release.to_s.empty?
46
+ raise error_type.new("Cannot detect current release path - make sure you have deployed at least once.")
47
+ end
48
+ args = ["--gemfile #{File.join(current_release, bundle_gemfile)}"]
44
49
  args << "--path #{bundle_dir}" unless bundle_dir.to_s.empty?
45
50
  args << bundle_flags.to_s
46
51
  args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty?
47
52
 
48
- run "cd #{context.fetch(:current_release)} && #{bundle_cmd} install #{args.join(' ')}"
53
+ run "cd #{current_release} && #{bundle_cmd} install #{args.join(' ')}"
49
54
  end
50
55
  end
51
56
  end
data/lib/bundler/dsl.rb CHANGED
@@ -20,6 +20,8 @@ module Bundler
20
20
  @env = nil
21
21
  end
22
22
 
23
+ attr_accessor :dependencies
24
+
23
25
  def gemspec(opts = nil)
24
26
  path = opts && opts[:path] || '.'
25
27
  name = opts && opts[:name] || '{,*}'
@@ -167,14 +169,6 @@ module Bundler
167
169
  end
168
170
  end
169
171
 
170
- deprecate :only, :group
171
- deprecate :except
172
- deprecate :disable_system_gems
173
- deprecate :disable_rubygems
174
- deprecate :clear_sources
175
- deprecate :bundle_path
176
- deprecate :bin_path
177
-
178
172
  private
179
173
 
180
174
  def _normalize_hash(opts)
@@ -217,7 +211,7 @@ module Bundler
217
211
  raise DslError, "`#{p}` is not a valid platform. The available options are: #{VALID_PLATFORMS.inspect}"
218
212
  end
219
213
 
220
- if github = opts.delete(:github)
214
+ if github = opts.delete("github")
221
215
  github = "#{github}/#{github}" unless github.include?("/")
222
216
  opts["git"] = "git://github.com/#{github}.git"
223
217
  end
@@ -241,15 +235,6 @@ module Bundler
241
235
  end
242
236
 
243
237
  def _deprecated_options(options)
244
- if options.include?(:require_as)
245
- raise DeprecatedError, "Please replace :require_as with :require"
246
- elsif options.include?(:vendored_at)
247
- raise DeprecatedError, "Please replace :vendored_at with :path"
248
- elsif options.include?(:only)
249
- raise DeprecatedError, "Please replace :only with :group"
250
- elsif options.include?(:except)
251
- raise DeprecatedError, "The :except option is no longer supported"
252
- end
253
238
  end
254
239
  end
255
240
  end
@@ -117,7 +117,7 @@ module Bundler
117
117
  begin
118
118
  Bundler.ui.debug "Fetching from: #{uri}"
119
119
  response = @@connection.request(uri)
120
- rescue SocketError, Timeout
120
+ rescue SocketError, Timeout, Net::HTTP::Persistent::Error
121
121
  raise Bundler::HTTPError, "Network error while fetching #{uri}"
122
122
  end
123
123
 
@@ -147,8 +147,20 @@ module Bundler
147
147
 
148
148
  spec_list = gem_list.map do |s|
149
149
  dependencies = s[:dependencies].map do |d|
150
- name, requirement = d
151
- dep = Gem::Dependency.new(name, requirement.split(", "))
150
+ begin
151
+ name, requirement = d
152
+ dep = Gem::Dependency.new(name, requirement.split(", "))
153
+ rescue ArgumentError => e
154
+ if e.message.include?('Illformed requirement ["#<YAML::Syck::DefaultKey')
155
+ puts # we shouldn't print the error message on the "fetching info" status line
156
+ raise GemspecError, %{Unfortunately, the gem #{s[:name]} (#{s[:number]}) } +
157
+ %{has an invalid gemspec. As a result, Bundler cannot install this Gemfile. } +
158
+ %{Please ask the gem author to yank the bad version to fix this issue. For } +
159
+ %{more information, see http://bit.ly/illformed-requirement.}
160
+ else
161
+ raise e
162
+ end
163
+ end
152
164
 
153
165
  deps_list << dep.name
154
166
 
@@ -41,7 +41,7 @@ module Bundler
41
41
 
42
42
  def build_gem
43
43
  file_name = nil
44
- sh("gem build '#{spec_path}'") { |out, code|
44
+ sh("gem build -V '#{spec_path}'") { |out, code|
45
45
  file_name = File.basename(built_gem_path)
46
46
  FileUtils.mkdir_p(File.join(base, 'pkg'))
47
47
  FileUtils.mv(built_gem_path, 'pkg')
@@ -0,0 +1,9 @@
1
+ require 'rubygems/installer'
2
+
3
+ module Bundler
4
+ class GemInstaller < Gem::Installer
5
+ def check_executable_overwrite(filename)
6
+ # Bundler needs to install gems regardless of binstub overwriting
7
+ end
8
+ end
9
+ end
@@ -53,21 +53,7 @@ module Bundler
53
53
  # the gem.
54
54
  Installer.post_install_messages = {}
55
55
  specs.each do |spec|
56
- Bundler::Fetcher.fetch(spec) if spec.source.is_a?(Bundler::Source::Rubygems)
57
-
58
- # unless requested_specs.include?(spec)
59
- # Bundler.ui.debug " * Not in requested group; skipping."
60
- # next
61
- # end
62
-
63
- Bundler.rubygems.with_build_args [Bundler.settings["build.#{spec.name}"]] do
64
- spec.source.install(spec)
65
- Bundler.ui.debug "from #{spec.loaded_from} "
66
- end
67
-
68
- Bundler.ui.info ""
69
- generate_bundler_executable_stubs(spec) if Bundler.settings[:bin]
70
- FileUtils.rm_rf(Bundler.tmp)
56
+ install_gem_from_spec(spec)
71
57
  end
72
58
 
73
59
  lock
@@ -76,6 +62,35 @@ module Bundler
76
62
 
77
63
  private
78
64
 
65
+ def install_gem_from_spec(spec)
66
+ # Download the gem to get the spec, because some specs that are returned
67
+ # by rubygems.org are broken and wrong.
68
+ Bundler::Fetcher.fetch(spec) if spec.source.is_a?(Bundler::Source::Rubygems)
69
+
70
+ # Fetch the build settings, if there are any
71
+ settings = Bundler.settings["build.#{spec.name}"]
72
+ Bundler.rubygems.with_build_args [settings] do
73
+ spec.source.install(spec)
74
+ Bundler.ui.debug "from #{spec.loaded_from} "
75
+ end
76
+
77
+ # newline comes after installing, some gems say "with native extensions"
78
+ Bundler.ui.info ""
79
+ generate_bundler_executable_stubs(spec) if Bundler.settings[:bin]
80
+ FileUtils.rm_rf(Bundler.tmp)
81
+ rescue Exception => e
82
+ # install hook failed
83
+ raise e if e.is_a?(Gem::InstallError)
84
+
85
+ # other failure, likely a native extension build failure
86
+ Bundler.ui.info ""
87
+ Bundler.ui.warn "#{e.class}: #{e.message}"
88
+ msg = "An error occured while installing #{spec.name} (#{spec.version}),"
89
+ msg << " and Bundler cannot continue.\nMake sure that `gem install"
90
+ msg << " #{spec.name} -v '#{spec.version}'` succeeds before bundling."
91
+ raise Bundler::InstallError, msg
92
+ end
93
+
79
94
  def generate_bundler_executable_stubs(spec)
80
95
  bin_path = Bundler.bin_path
81
96
  template = File.read(File.expand_path('../templates/Executable', __FILE__))
@@ -91,8 +106,8 @@ module Bundler
91
106
  end
92
107
 
93
108
  def generate_standalone(groups)
94
- path = Bundler.settings[:path]
95
- bundler_path = File.join(path, "bundler")
109
+ standalone_path = Bundler.settings[:path]
110
+ bundler_path = File.join(standalone_path, "bundler")
96
111
  FileUtils.mkdir_p(bundler_path)
97
112
 
98
113
  paths = []
@@ -108,7 +123,7 @@ module Bundler
108
123
 
109
124
  spec.require_paths.each do |path|
110
125
  full_path = File.join(spec.full_gem_path, path)
111
- paths << Pathname.new(full_path).relative_path_from(Bundler.root.join("bundle/bundler"))
126
+ paths << Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path))
112
127
  end
113
128
  end
114
129
 
@@ -334,8 +334,13 @@ module Bundler
334
334
  length = @stack.length
335
335
  @stack << requirement.name
336
336
  retval = catch(requirement.name) do
337
+ # clear the search cache since the catch means we couldn't meet the
338
+ # requirement we need with the current constraints on search
339
+ clear_search_cache
340
+ # try to resolve the next option
337
341
  resolve(reqs, activated)
338
342
  end
343
+
339
344
  # Since we're doing a lot of throw / catches. A push does not necessarily match
340
345
  # up to a pop. So, we simply slice the stack back to what it was before the catch
341
346
  # block.
@@ -347,15 +352,21 @@ module Bundler
347
352
  search(dep).size
348
353
  end
349
354
 
350
- def search(dep)
351
- return @deps_for[dep.to_s] if @deps_for[dep.to_s]
355
+ def clear_search_cache
356
+ @deps_for = {}
357
+ end
352
358
 
359
+ def search(dep)
353
360
  if base = @base[dep.name] and base.any?
354
361
  reqs = [dep.requirement.as_list, base.first.version.to_s].flatten.compact
355
362
  d = Gem::Dependency.new(base.first.name, *reqs)
356
363
  else
357
364
  d = dep.dep
358
365
  end
366
+
367
+ key = "#{d}-#{dep.__platform}"
368
+ return @deps_for[key] if @deps_for[key]
369
+
359
370
  index = @source_requirements[d.name] || @index
360
371
  results = index.search(d, @base[d.name])
361
372
 
@@ -373,7 +384,8 @@ module Bundler
373
384
  else
374
385
  deps = []
375
386
  end
376
- @deps_for[dep.to_s] = deps
387
+
388
+ @deps_for[key] = deps
377
389
  end
378
390
 
379
391
  def clean_req(req)
@@ -417,7 +429,7 @@ module Bundler
417
429
  # If the origin is "bundler", the conflict is us
418
430
  if origin.name == "bundler"
419
431
  o << " Current Bundler version:\n"
420
- newer_bundler_required = requirement.requirement > Gem::Requirement.new(origin.version)
432
+ other_bundler_required = !requirement.requirement.satisfied_by?(origin.version)
421
433
  # If the origin is a LockfileParser, it does not respond_to :required_by
422
434
  elsif !origin.respond_to?(:required_by) || !(origin.required_by.first)
423
435
  o << " In snapshot (Gemfile.lock):\n"
@@ -426,9 +438,9 @@ module Bundler
426
438
  o << gem_message(origin)
427
439
 
428
440
  # If the bundle wants a newer bundler than the running bundler, explain
429
- if origin.name == "bundler" && newer_bundler_required
430
- o << "Your version of Bundler is older than the one requested by the Gemfile.\n"
431
- o << "Perhaps you need to update Bundler by running `gem install bundler`."
441
+ if origin.name == "bundler" && other_bundler_required
442
+ o << "This Gemfile requires a different version of Bundler.\n"
443
+ o << "Perhaps you need to update Bundler by running `gem install bundler`?"
432
444
  end
433
445
 
434
446
  # origin is nil if the required gem and version cannot be found in any of
@@ -40,6 +40,7 @@ module Gem
40
40
  end
41
41
 
42
42
  # RubyGems 1.8+ used only.
43
+ remove_method :gem_dir if method_defined? :gem_dir
43
44
  def gem_dir
44
45
  full_gem_path
45
46
  end
@@ -107,7 +108,7 @@ module Gem
107
108
  def to_lock
108
109
  out = " #{name}"
109
110
  unless requirement == Gem::Requirement.default
110
- reqs = requirement.requirements.map{|o,v| "#{o} #{v}" }
111
+ reqs = requirement.requirements.map{|o,v| "#{o} #{v}" }.sort.reverse
111
112
  out << " (#{reqs.join(', ')})"
112
113
  end
113
114
  out
@@ -135,6 +136,7 @@ module Gem
135
136
  MSWIN = Gem::Platform.new('mswin32')
136
137
  MINGW = Gem::Platform.new('x86-mingw32')
137
138
 
139
+ undef_method :hash if method_defined? :hash
138
140
  def hash
139
141
  @cpu.hash ^ @os.hash ^ @version.hash
140
142
  end
@@ -50,7 +50,12 @@ module Bundler
50
50
  end
51
51
 
52
52
  def gem_bindir
53
- Gem.bindir
53
+ # We use Gem.dir/bin because on OS X, Gem.bindir is hardcoded to return
54
+ # /usr/bin, a directory owned by root. Users who chown Gem.dir need bins
55
+ # to be installed where they have permissions. Furthermore, the official
56
+ # solution to change the bindir is adding -n to .gemrc, but Rubygems does
57
+ # not honor the -n option in either Gem.bindir or Installer.new.bindir.
58
+ File.join Gem.dir, "bin"
54
59
  end
55
60
 
56
61
  def user_home
@@ -180,6 +185,7 @@ module Bundler
180
185
  end
181
186
 
182
187
  def stub_source_index170(specs)
188
+ Gem::SourceIndex.send(:alias_method, :old_initialize, :initialize)
183
189
  Gem::SourceIndex.send(:define_method, :initialize) do |*args|
184
190
  @gems = {}
185
191
  # You're looking at this thinking: Oh! This is how I make those
@@ -205,7 +211,7 @@ module Bundler
205
211
  gem_class = (class << Gem ; self ; end)
206
212
  gem_class.send(:remove_method, :bin_path)
207
213
  gem_class.send(:define_method, :bin_path) do |name, *args|
208
- exec_name, *reqs = args
214
+ exec_name = args.first
209
215
 
210
216
  if exec_name == 'bundle'
211
217
  return ENV['BUNDLE_BIN_PATH']
@@ -254,9 +260,14 @@ module Bundler
254
260
  # by monkeypatching it into the method in Rubygems 1.3.6 and 1.3.7.
255
261
  def backport_segment_generation
256
262
  Gem::Version.send(:define_method, :segments) do
257
- @segments ||= @version.scan(/[0-9]+|[a-z]+/i).map do |s|
258
- /^\d+$/ =~ s ? s.to_i : s
263
+ @segments_generated ||= false
264
+ unless @segments_generated
265
+ @segments ||= @version.scan(/[0-9a-z]+/i).map do |s|
266
+ /^\d+$/ =~ s ? s.to_i : s
267
+ end
259
268
  end
269
+ @segments_generated = true
270
+ @segments
260
271
  end
261
272
  end
262
273
 
@@ -268,11 +279,33 @@ module Bundler
268
279
  end
269
280
  end
270
281
 
282
+ def backport_cache_file
283
+ Gem::Specification.send(:define_method, :cache_dir) do
284
+ @cache_dir ||= File.join base_dir, "cache"
285
+ end
286
+
287
+ Gem::Specification.send(:define_method, :cache_file) do
288
+ @cache_file ||= File.join cache_dir, "#{full_name}.gem"
289
+ end
290
+ end
291
+
292
+ def backport_spec_file
293
+ Gem::Specification.send(:define_method, :spec_dir) do
294
+ @spec_dir ||= File.join base_dir, "specifications"
295
+ end
296
+
297
+ Gem::Specification.send(:define_method, :spec_file) do
298
+ @spec_file ||= File.join spec_dir, "#{full_name}.gemspec"
299
+ end
300
+ end
301
+
271
302
  # Rubygems 1.4 through 1.6
272
303
  class Legacy < RubygemsIntegration
273
304
  def initialize
274
305
  super
275
306
  backport_base_dir
307
+ backport_cache_file
308
+ backport_spec_file
276
309
  end
277
310
 
278
311
  def stub_rubygems(specs)
@@ -69,7 +69,18 @@ module Bundler
69
69
  end
70
70
  rescue LoadError => e
71
71
  REGEXPS.find { |r| r =~ e.message }
72
- raise if dep.autorequire || $1 != required_file
72
+
73
+ if dep.name.include?('-')
74
+ begin
75
+ namespaced_file = dep.name.gsub('-', '/')
76
+ Kernel.require namespaced_file
77
+ rescue LoadError
78
+ REGEXPS.find { |r| r =~ e.message }
79
+ raise if dep.autorequire || $1.gsub('-', '/') != namespaced_file
80
+ end
81
+ else
82
+ raise if dep.autorequire || $1 != required_file
83
+ end
73
84
  end
74
85
  end
75
86
  end
@@ -120,30 +131,45 @@ module Bundler
120
131
  end
121
132
 
122
133
  def clean
123
- return false if Bundler.settings[:path] == nil
124
-
125
134
  gem_bins = Dir["#{Gem.dir}/bin/*"]
126
135
  git_dirs = Dir["#{Gem.dir}/bundler/gems/*"]
136
+ git_cache_dirs = Dir["#{Gem.dir}/cache/bundler/git/*"]
127
137
  gem_dirs = Dir["#{Gem.dir}/gems/*"]
128
- spec_gem_paths = specs.collect {|spec| spec.full_gem_path }
129
- spec_gem_executables = specs.collect do |spec|
130
- spec.executables.collect do |executable|
138
+ gem_files = Dir["#{Gem.dir}/cache/*.gem"]
139
+ gemspec_files = Dir["#{Gem.dir}/specifications/*.gemspec"]
140
+ spec_gem_paths = []
141
+ spec_git_paths = []
142
+ spec_git_cache_dirs = []
143
+ spec_gem_executables = []
144
+ spec_cache_paths = []
145
+ spec_gemspec_paths = []
146
+ specs.each do |spec|
147
+ spec_gem_paths << spec.full_gem_path
148
+ # need to check here in case gems are nested like for the rails git repo
149
+ md = %r{(.+bundler/gems/.+-[a-f0-9]{12})}.match(spec.full_gem_path)
150
+ spec_git_paths << md[1] if md
151
+ spec_gem_executables << spec.executables.collect do |executable|
131
152
  "#{Gem.dir}/#{spec.bindir}/#{executable}"
132
153
  end
133
- end.flatten
134
- stale_gem_bins = gem_bins - spec_gem_executables
135
- stale_git_dirs = git_dirs - spec_gem_paths
136
- stale_gem_dirs = gem_dirs - spec_gem_paths
154
+ spec_cache_paths << spec.cache_file
155
+ spec_gemspec_paths << spec.spec_file
156
+ spec_git_cache_dirs << spec.source.cache_path.to_s if spec.source.is_a?(Bundler::Source::Git)
157
+ end
158
+ spec_gem_paths.uniq!
159
+ spec_gem_executables.flatten!
160
+
161
+ stale_gem_bins = gem_bins - spec_gem_executables
162
+ stale_git_dirs = git_dirs - spec_git_paths
163
+ stale_git_cache_dirs = git_cache_dirs - spec_git_cache_dirs
164
+ stale_gem_dirs = gem_dirs - spec_gem_paths
165
+ stale_gem_files = gem_files - spec_cache_paths
166
+ stale_gemspec_files = gemspec_files - spec_gemspec_paths
137
167
 
138
168
  stale_gem_bins.each {|bin| FileUtils.rm(bin) }
139
- stale_gem_dirs.collect do |gem_dir|
169
+ output = stale_gem_dirs.collect do |gem_dir|
140
170
  full_name = Pathname.new(gem_dir).basename.to_s
141
171
 
142
172
  FileUtils.rm_rf(gem_dir)
143
- specification_file = "#{Gem.dir}/specifications/#{full_name}.gemspec"
144
- FileUtils.rm(specification_file) if File.exists?(specification_file)
145
- gem_file = "#{Gem.dir}/cache/#{full_name}.gem"
146
- FileUtils.rm(gem_file) if File.exists?(gem_file)
147
173
 
148
174
  parts = full_name.split('-')
149
175
  name = parts[0..-2].join('-')
@@ -168,6 +194,12 @@ module Bundler
168
194
 
169
195
  output
170
196
  end
197
+
198
+ stale_gem_files.each {|file| FileUtils.rm(file) if File.exists?(file) }
199
+ stale_gemspec_files.each {|file| FileUtils.rm(file) if File.exists?(file) }
200
+ stale_git_cache_dirs.each {|dir| FileUtils.rm_rf(dir) if File.exists?(dir) }
201
+
202
+ output
171
203
  end
172
204
 
173
205
  private