bundler 1.13.0.rc.1 → 1.13.0.rc.2

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 (90) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +1 -0
  3. data/.rubocop.yml +8 -0
  4. data/.rubocop_todo.yml +21 -21
  5. data/.travis.yml +5 -1
  6. data/CHANGELOG.md +33 -1
  7. data/DEVELOPMENT.md +1 -1
  8. data/Rakefile +21 -12
  9. data/bin/rake +1 -1
  10. data/bin/rspec +1 -1
  11. data/bin/rubocop +2 -2
  12. data/bundler.gemspec +2 -2
  13. data/exe/bundler +1 -19
  14. data/lib/bundler.rb +43 -34
  15. data/lib/bundler/cli.rb +54 -5
  16. data/lib/bundler/cli/binstubs.rb +3 -2
  17. data/lib/bundler/cli/console.rb +3 -0
  18. data/lib/bundler/cli/doctor.rb +95 -0
  19. data/lib/bundler/cli/exec.rb +18 -2
  20. data/lib/bundler/cli/gem.rb +1 -1
  21. data/lib/bundler/cli/inject.rb +25 -7
  22. data/lib/bundler/cli/install.rb +23 -2
  23. data/lib/bundler/cli/lock.rb +14 -2
  24. data/lib/bundler/cli/update.rb +9 -0
  25. data/lib/bundler/definition.rb +86 -17
  26. data/lib/bundler/deployment.rb +6 -0
  27. data/lib/bundler/dsl.rb +67 -22
  28. data/lib/bundler/env.rb +1 -1
  29. data/lib/bundler/environment_preserver.rb +1 -1
  30. data/lib/bundler/errors.rb +11 -1
  31. data/lib/bundler/fetcher.rb +3 -2
  32. data/lib/bundler/fetcher/base.rb +10 -0
  33. data/lib/bundler/fetcher/compact_index.rb +27 -9
  34. data/lib/bundler/fetcher/dependency.rb +1 -12
  35. data/lib/bundler/fetcher/downloader.rb +1 -1
  36. data/lib/bundler/friendly_errors.rb +4 -2
  37. data/lib/bundler/gem_helper.rb +2 -2
  38. data/lib/bundler/gem_version_promoter.rb +175 -0
  39. data/lib/bundler/graph.rb +4 -25
  40. data/lib/bundler/index.rb +9 -1
  41. data/lib/bundler/injector.rb +12 -5
  42. data/lib/bundler/inline.rb +2 -2
  43. data/lib/bundler/installer.rb +23 -8
  44. data/lib/bundler/installer/gem_installer.rb +13 -15
  45. data/lib/bundler/installer/parallel_installer.rb +121 -99
  46. data/lib/bundler/lazy_specification.rb +8 -2
  47. data/lib/bundler/lockfile_parser.rb +20 -12
  48. data/lib/bundler/mirror.rb +2 -2
  49. data/lib/bundler/plugin.rb +153 -31
  50. data/lib/bundler/plugin/api.rb +29 -5
  51. data/lib/bundler/plugin/api/source.rb +293 -0
  52. data/lib/bundler/plugin/dsl.rb +25 -1
  53. data/lib/bundler/plugin/index.rb +80 -13
  54. data/lib/bundler/plugin/installer.rb +6 -10
  55. data/lib/bundler/plugin/source_list.rb +4 -0
  56. data/lib/bundler/postit_trampoline.rb +57 -40
  57. data/lib/bundler/resolver.rb +24 -12
  58. data/lib/bundler/retry.rb +2 -1
  59. data/lib/bundler/ruby_version.rb +4 -2
  60. data/lib/bundler/rubygems_ext.rb +10 -3
  61. data/lib/bundler/rubygems_gem_installer.rb +6 -0
  62. data/lib/bundler/rubygems_integration.rb +101 -66
  63. data/lib/bundler/runtime.rb +25 -2
  64. data/lib/bundler/settings.rb +30 -11
  65. data/lib/bundler/setup.rb +6 -3
  66. data/lib/bundler/shared_helpers.rb +11 -5
  67. data/lib/bundler/source/gemspec.rb +4 -0
  68. data/lib/bundler/source/git.rb +9 -6
  69. data/lib/bundler/source/git/git_proxy.rb +27 -3
  70. data/lib/bundler/source/path.rb +4 -26
  71. data/lib/bundler/source/path/installer.rb +39 -11
  72. data/lib/bundler/source/rubygems.rb +1 -1
  73. data/lib/bundler/source_list.rb +28 -8
  74. data/lib/bundler/spec_set.rb +1 -1
  75. data/lib/bundler/templates/Executable.standalone +4 -2
  76. data/lib/bundler/templates/Gemfile +0 -1
  77. data/lib/bundler/ui/shell.rb +11 -3
  78. data/lib/bundler/ui/silent.rb +1 -3
  79. data/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +1 -2
  80. data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +16 -2
  81. data/lib/bundler/version.rb +1 -1
  82. data/lib/bundler/yaml_serializer.rb +34 -11
  83. data/man/bundle-binstubs.ronn +29 -0
  84. data/man/bundle-config.ronn +32 -0
  85. data/man/bundle-install.ronn +6 -41
  86. data/man/bundle-package.ronn +1 -1
  87. data/man/bundle.ronn +4 -3
  88. data/man/gemfile.5.ronn +1 -1
  89. metadata +13 -9
  90. data/lib/bundler/environment.rb +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 31a0bcb37c5ab89c38532e3b0d371229203b9646
4
- data.tar.gz: 0c078555eef96e3d7da95300bc8be26b887269ea
3
+ metadata.gz: 8100692819ec19e863f7b871ff64e82e6ce2f777
4
+ data.tar.gz: a68df7b5f5f83ee46d8ecbc0265aabce0a5c5c50
5
5
  SHA512:
6
- metadata.gz: 41715dd0d7cc5255ea6ddb7845386bb99505da31255404d15939b0fc438f2bfd81f57b9b517f1044ba7377a13c01e73caa9c496b5ff91b9919829787d8fcf51a
7
- data.tar.gz: dff803691aaf4503f58c8f2cca06d98cc265bdaf45292f87daeefbcf20c12f810e39fd89d17dccff6ae8c4e997eab7a7253277d68a3e464b7c32129d027d45b3
6
+ metadata.gz: 1124367f64c730a512fd72eb66397449980e80e3de4c5f941e60fc864ea93f8f30f56491a7ce4aee3e27859f71f3130365194b7bfa92cfdee54a860d324c7133
7
+ data.tar.gz: eea3ccded3ab663e1c50a1720888e33290e8a8d2226275176f6f1a2143d5e1cdadcd89587174c0248bfd3b9105663debe2e68d51bf071147990d5880dedea468
@@ -22,3 +22,4 @@ exclude_paths:
22
22
  - lib/bundler/templates/**/*.tt
23
23
  - man/*
24
24
  - spec/**/*
25
+ - Rakefile
@@ -118,3 +118,11 @@ Metrics/AbcSize:
118
118
 
119
119
  Metrics/CyclomaticComplexity:
120
120
  Enabled: false
121
+
122
+ Metrics/ParameterLists:
123
+ Enabled: false
124
+
125
+ # It will be obvious which code is complex, Rubocop should only lint simple
126
+ # rules for us.
127
+ Metrics/PerceivedComplexity:
128
+ Enabled: false
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-03-29 17:34:30 -0500 using RuboCop version 0.39.0.
3
+ # on 2016-07-27 12:41:39 -0500 using RuboCop version 0.41.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -45,28 +45,23 @@ Lint/UselessAccessModifier:
45
45
  Exclude:
46
46
  - 'lib/bundler/fetcher.rb'
47
47
 
48
- # Offense count: 7
48
+ # Offense count: 6
49
49
  Lint/UselessAssignment:
50
50
  Exclude:
51
- - 'lib/bundler/graph.rb'
52
51
  - 'lib/bundler/index.rb'
53
52
  - 'lib/bundler/installer.rb'
54
53
 
55
- # Offense count: 1331
54
+ # Offense count: 1686
56
55
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
57
56
  # URISchemes: http, https
58
57
  Metrics/LineLength:
59
58
  Max: 207
60
59
 
61
- # Offense count: 2
60
+ # Offense count: 3
62
61
  # Configuration parameters: CountKeywordArgs.
63
62
  Metrics/ParameterLists:
64
63
  Max: 6
65
64
 
66
- # Offense count: 55
67
- Metrics/PerceivedComplexity:
68
- Max: 51
69
-
70
65
  # Offense count: 6
71
66
  # Cop supports --auto-correct.
72
67
  Performance/RedundantBlockCall:
@@ -104,13 +99,13 @@ Style/CaseEquality:
104
99
  - 'lib/bundler/match_platform.rb'
105
100
  - 'lib/bundler/rubygems_ext.rb'
106
101
 
107
- # Offense count: 22
102
+ # Offense count: 23
108
103
  # Configuration parameters: EnforcedStyle, SupportedStyles.
109
104
  # SupportedStyles: nested, compact
110
105
  Style/ClassAndModuleChildren:
111
106
  Enabled: false
112
107
 
113
- # Offense count: 11
108
+ # Offense count: 10
114
109
  # Cop supports --auto-correct.
115
110
  # Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly.
116
111
  # SupportedStyles: assign_to_condition, assign_inside_condition
@@ -127,7 +122,7 @@ Style/ConditionalAssignment:
127
122
  - 'lib/bundler/source/git.rb'
128
123
  - 'lib/bundler/source/rubygems.rb'
129
124
 
130
- # Offense count: 119
125
+ # Offense count: 138
131
126
  Style/Documentation:
132
127
  Enabled: false
133
128
 
@@ -164,32 +159,38 @@ Style/IndentArray:
164
159
  EnforcedStyle: consistent
165
160
 
166
161
  # Offense count: 2
162
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
163
+ # SupportedStyles: module_function, extend_self
167
164
  Style/ModuleFunction:
168
165
  Exclude:
169
166
  - 'lib/bundler/shared_helpers.rb'
170
167
  - 'spec/support/path.rb'
171
168
 
172
- # Offense count: 1
169
+ # Offense count: 3
173
170
  # Cop supports --auto-correct.
174
171
  # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
175
- # SupportedStyles: aligned, indented
172
+ # SupportedStyles: aligned, indented, indented_relative_to_receiver
176
173
  Style/MultilineMethodCallIndentation:
177
- Enabled: false
174
+ Exclude:
175
+ - 'lib/bundler/cli/common.rb'
176
+ - 'spec/bundler/plugin/source_list_spec.rb'
178
177
 
179
- # Offense count: 4
178
+ # Offense count: 3
179
+ # Cop supports --auto-correct.
180
180
  Style/NestedParenthesizedCalls:
181
181
  Exclude:
182
182
  - 'lib/bundler/resolver.rb'
183
183
  - 'spec/commands/lock_spec.rb'
184
184
  - 'spec/runtime/setup_spec.rb'
185
185
 
186
- # Offense count: 8
186
+ # Offense count: 9
187
187
  # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
188
188
  # NamePrefix: is_, has_, have_
189
189
  # NamePrefixBlacklist: is_, has_, have_
190
190
  # NameWhitelist: is_a?
191
191
  Style/PredicateName:
192
192
  Exclude:
193
+ - 'spec/**/*'
193
194
  - 'lib/bundler/definition.rb'
194
195
  - 'lib/bundler/installer/parallel_installer.rb'
195
196
  - 'lib/bundler/settings.rb'
@@ -198,6 +199,7 @@ Style/PredicateName:
198
199
  - 'lib/bundler/source/path.rb'
199
200
 
200
201
  # Offense count: 25
202
+ # Cop supports --auto-correct.
201
203
  # Configuration parameters: EnforcedStyle, SupportedStyles.
202
204
  # SupportedStyles: compact, exploded
203
205
  Style/RaiseArgs:
@@ -217,7 +219,7 @@ Style/SpaceAroundOperators:
217
219
  Exclude:
218
220
  - 'lib/bundler/retry.rb'
219
221
 
220
- # Offense count: 11
222
+ # Offense count: 10
221
223
  # Cop supports --auto-correct.
222
224
  # Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
223
225
  # SupportedStyles: comma, consistent_comma, no_comma
@@ -231,14 +233,12 @@ Style/TrailingCommaInLiteral:
231
233
  - 'lib/bundler/ruby_version.rb'
232
234
  - 'lib/bundler/similarity_detector.rb'
233
235
  - 'spec/support/artifice/endpoint.rb'
234
- - 'spec/support/rubygems_ext.rb'
235
236
 
236
- # Offense count: 19
237
+ # Offense count: 18
237
238
  # Cop supports --auto-correct.
238
239
  Style/UnneededInterpolation:
239
240
  Exclude:
240
241
  - 'lib/bundler/cli/config.rb'
241
- - 'lib/bundler/definition.rb'
242
242
  - 'lib/bundler/env.rb'
243
243
  - 'spec/bundler/shared_helpers_spec.rb'
244
244
  - 'spec/cache/git_spec.rb'
@@ -1,11 +1,15 @@
1
1
  language: ruby
2
2
  script: rake spec:travis
3
- before_script: travis_retry rake spec:travis:deps
3
+ before_script:
4
+ - travis_retry rake spec:travis:deps
5
+ - travis_retry rake man:build
6
+ - travis_retry rake spec:rubygems:clone_rubygems_$RGV
4
7
 
5
8
  branches:
6
9
  only:
7
10
  - master
8
11
  - auto
12
+ - /.+-dev$/
9
13
  - /.+-stable$/
10
14
 
11
15
  notifications:
@@ -1,3 +1,35 @@
1
+ ## 1.13.0.rc.2 (2016-08-21)
2
+
3
+ Features:
4
+
5
+ - add setting `exec_disable_load` to force `exec` to spawn a new Ruby process (@segiddins)
6
+ - add `doctor` command to help with issues like unlinked compiled gems (#4765, @mistydemeo)
7
+ - rework the `update` command, providing fine-grained control via flags (#4676, @chrismo)
8
+ - add URI to http response output in debug mode (#4808, @NickLaMuro)
9
+ - add manpage for `binstubs` command (#4847, @Zorbash)
10
+ - support `mirror` settings for sources by hostname, not only full URL (@opiethehokie)
11
+ - print gem installation errors after other install output (#4834, @segiddins)
12
+ - add `lock --remove-platform` flag to remove platforms from the lock (#4877, @segiddins)
13
+ - add `only_update_to_newer_versions` setting to prevent downgrades during `update` (@segiddins)
14
+ - expanded expirimental plugin support to include hooks and sources (@asutoshpalai)
15
+
16
+ Bugfixes:
17
+
18
+ - retry gem downloads (#4846, @jkeiser)
19
+ - improve the CompactIndex to handle capitalized legacy gems (#4867, @segiddins)
20
+ - re-use persistent HTTP connections for CompactIndex (@NickLaMuro)
21
+ - respect `required_ruby_version` when Gemfile contains `ruby` version (@indirect)
22
+ - allow `rake release` to sign git tags (#4743, @eagletmt)
23
+ - set process titles when using `#load` during `exec` (@yob)
24
+ - recognize JRuby shebangs for using `#load` during `exec` (@ojab)
25
+ - handle world-writable home directories (#4726, @allenzhao)
26
+ - support multi-platform gems via the `gemspec` Gemfile method (#4798, @segiddins)
27
+ - print dots correctly for CompactIndex fetcher (@NickLaMuro)
28
+ - set an `open_timeout` when requesting gem data via HTTP (@NickLaMuro)
29
+ - rename the BUNDLE\_ORIG\_ENV variable so it no longer shows up in `config` (@indirect)
30
+ - show help only when `-h` or `--help` is passed to Bundler, not to `exec` (#4801, @segiddins)
31
+ - handle symlinks to binstubs created by `--standalone` (#4782, @terinjokes)
32
+
1
33
  ## 1.13.0.rc.1 (2016-06-27)
2
34
 
3
35
  Features:
@@ -5,7 +37,7 @@ Features:
5
37
  - when `bundle config major_deprecations` or `BUNDLE_MAJOR_DEPRECATIONS` is set, deprecation warnings for bundler 2 will be printed (@segiddins)
6
38
  - when running with `--verbose`, bundler will print the reason it is re-resolving a gemfile (@segiddins)
7
39
 
8
- Bug fixes:
40
+ Bugfixes:
9
41
 
10
42
  - fix support for running RubyGems 1.x on Ruby 2.3 (#4698, @segiddins)
11
43
  - fix bundle exec'ing to a ruby file when gems are installed into a path (#4592, @chrismo)
@@ -102,7 +102,7 @@ Finally, the ticket may be a duplicate of another older ticket. If you notice a
102
102
 
103
103
  If you would like to add a new feature to Bundler, please follow these steps:
104
104
 
105
- 1. [Create an issue](https://github.com/bundler/bundler/issues/new) with the [`feature-request` label](https://github.com/bundler/bundler/labels/feature-request) to discuss your feature.
105
+ 1. [Create an issue](https://github.com/bundler/bundler/issues/new) with the [`feature-request` label](https://github.com/bundler/bundler/labels/type:%20feature-request) to discuss your feature.
106
106
  2. Base your commits on the master branch, since we follow [SemVer](http://semver.org) and don't add new features to old releases.
107
107
  3. Commit the code and at least one test covering your changes to a feature branch in your fork.
108
108
  4. Send us a [pull request](https://help.github.com/articles/using-pull-requests) from your feature branch.
data/Rakefile CHANGED
@@ -4,7 +4,12 @@ $:.unshift File.expand_path("../lib", __FILE__)
4
4
  require "shellwords"
5
5
  require "benchmark"
6
6
 
7
- RUBYGEMS_REPO = File.expand_path("tmp/rubygems")
7
+ RUBYGEMS_REPO = if `cd .. && git remote --verbose 2>/dev/null` =~ /rubygems/i
8
+ File.expand_path("..")
9
+ else
10
+ File.expand_path("tmp/rubygems")
11
+ end
12
+
8
13
  BUNDLER_SPEC = Gem::Specification.load("bundler.gemspec")
9
14
 
10
15
  def safe_task(&block)
@@ -34,7 +39,7 @@ namespace :spec do
34
39
  deps = Hash[BUNDLER_SPEC.development_dependencies.map do |d|
35
40
  [d.name, d.requirement.to_s]
36
41
  end]
37
- deps["rubocop"] ||= "= 0.39.0" if RUBY_VERSION >= "1.9.3" # can't go in the gemspec because of the ruby version requirement
42
+ deps["rubocop"] ||= "= 0.41.2" if RUBY_VERSION >= "1.9.3" # can't go in the gemspec because of the ruby version requirement
38
43
 
39
44
  # JRuby can't build ronn or rdiscount, so we skip that
40
45
  if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
@@ -88,7 +93,7 @@ begin
88
93
 
89
94
  if RUBY_VERSION >= "1.9.3"
90
95
  # can't go in the gemspec because of the ruby version requirement
91
- gem "rubocop", "= 0.39.0"
96
+ gem "rubocop", "= 0.41.2"
92
97
  require "rubocop/rake_task"
93
98
  RuboCop::RakeTask.new
94
99
  end
@@ -126,7 +131,7 @@ begin
126
131
  (branches + releases).each do |rg|
127
132
  desc "Run specs with Rubygems #{rg}"
128
133
  RSpec::Core::RakeTask.new(rg) do |t|
129
- t.rspec_opts = %w(--format documentation --color)
134
+ t.rspec_opts = %w(--format progress --color)
130
135
  t.ruby_opts = %w(-w)
131
136
  end
132
137
 
@@ -142,18 +147,22 @@ begin
142
147
  end
143
148
  hash = nil
144
149
 
145
- Dir.chdir(RUBYGEMS_REPO) do
146
- system("git remote update")
147
- if rg == "master"
148
- system("git checkout origin/master")
149
- else
150
- system("git checkout #{rg}") || raise("Unknown Rubygems ref #{rg}")
150
+ if RUBYGEMS_REPO.start_with?(Dir.pwd)
151
+ Dir.chdir(RUBYGEMS_REPO) do
152
+ system("git remote update")
153
+ if rg == "master"
154
+ system("git checkout origin/master")
155
+ else
156
+ system("git checkout #{rg}") || raise("Unknown Rubygems ref #{rg}")
157
+ end
158
+ hash = `git rev-parse HEAD`.chomp
151
159
  end
152
- hash = `git rev-parse HEAD`.chomp
160
+ elsif rg != "master"
161
+ raise "need to be running against master with bundler as a submodule"
153
162
  end
154
163
 
155
164
  puts "Checked out rubygems '#{rg}' at #{hash}"
156
- ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems/lib")} #{rubyopt}"
165
+ ENV["RUBYOPT"] = "-I#{File.join(RUBYGEMS_REPO, "lib")} #{rubyopt}"
157
166
  puts "RUBYOPT=#{ENV["RUBYOPT"]}"
158
167
  end
159
168
 
data/bin/rake CHANGED
@@ -8,7 +8,7 @@ require "rubygems"
8
8
  bundler_spec = Gem::Specification.load(File.expand_path("../../bundler.gemspec", __FILE__))
9
9
  bundler_spec.dependencies.each do |dep|
10
10
  begin
11
- gem dep.name, dep.requirement.to_s
11
+ gem dep.name, dep.requirement
12
12
  rescue Gem::LoadError => e
13
13
  $stderr.puts "#{e.message} (#{e.class})"
14
14
  end
data/bin/rspec CHANGED
@@ -7,7 +7,7 @@ require "rubygems"
7
7
 
8
8
  bundler_spec = Gem::Specification.load(File.expand_path("../../bundler.gemspec", __FILE__))
9
9
  bundler_spec.dependencies.each do |dep|
10
- gem dep.name, dep.requirement.to_s
10
+ gem dep.name, dep.requirement
11
11
  end
12
12
 
13
13
  Gem.finish_resolve if Gem.respond_to?(:finish_resolve)
@@ -7,10 +7,10 @@ require "rubygems"
7
7
 
8
8
  bundler_spec = Gem::Specification.load(File.expand_path("../../bundler.gemspec", __FILE__))
9
9
  bundler_spec.dependencies.each do |dep|
10
- gem dep.name, dep.requirement.to_s
10
+ gem dep.name, dep.requirement
11
11
  end
12
12
 
13
- gem "rubocop", "= 0.39.0"
13
+ gem "rubocop", "= 0.41.2"
14
14
 
15
15
  Gem.finish_resolve if Gem.respond_to?(:finish_resolve)
16
16
 
@@ -20,9 +20,9 @@ Gem::Specification.new do |s|
20
20
  s.add_development_dependency "automatiek", "~> 0.1.0"
21
21
  s.add_development_dependency "mustache", "0.99.6"
22
22
  s.add_development_dependency "rake", "~> 10.0"
23
- s.add_development_dependency "rdiscount", "~> 2.1.8"
23
+ s.add_development_dependency "rdiscount", "~> 2.2"
24
24
  s.add_development_dependency "ronn", "~> 0.7.3"
25
- s.add_development_dependency "rspec", "~> 3.0"
25
+ s.add_development_dependency "rspec", "~> 3.5"
26
26
 
27
27
  s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
28
28
  # we don't check in man pages, but we need to ship them because
@@ -1,22 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- # Exit cleanly from an early interrupt
5
- Signal.trap("INT") { exit 1 }
6
-
7
- require "bundler"
8
- # Check if an older version of bundler is installed
9
- $LOAD_PATH.each do |path|
10
- next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9
11
- err = String.new
12
- err << "Looks like you have a version of bundler that's older than 0.9.\n"
13
- err << "Please remove your old versions.\n"
14
- err << "An easy way to do this is by running `gem cleanup bundler`."
15
- abort(err)
16
- end
17
-
18
- require "bundler/friendly_errors"
19
- Bundler.with_friendly_errors do
20
- require "bundler/cli"
21
- Bundler::CLI.start(ARGV, :debug => true)
22
- end
4
+ load File.expand_path("../bundle", __FILE__)
@@ -3,14 +3,15 @@ require "fileutils"
3
3
  require "pathname"
4
4
  require "rbconfig"
5
5
  require "thread"
6
+ require "bundler/errors"
6
7
  require "bundler/environment_preserver"
7
8
  require "bundler/gem_remote_fetcher"
9
+ require "bundler/plugin"
8
10
  require "bundler/rubygems_ext"
9
11
  require "bundler/rubygems_integration"
10
12
  require "bundler/version"
11
13
  require "bundler/constants"
12
14
  require "bundler/current_ruby"
13
- require "bundler/errors"
14
15
 
15
16
  module Bundler
16
17
  environment_preserver = EnvironmentPreserver.new(ENV, %w(PATH GEM_PATH))
@@ -24,34 +25,33 @@ module Bundler
24
25
  autoload :Deprecate, "bundler/deprecate"
25
26
  autoload :Dsl, "bundler/dsl"
26
27
  autoload :EndpointSpecification, "bundler/endpoint_specification"
27
- autoload :Environment, "bundler/environment"
28
28
  autoload :Env, "bundler/env"
29
29
  autoload :Fetcher, "bundler/fetcher"
30
30
  autoload :GemHelper, "bundler/gem_helper"
31
31
  autoload :GemHelpers, "bundler/gem_helpers"
32
+ autoload :GemVersionPromoter, "bundler/gem_version_promoter"
32
33
  autoload :Graph, "bundler/graph"
33
34
  autoload :Index, "bundler/index"
34
- autoload :Installer, "bundler/installer"
35
35
  autoload :Injector, "bundler/injector"
36
+ autoload :Installer, "bundler/installer"
36
37
  autoload :LazySpecification, "bundler/lazy_specification"
37
38
  autoload :LockfileParser, "bundler/lockfile_parser"
38
39
  autoload :MatchPlatform, "bundler/match_platform"
39
40
  autoload :Mirror, "bundler/mirror"
40
41
  autoload :Mirrors, "bundler/mirror"
41
- autoload :Plugin, "bundler/plugin"
42
42
  autoload :RemoteSpecification, "bundler/remote_specification"
43
43
  autoload :Resolver, "bundler/resolver"
44
44
  autoload :Retry, "bundler/retry"
45
- autoload :RubyVersion, "bundler/ruby_version"
46
45
  autoload :RubyDsl, "bundler/ruby_dsl"
46
+ autoload :RubyGemsGemInstaller, "bundler/rubygems_gem_installer"
47
+ autoload :RubyVersion, "bundler/ruby_version"
47
48
  autoload :Runtime, "bundler/runtime"
48
49
  autoload :Settings, "bundler/settings"
49
50
  autoload :SharedHelpers, "bundler/shared_helpers"
50
- autoload :SpecSet, "bundler/spec_set"
51
- autoload :StubSpecification, "bundler/stub_specification"
52
51
  autoload :Source, "bundler/source"
53
52
  autoload :SourceList, "bundler/source_list"
54
- autoload :RubyGemsGemInstaller, "bundler/rubygems_gem_installer"
53
+ autoload :SpecSet, "bundler/spec_set"
54
+ autoload :StubSpecification, "bundler/stub_specification"
55
55
  autoload :UI, "bundler/ui"
56
56
  autoload :URICredentialsFilter, "bundler/uri_credentials_filter"
57
57
 
@@ -88,7 +88,7 @@ module Bundler
88
88
 
89
89
  def setup(*groups)
90
90
  # Return if all groups are already loaded
91
- return @setup if defined?(@setup)
91
+ return @setup if defined?(@setup) && @setup
92
92
 
93
93
  definition.validate_ruby!
94
94
 
@@ -111,7 +111,8 @@ module Bundler
111
111
  end
112
112
 
113
113
  def environment
114
- Bundler::Environment.new(root, definition)
114
+ SharedHelpers.major_deprecation "Bundler.environment has been removed in favor of Bundler.load"
115
+ load
115
116
  end
116
117
 
117
118
  # Returns an instance of Bundler::Definition for given Gemfile and lockfile
@@ -123,19 +124,18 @@ module Bundler
123
124
  @definition = nil if unlock
124
125
  @definition ||= begin
125
126
  configure
126
- upgrade_lockfile
127
127
  Definition.build(default_gemfile, default_lockfile, unlock)
128
128
  end
129
129
  end
130
130
 
131
131
  def locked_gems
132
- return @locked_gems if defined?(@locked_gems)
133
- if Bundler.default_lockfile.exist?
134
- lock = Bundler.read_file(Bundler.default_lockfile)
135
- @locked_gems = LockfileParser.new(lock)
136
- else
137
- @locked_gems = nil
138
- end
132
+ @locked_gems ||=
133
+ if defined?(@definition) && @definition
134
+ definition.locked_gems
135
+ elsif Bundler.default_lockfile.exist?
136
+ lock = Bundler.read_file(Bundler.default_lockfile)
137
+ LockfileParser.new(lock)
138
+ end
139
139
  end
140
140
 
141
141
  def ruby_scope
@@ -195,6 +195,14 @@ module Bundler
195
195
 
196
196
  def rm_rf(path)
197
197
  FileUtils.remove_entry_secure(path) if path && File.exist?(path)
198
+ rescue ArgumentError
199
+ message = <<EOF
200
+ It is a security vulnerability to allow your home directory to be world-writable, and bundler can not continue.
201
+ You should probably consider fixing this issue by running `chmod o-w ~` on *nix.
202
+ Please refer to http://ruby-doc.org/stdlib-2.1.2/libdoc/fileutils/rdoc/FileUtils.html#method-c-remove_entry_secure for details.
203
+ EOF
204
+ File.world_writable?(path) ? Bundler.ui.warn(message) : raise
205
+ raise PathError, "Please fix the world-writable issue with your #{path} directory"
198
206
  end
199
207
 
200
208
  def settings
@@ -214,8 +222,8 @@ module Bundler
214
222
  Bundler::SharedHelpers.major_deprecation("`Bundler.clean_env` has weird edge cases, use `.original_env` instead")
215
223
  env = original_env
216
224
 
217
- if env.key?("BUNDLE_ORIG_MANPATH")
218
- env["MANPATH"] = env["BUNDLE_ORIG_MANPATH"]
225
+ if env.key?("BUNDLER_ORIG_MANPATH")
226
+ env["MANPATH"] = env["BUNDLER_ORIG_MANPATH"]
219
227
  end
220
228
 
221
229
  env.delete_if {|k, _| k[0, 7] == "BUNDLE_" }
@@ -385,6 +393,18 @@ module Bundler
385
393
  @root = nil
386
394
  @settings = nil
387
395
  @definition = nil
396
+ @setup = nil
397
+ @load = nil
398
+ @locked_gems = nil
399
+ @bundle_path = nil
400
+ @bin_path = nil
401
+
402
+ Plugin.reset!
403
+
404
+ return unless defined?(@rubygems) && @rubygems
405
+ rubygems.undo_replacements
406
+ rubygems.reset
407
+ @rubygems = nil
388
408
  end
389
409
 
390
410
  private
@@ -400,17 +420,13 @@ module Bundler
400
420
  def eval_gemspec(path, contents)
401
421
  eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
402
422
  rescue ScriptError, StandardError => e
403
- original_line = e.backtrace.find {|line| line.include?(path.to_s) }
404
- msg = String.new
405
- msg << "There was a #{e.class} while loading #{path.basename}: \n#{e.message}"
406
- msg << " from\n #{original_line}" if original_line
407
- msg << "\n"
423
+ msg = "There was an error while loading `#{path.basename}`: #{e.message}"
408
424
 
409
425
  if e.is_a?(LoadError) && RUBY_VERSION >= "1.9"
410
- msg << "\nDoes it try to require a relative path? That's been removed in Ruby 1.9."
426
+ msg += "\nDoes it try to require a relative path? That's been removed in Ruby 1.9"
411
427
  end
412
428
 
413
- raise GemspecError, msg
429
+ raise GemspecError, Dsl::DSLError.new(msg, path, e.backtrace, contents)
414
430
  end
415
431
 
416
432
  def configure_gem_home_and_path
@@ -442,13 +458,6 @@ module Bundler
442
458
  Bundler.rubygems.clear_paths
443
459
  end
444
460
 
445
- def upgrade_lockfile
446
- lockfile = default_lockfile
447
- return unless lockfile.exist? && lockfile.read(3) == "---"
448
- Bundler.ui.warn "Detected Gemfile.lock generated by 0.9, deleting..."
449
- lockfile.rmtree
450
- end
451
-
452
461
  # @param env [Hash]
453
462
  def with_env(env)
454
463
  backup = ENV.to_hash