bundler 1.3.5 → 1.3.6

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 (61) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +7 -3
  3. data/CHANGELOG.md +21 -0
  4. data/ISSUES.md +2 -2
  5. data/LICENSE.md +1 -1
  6. data/Rakefile +4 -3
  7. data/bin/bundle +6 -1
  8. data/bundler.gemspec +1 -1
  9. data/lib/bundler.rb +2 -4
  10. data/lib/bundler/cli.rb +13 -17
  11. data/lib/bundler/definition.rb +1 -1
  12. data/lib/bundler/deployment.rb +1 -1
  13. data/lib/bundler/dsl.rb +6 -5
  14. data/lib/bundler/fetcher.rb +6 -1
  15. data/lib/bundler/friendly_errors.rb +6 -0
  16. data/lib/bundler/gem_helper.rb +1 -2
  17. data/lib/bundler/installer.rb +1 -1
  18. data/lib/bundler/rubygems_ext.rb +1 -1
  19. data/lib/bundler/rubygems_integration.rb +23 -11
  20. data/lib/bundler/source/git.rb +3 -2
  21. data/lib/bundler/source/rubygems.rb +11 -1
  22. data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  23. data/lib/bundler/ui.rb +4 -0
  24. data/lib/bundler/version.rb +1 -1
  25. data/man/bundle-exec.ronn +24 -6
  26. data/man/bundle-install.ronn +1 -1
  27. data/man/bundle.ronn +1 -1
  28. data/man/gemfile.5.ronn +1 -2
  29. data/spec/bundler/cli_rspec.rb +7 -2
  30. data/spec/bundler/dsl_spec.rb +4 -4
  31. data/spec/bundler/gem_helper_spec.rb +5 -6
  32. data/spec/install/gems/dependency_api_spec.rb +34 -0
  33. data/spec/install/gems/post_install_spec.rb +3 -3
  34. data/spec/install/gems/simple_case_spec.rb +16 -0
  35. data/spec/install/gems/win32_spec.rb +1 -1
  36. data/spec/install/git_spec.rb +1 -1
  37. data/spec/install/security_policy_spec.rb +10 -11
  38. data/spec/integration/inject.rb +1 -1
  39. data/spec/lock/git_spec.rb +0 -1
  40. data/spec/lock/lockfile_spec.rb +29 -5
  41. data/spec/other/binstubs_spec.rb +16 -3
  42. data/spec/other/bundle_ruby_spec.rb +1 -1
  43. data/spec/other/check_spec.rb +1 -1
  44. data/spec/other/clean_spec.rb +2 -2
  45. data/spec/other/exec_spec.rb +0 -1
  46. data/spec/other/init_spec.rb +0 -1
  47. data/spec/other/outdated_spec.rb +0 -2
  48. data/spec/other/platform_spec.rb +2 -2
  49. data/spec/quality_spec.rb +27 -2
  50. data/spec/realworld/dependency_api_spec.rb +0 -1
  51. data/spec/resolver/basic_spec.rb +1 -1
  52. data/spec/runtime/setup_spec.rb +4 -3
  53. data/spec/runtime/with_clean_env_spec.rb +0 -1
  54. data/spec/spec_helper.rb +1 -0
  55. data/spec/support/artifice/endpoint_host_redirect.rb +15 -0
  56. data/spec/support/builders.rb +4 -2
  57. data/spec/support/permissions.rb +11 -0
  58. data/spec/update/gems_spec.rb +3 -3
  59. data/spec/update/git_spec.rb +2 -2
  60. data/spec/update/source_spec.rb +0 -1
  61. metadata +11 -13
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7304a63f3f93180bfc448131ffa016885410d872
4
+ data.tar.gz: 24ef788f45ff1f976584b293fc207b413d82548e
5
+ SHA512:
6
+ metadata.gz: c823ec338057eeda5c740b53a0981c7db020cbde644ec656c8aa55a75be5ff65a9a1c352450a3ecb4c3ea930e830021426f593860fa1c9c057d8e5f6b2f32836
7
+ data.tar.gz: 059bacb8d560f78ec5fa123dc806c5d458e96260b64993912b888f666bc8b4d2e03afba9cea68640146a3b6206eea571bfa664976845f8e9f4063211ee73385a
@@ -10,8 +10,10 @@ branches:
10
10
  - 1-0-stable
11
11
  notifications:
12
12
  email:
13
- - mail@arko.net
14
- - hone02@gmail.com
13
+ # andre
14
+ - secure: "bCcvqJT7YrBawtkXXwHhT+jOFth7r2Qv/30PkkbhQxk6Jb3xambjCOJ3U6vJ\ngYmiL50exi5lUp3oc3SEbHN5t2CrZqOZDQ6o7P8EAmB5c0oH2RrYaFOkI5Gt\nul/jGH/96A9sj0aMwG7JfdMSfhqj1DUKAm2PnnbXPL853VfmT24="
15
+ # terence
16
+ - secure: "MQ8eA5Jb8YzEpAo58DRGfVJklAPcEbAulpBZnTxp0am6ldneDtJHbQk21w6R\nj5GsDHlzr/lMp/GHIimtUZ7rLohfND8fj/W7fs1Dkd4eN02/ERt98x3pHlqv\nvZgSnZ39uVYv+OcphraE24QaRaGWLhWZAMYQTVe/Yz50NyG8g1U="
15
17
  irc:
16
18
  on_success: change
17
19
  on_failure: always
@@ -31,12 +33,14 @@ env:
31
33
  # we need to know if changes to rubygems will break bundler on release
32
34
  - RGV=master
33
35
  # test the latest rubygems release with all of our supported rubies
34
- - RGV=v2.0.2
36
+ - RGV=v2.0.6
37
+ - RGV=2.0
35
38
  matrix:
36
39
  allow_failures:
37
40
  # we want to know how we're doing with head, but not fail the build
38
41
  - rvm: ruby-head
39
42
  - env: RGV=master
43
+ - env: RGV=2.0
40
44
  # 1.9.2 is simply too slow. it sometimes exceeds the 25m hard limit.
41
45
  - rvm: 1.9.2
42
46
  include:
@@ -1,3 +1,23 @@
1
+ ## 1.3.6
2
+
3
+ Bugfixes:
4
+
5
+ - make gemspec path option preserve relative paths in lock file (@bwillis)
6
+ - use umask when creating binstubs (#1618, @v-yarotsky)
7
+ - warn if graphviz is not installed (#2435, @Agis-)
8
+ - show git errors while loading gemspecs
9
+ - don't mutate gem method options hash (#2447)
10
+ - print Thor errors (#2478, @pjvds)
11
+ - print Rubygems system exit errors (James Cook)
12
+ - more Pathnames into Strings for MacRuby (@kml)
13
+ - preserve original gemspec path (@bwillis)
14
+ - remove warning about deps with :git (#1651, @ixti)
15
+ - split git files on null (#2634, @jasonmp85)
16
+ - handle cross-host redirects without SSL (#2686, @grddev)
17
+ - handle Rubygems 2 security exception (@zzak)
18
+ - reinstall gems if they are missing with spec present
19
+ - set binstub permissions using umask (#1618, @v-yarotsky)
20
+
1
21
  ## 1.3.5 (3 April 2013)
2
22
 
3
23
  Features:
@@ -111,6 +131,7 @@ Features:
111
131
  - `binstubs` lists child gem bins if a gem has no binstubs
112
132
  - `bundle gem --edit` will open the new gemspec (@ndbroadbent)
113
133
  - `bundle gem --test rspec` now makes working tests (@tricknotes)
134
+ - `bundle env` prints info about bundler's environment (@peeja)
114
135
  - add `BUNDLE_IGNORE_CONFIG` environment variable support (@richo)
115
136
 
116
137
  Bugfixes:
data/ISSUES.md CHANGED
@@ -6,7 +6,7 @@ So! You're having problems with Bundler. This file is here to help. If you're ru
6
6
 
7
7
  Instructions for common Bundler uses can be found on the [Bundler documentation site](http://gembundler.com/).
8
8
 
9
- Detailed information about each Bundler command, including help with common problems, can be found in the [Bundler man pages](http://gembundler.com/man/bundle.1.html).
9
+ Detailed information about each Bundler command, including help with common problems, can be found in the [Bundler man pages](http://gembundler.com/v1.3/man/bundle.1.html).
10
10
 
11
11
  ## Troubleshooting
12
12
 
@@ -76,7 +76,7 @@ If you are using Rails 2.3, please also include:
76
76
  - Your environment.rb file
77
77
 
78
78
 
79
- If you have either `rubygems-bundler` or `open_gem` installed, please try removing them and then following the troublshooting steps above before opening a new ticket.
79
+ If you have either `rubygems-bundler` or `open_gem` installed, please try removing them and then following the troubleshooting steps above before opening a new ticket.
80
80
 
81
81
  [Create a gist](https://gist.github.com) containing all of that information, then visit the [Bundler issue tracker](https://github.com/carlhuda/bundler/issues) and [create a ticket](https://github.com/carlhuda/bundler/issues/new) describing your problem and linking to your gist.
82
82
 
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Portions copyright (c) 2010 Andre Arko
1
+ Portions copyright (c) 2010 Andre Arko
2
2
  Portions copyright (c) 2009 Engine Yard
3
3
 
4
4
  MIT License
data/Rakefile CHANGED
@@ -30,7 +30,7 @@ namespace :spec do
30
30
  desc "Ensure spec dependencies are installed"
31
31
  task :deps do
32
32
  {"rdiscount" => "~> 1.6", "ronn" => "~> 0.7.3", "rspec" => "~> 2.13"}.each do |name, version|
33
- sh "#{Gem.ruby} -S gem list #{name} -v '#{version}' | grep '#{name}' -q || " \
33
+ sh "#{Gem.ruby} -S gem list -i #{name} -v '#{version}' || " \
34
34
  "#{Gem.ruby} -S gem install #{name} -v '#{version}' --no-ri --no-rdoc"
35
35
  end
36
36
  end
@@ -85,10 +85,11 @@ begin
85
85
  system "sudo rm -rf #{File.expand_path('../tmp/sudo_gem_home', __FILE__)}"
86
86
  end
87
87
 
88
+ # Rubygems specs by version
88
89
  namespace :rubygems do
89
- # Rubygems specs by version
90
90
  rubyopt = ENV["RUBYOPT"]
91
- %w(master v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.25 v2.0.2).each do |rg|
91
+ # When editing this list, also edit .travis.yml!
92
+ %w(master 2.0 v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.25 v2.0.6).each do |rg|
92
93
  desc "Run specs with Rubygems #{rg}"
93
94
  RSpec::Core::RakeTask.new(rg) do |t|
94
95
  t.rspec_opts = %w(-fs --color)
data/bin/bundle CHANGED
@@ -17,4 +17,9 @@ end
17
17
 
18
18
  require 'bundler/cli'
19
19
  require 'bundler/friendly_errors'
20
- Bundler.with_friendly_errors { Bundler::CLI.start }
20
+ Bundler.with_friendly_errors {
21
+ # Set debug flag so we can rescue Thor::error's
22
+ # and set the correct exit code.
23
+ ENV["THOR_DEBUG"] = "1"
24
+ Bundler::CLI.start
25
+ }
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.add_development_dependency 'ronn', '~> 0.7.3'
20
20
  spec.add_development_dependency 'rspec', '~> 2.11'
21
21
 
22
- spec.files = `git ls-files`.split($/)
22
+ spec.files = `git ls-files -z`.split("\x0")
23
23
  spec.files += Dir.glob('lib/bundler/man/**/*') # man/ is ignored by git
24
24
  spec.test_files = spec.files.grep(%r{^spec/})
25
25
 
@@ -80,8 +80,7 @@ module Bundler
80
80
  status_code(6)
81
81
  end
82
82
 
83
- class InvalidSpecSet < StandardError; end
84
- class MarshalError < StandardError; end
83
+ class MarshalError < StandardError; end
85
84
 
86
85
  class << self
87
86
  attr_writer :ui, :bundle_path
@@ -262,7 +261,7 @@ module Bundler
262
261
  bin_dir = bin_dir.parent until bin_dir.exist?
263
262
 
264
263
  # if any directory is not writable, we need sudo
265
- dirs = [path, bin_dir] | Dir[path.join('*')]
264
+ dirs = [path, bin_dir] | Dir[path.join('*').to_s]
266
265
  sudo_needed = dirs.find{|d| !File.writable?(d) }
267
266
  end
268
267
 
@@ -367,7 +366,6 @@ module Bundler
367
366
  configure_gem_home
368
367
  end
369
368
 
370
- Bundler.rubygems.refresh
371
369
  bundle_path
372
370
  end
373
371
 
@@ -492,7 +492,7 @@ module Bundler
492
492
  long_desc <<-D
493
493
  Exec runs a command, providing it access to the gems in the bundle. While using
494
494
  bundle exec you can require and call the bundled gems as if they were installed
495
- into the systemwide Rubygems repository.
495
+ into the system wide Rubygems repository.
496
496
  D
497
497
  def exec(*args)
498
498
  Bundler.definition.validate_ruby!
@@ -651,23 +651,19 @@ module Bundler
651
651
  method_option :format, :type => :string, :default => "png", :aliases => '-F', :banner => "This is output format option. Supported format is png, jpg, svg, dot ..."
652
652
  def viz
653
653
  require 'graphviz'
654
-
655
654
  output_file = File.expand_path(options[:file])
656
655
  graph = Graph.new(Bundler.load, output_file, options[:version], options[:requirements], options[:format])
657
-
658
- begin
659
- graph.viz
660
- rescue LoadError => e
661
- Bundler.ui.error e.inspect
662
- Bundler.ui.warn "Make sure you have the graphviz ruby gem. You can install it with:"
663
- Bundler.ui.warn "`gem install ruby-graphviz`"
664
- rescue StandardError => e
665
- if e.message =~ /GraphViz not installed or dot not in PATH/
666
- Bundler.ui.error e.message
667
- Bundler.ui.warn "The ruby graphviz gem requires GraphViz to be installed"
668
- else
669
- raise
670
- end
656
+ graph.viz
657
+ rescue LoadError => e
658
+ Bundler.ui.error e.inspect
659
+ Bundler.ui.warn "Make sure you have the graphviz ruby gem. You can install it with:"
660
+ Bundler.ui.warn "`gem install ruby-graphviz`"
661
+ rescue StandardError => e
662
+ if e.message =~ /GraphViz not installed or dot not in PATH/
663
+ Bundler.ui.error e.message
664
+ Bundler.ui.warn "Please install GraphViz. On a Mac with homebrew, you can run `brew install graphviz`."
665
+ else
666
+ raise
671
667
  end
672
668
  end
673
669
 
@@ -721,7 +717,7 @@ module Bundler
721
717
  if options[:test]
722
718
  template(File.join("newgem/.travis.yml.tt"), File.join(target, ".travis.yml"), opts)
723
719
  end
724
- Bundler.ui.info "Initializating git repo in #{target}"
720
+ Bundler.ui.info "Initializing git repo in #{target}"
725
721
  Dir.chdir(target) { `git init`; `git add .` }
726
722
 
727
723
  if options[:edit]
@@ -249,7 +249,7 @@ module Bundler
249
249
  select { |s| s.source == source }.
250
250
  # This needs to be sorted by full name so that
251
251
  # gems with the same name, but different platform
252
- # are ordered consistantly
252
+ # are ordered consistently
253
253
  sort_by { |s| s.full_name }.
254
254
  each do |spec|
255
255
  next if spec.name == 'bundler'
@@ -20,7 +20,7 @@ module Bundler
20
20
  installed to the shared/bundle path. Gems in the development and \
21
21
  test group will not be installed. The install command is executed \
22
22
  with the --deployment and --quiet flags. If the bundle cmd cannot \
23
- be found then you can override the bundle_cmd variable to specifiy \
23
+ be found then you can override the bundle_cmd variable to specify \
24
24
  which one it should use. The base path to the app is fetched from \
25
25
  the :latest_release variable. Set it for custom deploy layouts.
26
26
 
@@ -42,8 +42,9 @@ module Bundler
42
42
  path = opts && opts[:path] || '.'
43
43
  name = opts && opts[:name] || '{,*}'
44
44
  development_group = opts && opts[:development_group] || :development
45
- path = File.expand_path(path, Bundler.default_gemfile.dirname)
46
- gemspecs = Dir[File.join(path, "#{name}.gemspec")]
45
+ expanded_path = File.expand_path(path, Bundler.default_gemfile.dirname)
46
+
47
+ gemspecs = Dir[File.join(expanded_path, "#{name}.gemspec")]
47
48
 
48
49
  case gemspecs.size
49
50
  when 1
@@ -56,9 +57,9 @@ module Bundler
56
57
  end
57
58
  end
58
59
  when 0
59
- raise InvalidOption, "There are no gemspecs at #{path}."
60
+ raise InvalidOption, "There are no gemspecs at #{expanded_path}."
60
61
  else
61
- raise InvalidOption, "There are multiple gemspecs at #{path}. Please use the :name option to specify which one."
62
+ raise InvalidOption, "There are multiple gemspecs at #{expanded_path}. Please use the :name option to specify which one."
62
63
  end
63
64
  end
64
65
 
@@ -67,7 +68,7 @@ module Bundler
67
68
  raise GemfileError, %{You need to specify gem names as Strings. Use 'gem "#{name.to_s}"' instead.}
68
69
  end
69
70
 
70
- options = Hash === args.last ? args.pop : {}
71
+ options = Hash === args.last ? args.pop.dup : {}
71
72
  version = args
72
73
 
73
74
  _normalize_options(name, version, options)
@@ -203,7 +203,12 @@ module Bundler
203
203
  else
204
204
  req = Net::HTTP::Get.new uri.request_uri
205
205
  req.basic_auth(uri.user, uri.password) if uri.user && uri.password
206
- response = @connection.request(req)
206
+ if uri.host == @connection.address && uri.port == @connection.port
207
+ connection = @connection
208
+ else
209
+ connection = Net::HTTP.new(uri.host, uri.port)
210
+ end
211
+ response = connection.request(req)
207
212
  end
208
213
  rescue OpenSSL::SSL::SSLError
209
214
  raise CertificateFailureError.new(@public_uri)
@@ -5,6 +5,12 @@ module Bundler
5
5
  Bundler.ui.error e.message, :wrap => true
6
6
  Bundler.ui.trace e
7
7
  exit e.status_code
8
+ rescue Thor::UndefinedTaskError => e
9
+ Bundler.ui.error e.message
10
+ exit 15
11
+ rescue Thor::Error => e
12
+ Bundler.ui.error e.message
13
+ exit 1
8
14
  rescue LoadError => e
9
15
  raise e unless e.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/
10
16
  Bundler.ui.error "\nCould not load OpenSSL."
@@ -1,5 +1,4 @@
1
- $:.unshift File.expand_path('../vendor', __FILE__)
2
- require 'thor'
1
+ require 'bundler/vendored_thor' unless defined?(Thor)
3
2
  require 'bundler'
4
3
 
5
4
  module Bundler
@@ -163,7 +163,7 @@ module Bundler
163
163
  next
164
164
  end
165
165
 
166
- File.open(binstub_path, 'w', 0755) do |f|
166
+ File.open(binstub_path, 'w', 0777 & ~File.umask) do |f|
167
167
  f.puts ERB.new(template, nil, '-').result(binding)
168
168
  end
169
169
  end
@@ -51,7 +51,7 @@ module Gem
51
51
  end
52
52
 
53
53
  def git_version
54
- if @loaded_from && File.exist?(File.join(full_gem_path, ".git"))
54
+ if loaded_from && File.exist?(File.join(full_gem_path, ".git"))
55
55
  sha = Dir.chdir(full_gem_path){ `git rev-parse HEAD`.strip }
56
56
  " #{sha[0..6]}"
57
57
  end
@@ -32,6 +32,10 @@ module Bundler
32
32
 
33
33
  def configuration
34
34
  Gem.configuration
35
+ rescue Gem::SystemExitException => e
36
+ Bundler.ui.error "#{e.class}: #{e.message}"
37
+ Bundler.ui.trace e
38
+ raise Gem::SystemExitException
35
39
  end
36
40
 
37
41
  def ruby_engine
@@ -87,10 +91,6 @@ module Bundler
87
91
  Gem.bin_path(gem, bin, ver)
88
92
  end
89
93
 
90
- def refresh
91
- Gem.refresh
92
- end
93
-
94
94
  def preserve_paths
95
95
  # this is a no-op outside of Rubygems 1.8
96
96
  yield
@@ -153,7 +153,7 @@ module Bundler
153
153
  end
154
154
  end
155
155
 
156
- def build(spec)
156
+ def build(spec, skip_validation = false)
157
157
  require 'rubygems/builder'
158
158
  Gem::Builder.new(spec).build
159
159
  end
@@ -170,7 +170,7 @@ module Bundler
170
170
  @security_policies ||= begin
171
171
  require 'rubygems/security'
172
172
  Gem::Security::Policies
173
- rescue LoadError
173
+ rescue LoadError, NameError
174
174
  {}
175
175
  end
176
176
  end
@@ -398,7 +398,7 @@ module Bundler
398
398
  end
399
399
  end
400
400
 
401
- # Rubygems ~> 1.8.5
401
+ # Rubygems 1.8.5-1.8.19
402
402
  class Modern < RubygemsIntegration
403
403
  def stub_rubygems(specs)
404
404
  Gem::Specification.all = specs
@@ -431,14 +431,24 @@ module Bundler
431
431
  end
432
432
  end
433
433
 
434
+ # Rubygems 1.8.20+
435
+ class MoreModern < Modern
436
+ # Rubygems 1.8.20 and adds the skip_validation parameter, so that's
437
+ # when we start passing it through.
438
+ def build(spec, skip_validation = false)
439
+ require 'rubygems/builder'
440
+ Gem::Builder.new(spec).build(skip_validation)
441
+ end
442
+ end
443
+
434
444
  # Rubygems 2.0
435
445
  class Future < RubygemsIntegration
436
446
  def stub_rubygems(specs)
437
447
  Gem::Specification.all = specs
438
448
 
439
- Gem.post_reset {
449
+ Gem.post_reset do
440
450
  Gem::Specification.all = specs
441
- }
451
+ end
442
452
  end
443
453
 
444
454
  def all_specs
@@ -481,9 +491,9 @@ module Bundler
481
491
  return p
482
492
  end
483
493
 
484
- def build(spec)
494
+ def build(spec, skip_validation = false)
485
495
  require 'rubygems/package'
486
- Gem::Package.build(spec)
496
+ Gem::Package.build(spec, skip_validation)
487
497
  end
488
498
 
489
499
  end
@@ -492,6 +502,8 @@ module Bundler
492
502
 
493
503
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.99.99')
494
504
  @rubygems = RubygemsIntegration::Future.new
505
+ elsif Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.20')
506
+ @rubygems = RubygemsIntegration::MoreModern.new
495
507
  elsif Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.5')
496
508
  @rubygems = RubygemsIntegration::Modern.new
497
509
  elsif Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
@@ -173,8 +173,9 @@ module Bundler
173
173
 
174
174
  def load_spec_files
175
175
  super
176
- rescue PathError, GitError
177
- raise GitError, "#{to_s} is not checked out. Please run `bundle install`"
176
+ rescue PathError => e
177
+ Bundler.ui.trace e
178
+ raise GitError, "#{to_s} is not yet checked out. Run `bundle install` first."
178
179
  end
179
180
 
180
181
  # This is the path which is going to contain a cache
@@ -68,7 +68,7 @@ module Bundler
68
68
  end
69
69
 
70
70
  def install(spec)
71
- if installed_specs[spec].any?
71
+ if installed_specs[spec].any? && gem_dir_exists?(spec)
72
72
  Bundler.ui.info "Using #{spec.name} (#{spec.version}) "
73
73
  return
74
74
  end
@@ -250,6 +250,16 @@ module Bundler
250
250
  Bundler.rubygems.sources = old
251
251
  end
252
252
  end
253
+
254
+ def gem_dir_exists?(spec)
255
+ return true if spec.name == "bundler"
256
+ # Ruby 2 default gems
257
+ return true if spec.loaded_from.include?("specifications/default/")
258
+ # Ruby 1.9 default gems
259
+ return true if spec.summary =~ /is bundled with Ruby/
260
+
261
+ File.directory?(spec.full_gem_path)
262
+ end
253
263
  end
254
264
 
255
265
  end