bundler 1.5.3 → 1.6.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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +14 -11
  3. data/CHANGELOG.md +10 -3
  4. data/CONTRIBUTING.md +21 -12
  5. data/DEVELOPMENT.md +2 -2
  6. data/README.md +3 -2
  7. data/Rakefile +19 -9
  8. data/bundler.gemspec +1 -1
  9. data/lib/bundler.rb +9 -5
  10. data/lib/bundler/cli.rb +51 -10
  11. data/lib/bundler/dsl.rb +10 -6
  12. data/lib/bundler/friendly_errors.rb +1 -1
  13. data/lib/bundler/installer.rb +28 -17
  14. data/lib/bundler/parallel_workers/worker.rb +1 -1
  15. data/lib/bundler/resolver.rb +191 -207
  16. data/lib/bundler/rubygems_ext.rb +2 -4
  17. data/lib/bundler/rubygems_integration.rb +5 -0
  18. data/lib/bundler/runtime.rb +15 -12
  19. data/lib/bundler/settings.rb +4 -2
  20. data/lib/bundler/source.rb +11 -1
  21. data/lib/bundler/source/git.rb +11 -7
  22. data/lib/bundler/source/git/git_proxy.rb +4 -7
  23. data/lib/bundler/source/path.rb +21 -12
  24. data/lib/bundler/source/path/installer.rb +1 -1
  25. data/lib/bundler/source/rubygems.rb +18 -8
  26. data/lib/bundler/ssl_certs/certificate_manager.rb +41 -0
  27. data/lib/bundler/templates/newgem/README.md.tt +1 -1
  28. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +2 -2
  29. data/lib/bundler/ui.rb +4 -141
  30. data/lib/bundler/ui/rg_proxy.rb +21 -0
  31. data/lib/bundler/ui/shell.rb +98 -0
  32. data/lib/bundler/ui/silent.rb +44 -0
  33. data/lib/bundler/vendor/net/http/faster.rb +0 -1
  34. data/lib/bundler/vendor/net/http/persistent.rb +0 -1
  35. data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +0 -1
  36. data/lib/bundler/version.rb +1 -1
  37. data/spec/bundler/definition_spec.rb +2 -2
  38. data/spec/bundler/dsl_spec.rb +3 -3
  39. data/spec/bundler/gem_helper_spec.rb +5 -7
  40. data/spec/bundler/settings_spec.rb +15 -0
  41. data/spec/bundler/source_spec.rb +1 -1
  42. data/spec/commands/config_spec.rb +18 -0
  43. data/spec/commands/console_spec.rb +22 -0
  44. data/spec/commands/exec_spec.rb +1 -0
  45. data/spec/commands/newgem_spec.rb +2 -2
  46. data/spec/commands/open_spec.rb +13 -0
  47. data/spec/{install/gems/packed_spec.rb → commands/package_spec.rb} +30 -0
  48. data/spec/commands/show_spec.rb +87 -71
  49. data/spec/install/binstubs_spec.rb +1 -1
  50. data/spec/install/bundler_spec.rb +1 -1
  51. data/spec/install/gemfile/git_spec.rb +1 -1
  52. data/spec/install/gemfile/path_spec.rb +12 -0
  53. data/spec/install/gemfile_spec.rb +1 -1
  54. data/spec/install/gems/groups_spec.rb +1 -1
  55. data/spec/install/gems/platform_spec.rb +0 -1
  56. data/spec/install/gems/post_install_spec.rb +74 -0
  57. data/spec/install/gems/resolving_spec.rb +22 -26
  58. data/spec/install/gems/simple_case_spec.rb +17 -1
  59. data/spec/install/gemspecs_spec.rb +1 -1
  60. data/spec/install/path_spec.rb +1 -1
  61. data/spec/install/prereleases_spec.rb +1 -1
  62. data/spec/other/ext_spec.rb +1 -1
  63. data/spec/other/ssl_cert_spec.rb +10 -0
  64. data/spec/realworld/edgecases_spec.rb +1 -1
  65. data/spec/resolver/basic_spec.rb +29 -0
  66. data/spec/support/builders.rb +42 -43
  67. data/spec/support/indexes.rb +129 -1
  68. data/spec/support/permissions.rb +1 -0
  69. data/spec/update/gems_spec.rb +37 -0
  70. data/spec/update/git_spec.rb +24 -1
  71. data/spec/update/source_spec.rb +14 -1
  72. metadata +14 -9
  73. data/lib/bundler/safe_catch.rb +0 -101
  74. data/spec/bundler/safe_catch_spec.rb +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db6caecfa1400ecabac4e4166056f9ca616d09f3
4
- data.tar.gz: 6bfb9eb62ab62260215ec47765005e9650689dbd
3
+ metadata.gz: ba02e8bf782c12afb3abc0227c0589c4008d7a50
4
+ data.tar.gz: d24a21a4d7ee5c5b8a170e7268cfd87927a8a2c1
5
5
  SHA512:
6
- metadata.gz: a6ecdc3b43845393951056fd8d93d942e4903f371defee233b410d26620b1ba79532eb51d6e08bef565dddf4f23a26f8efeef8a610ccc80acc76be489f4f6e0a
7
- data.tar.gz: b17a2361fcabdb360f6ec68c9750430c9dcefcbc8ec2757dc9e54a32fa35315b4203523ff3588cb8e3e3fa9aa164910c21d9d98e8426f6fa43384122db7f3b62
6
+ metadata.gz: d4edc092f83b06ea5d803ff0c7f732339e01f37f34fb8675a263f228e2f1ffffc8c032af1f628aa8939db4acf0715baf41bf3d232375b2126646c0c0ef46d657
7
+ data.tar.gz: 8b5bd0fa37c93c3aef9bb1fb5b7d43e28f3e550e21917eadd498f5d766a582d69f11e68f3007a21425863e30c6d58179cab716df25b488a6d265ed434b10d833
@@ -19,19 +19,22 @@ notifications:
19
19
  on_success: change
20
20
  on_failure: always
21
21
  rooms:
22
+ # Bundler Ops
22
23
  secure: MNTSGIySYwHia5gIgRiZxXtPMPDIP9KmzQk7Kq2ZoVvP3mIk8W1TMkvcyFkEf6uCasyVZZixzUBfY+E0BlHAz1ycQpTh1jvSpuIpEVYW48ShJldJ+8W8xfzafyOHii3z7VrDaomEffmMDdmHRsbQAfekMjdR4bTpXtT9V+wOXlg=
23
24
  rvm:
25
+ - 2.1.0
24
26
  - 2.0.0
25
27
  - 1.9.3
28
+ - 1.8.7
26
29
  # Rubygems versions MUST be available as rake tasks
27
30
  # see Rakefile:66 for the list of possible RGV values
28
31
  env:
29
32
  # We need to know if changes to rubygems will break bundler on release
30
33
  - RGV=master
31
34
  # Test the latest rubygems release with all of our supported rubies
32
- - RGV=v2.1.9
35
+ - RGV=v2.2.1
33
36
  # Test the latest stable branch so we know the next minor will work
34
- - RGV=2.1
37
+ - RGV=2.2
35
38
  matrix:
36
39
  allow_failures:
37
40
  # We want to know how we're doing with head, but not fail the build
@@ -48,21 +51,21 @@ matrix:
48
51
  env: RGV=master
49
52
  # Alternate implementations
50
53
  - rvm: jruby
51
- env: RGV=v2.1.9
54
+ env: RGV=v2.2.1
52
55
  - rvm: rbx
53
- env: RGV=v2.1.9
56
+ env: RGV=v2.2.1
54
57
  # Rubygems goes down to 2.0 on Ruby 2.0.0
55
58
  - rvm: 2.0.0
56
- env: RGV=v2.1.9
59
+ env: RGV=v2.1.11
57
60
  - rvm: 2.0.0
58
- env: RGV=v2.0.12
61
+ env: RGV=v2.0.14
59
62
  # Rubygems goes down to 1.5.3 on Ruby 1.9.3
60
63
  - rvm: 1.9.3
61
- env: RGV=v2.1.9
64
+ env: RGV=v2.1.11
62
65
  - rvm: 1.9.3
63
- env: RGV=v2.0.12
66
+ env: RGV=v2.0.14
64
67
  - rvm: 1.9.3
65
- env: RGV=v1.8.28
68
+ env: RGV=v1.8.29
66
69
  - rvm: 1.9.3
67
70
  env: RGV=v1.7.2
68
71
  - rvm: 1.9.3
@@ -71,10 +74,10 @@ matrix:
71
74
  env: RGV=v1.5.3
72
75
  # We only want an overview of how 1.9.2 is doing
73
76
  - rvm: 1.9.2
74
- env: RGV=v2.1.9
77
+ env: RGV=v2.1.11
75
78
  # Rubygems goes down to 1.3.6 on Ruby 1.8.7
76
79
  - rvm: 1.8.7
77
- env: RGV=v1.8.28
80
+ env: RGV=v1.8.29
78
81
  - rvm: 1.8.7
79
82
  env: RGV=v1.7.2
80
83
  - rvm: 1.8.7
@@ -1,9 +1,16 @@
1
- ## 1.5.3 (2014-02-06)
1
+ ## 1.6.0
2
2
 
3
3
  Bugfixes:
4
4
 
5
- - find "missing" gems that are actually present (#2780, #2818, #2854)
6
- - pse n-1 cores when given n jobs for parallel install (@jdickey)
5
+ - many Gemfiles that had incorrect errors now resolve correctly (@Who828)
6
+
7
+ Features:
8
+
9
+ - resolver rewritten to avoid recursion (@Who828)
10
+ - some complex Gemfiles are resolved up to 10x faster (@Who828)
11
+ - add support for IRB alternatives such as Pry and Ripl (@joallard, @postmodern)
12
+ - highlight installed or updated gems (#2722, #2741, @yaotti, @simi)
13
+ - display post_install_message's for gems installed via :git (@phallstrom)
7
14
 
8
15
  ## 1.5.2 (2014-01-10)
9
16
 
@@ -1,21 +1,30 @@
1
- # Creating Issues
1
+ # Contributing
2
+
3
+ Bundler welcomes contributions from *everyone*. While contributing, please follow the project [code of conduct](http://bundler.io/conduct.html), so that everyone can be included.
4
+
5
+ Here are some ways you can contribute:
6
+
7
+ - by using prerelease versions
8
+ - by reporting bugs
9
+ - by suggesting new features
10
+ - by writing or editing documentation
11
+ - by closing issues
12
+ - by reviewing patches
13
+ - by refactoring code
14
+ - by writing code (no patch is too small! fix typos or bad whitespace)
15
+
16
+ If you'd like to help make Bundler better, you totally rock! Please check out the [DEVELOPMENT](https://github.com/bundler/bundler/blob/master/DEVELOPMENT.md) file for an introduction to the project, guidelines for contributing, and details about what would be helpful.
17
+
18
+ Thanks for helping us make Bundler better.
19
+
20
+ # Troubleshooting
2
21
 
3
22
  If you're having a problem, please see [ISSUES](https://github.com/bundler/bundler/blob/master/ISSUES.md) for troubleshooting steps and a guide for how to submit a ticket that will help us solve the problem you are having as quickly as possible.
4
23
 
5
24
  # Requesting Features
6
25
 
7
- Head on over to the [Bundler
8
- features](https://github.com/bundler/bundler-features) project, or any of the
9
- lists or channels listed below. Feature-wise we consider Bundler stable, so the
10
- core team does not tend to work on feature suggestions. Pull requests welcome
11
- though!
26
+ Head on over to the [Bundler features](https://github.com/bundler/bundler-features) project, or any of the lists or channels listed below. Feature-wise we consider Bundler stable, so the core team does not tend to work on feature suggestions. Pull requests welcome though!
12
27
 
13
28
  # Discussing Bundler
14
29
 
15
30
  If you'd like to discuss features, ask questions, or just engage in general Bundler-focused discussion, please see the [#bundler](irc://irc.freenode.net/#bundler) IRC channel on Freenode, and the [Bundler mailing list](http://groups.google.com/group/ruby-bundler) on Google Groups.
16
-
17
- # Helping Out
18
-
19
- If you'd like to help make Bundler better, you totally rock! Please check out the [DEVELOPMENT](https://github.com/bundler/bundler/blob/master/DEVELOPMENT.md) file for an introduction to the project, guidelines for contributing, and suggestions for things anyone can do that would be helpful.
20
-
21
- Thanks for helping us make Bundler better.
@@ -2,7 +2,7 @@ Great to have you here! Here are a few ways you can help out with [Bundler](http
2
2
 
3
3
  # Where should I start?
4
4
 
5
- You can start learning about Bundler by reading [the documentation](http://bundler.io). If you want, you can also read a (lengthy) explanation of [why Bundler exists and what it does](http://bundler.io/v1.2/rationale.html). You can also check out discussions about Bundler on the [Bundler mailing list](https://groups.google.com/group/ruby-bundler) and in the [Bundler IRC channel](irc://irc.freenode.net/#bundler), which is #bundler on Freenode.
5
+ You can start learning about Bundler by reading [the documentation](http://bundler.io). If you want, you can also read a (lengthy) explanation of [why Bundler exists and what it does](http://bundler.io/v1.5/rationale.html). You can also check out discussions about Bundler on the [Bundler mailing list](https://groups.google.com/group/ruby-bundler) and in the [Bundler IRC channel](irc://irc.freenode.net/#bundler), which is #bundler on Freenode.
6
6
 
7
7
  ## Your first commits
8
8
 
@@ -83,7 +83,7 @@ If you don't hear back immediately, don’t get discouraged! We all have day job
83
83
 
84
84
  Early releases require heavy testing, especially across various system setups. We :heart: testers, and are big fans of anyone who can run `gem install bundler --pre` and try out upcoming releases in their development and staging environments.
85
85
 
86
- As of September 3 2012, there is no current prerelease or beta version of Bundler. That said, you are always welcome to try checking out master and building a gem yourself if you want to try out the latest changes.
86
+ There may not always be prereleases or beta versions of Bundler. That said, you are always welcome to try checking out master and building a gem yourself if you want to try out the latest changes.
87
87
 
88
88
 
89
89
  # Translations
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  [![Code Climate](https://codeclimate.com/github/bundler/bundler.png)](https://codeclimate.com/github/bundler/bundler)
2
- [![Build Status](https://secure.travis-ci.org/bundler/bundler.png?branch=1-3-stable)](http://travis-ci.org/bundler/bundler)
2
+ [![Build Status](https://travis-ci.org/bundler/bundler.png?branch=master)](http://travis-ci.org/bundler/bundler)
3
+ <a href="http://badge.fury.io/rb/bundler"><img src="https://badge.fury.io/rb/bundler@2x.png" alt="Gem Version" height="18"></a>
3
4
 
4
5
  # Bundler: a gem to bundle gems
5
6
  Bundler keeps ruby applications running the same code on every machine.
@@ -26,7 +27,7 @@ For help with common problems, see [ISSUES](https://github.com/bundler/bundler/b
26
27
 
27
28
  If you'd like to contribute to Bundler, that's awesome, and we <3 you. There's a guide to contributing to Bundler (both code and general help) over in [DEVELOPMENT](https://github.com/bundler/bundler/blob/master/DEVELOPMENT.md)
28
29
 
29
- The `master` branch contains our current progress towards version 1.4. Versions 1.0-1.3 each have their own stable branches. Please submit bugfixes as pull requests to the stable branch for the version you would like to fix.
30
+ The `master` branch contains our current progress towards version 1.5. Versions 1.0-1.3 each have their own stable branches. Please submit bugfixes as pull requests to the stable branch for the version you would like to fix.
30
31
 
31
32
  ### Core Team
32
33
 
data/Rakefile CHANGED
@@ -4,6 +4,8 @@ require 'rubygems'
4
4
  require 'shellwords'
5
5
  require 'benchmark'
6
6
 
7
+ RUBYGEMS_REPO = File.expand_path("tmp/rubygems")
8
+
7
9
  def safe_task(&block)
8
10
  yield
9
11
  true
@@ -28,8 +30,8 @@ end
28
30
  namespace :spec do
29
31
  desc "Ensure spec dependencies are installed"
30
32
  task :deps do
31
- {"rdiscount" => "~> 1.6", "ronn" => "~> 0.7.3", "rspec" => "~> 3.0.beta"}.each do |name, version|
32
- sh "#{Gem.ruby} -S gem list -i '^#{name}$' -v '#{version}' || " \
33
+ {"rdiscount" => "~> 1.6", "ronn" => "~> 0.7.3", "rspec" => "~> 2.99.0.beta1"}.each do |name, version|
34
+ sh "#{Gem.ruby} -S gem list -i #{name} -v '#{version}' || " \
33
35
  "#{Gem.ruby} -S gem install #{name} -v '#{version}' --no-ri --no-rdoc"
34
36
  end
35
37
  end
@@ -42,8 +44,10 @@ namespace :spec do
42
44
  system("sudo sed -i '/secure_path/d' /etc/sudoers")
43
45
  # Install groff for the ronn gem
44
46
  system("sudo apt-get install groff -y")
45
- # Switch to the Bluebox DNS servers in the Travis data center
46
- system("printf 'nameserver 199.91.168.70\nnameserver 199.91.168.71\n' | sudo tee /etc/resolv.conf")
47
+ # Downgrade Rubygems on 1.8 to avoid https://github.com/rubygems/rubygems/issues/784
48
+ if RUBY_VERSION < '1.9'
49
+ system("gem update --system 2.1.11")
50
+ end
47
51
  # Install the other gem deps, etc.
48
52
  Rake::Task["spec:deps"].invoke
49
53
  end
@@ -90,8 +94,8 @@ begin
90
94
  namespace :rubygems do
91
95
  rubyopt = ENV["RUBYOPT"]
92
96
  # When editing this list, also edit .travis.yml!
93
- branches = %w(master 2.1)
94
- releases = %w(v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.28 v2.0.12 v2.1.9)
97
+ branches = %w(master 2.2)
98
+ releases = %w(v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.29 v2.0.14 v2.1.11 v2.2.1)
95
99
  (branches + releases).each do |rg|
96
100
  desc "Run specs with Rubygems #{rg}"
97
101
  RSpec::Core::RakeTask.new(rg) do |t|
@@ -111,7 +115,7 @@ begin
111
115
  end
112
116
  hash = nil
113
117
 
114
- Dir.chdir("tmp/rubygems") do
118
+ Dir.chdir(RUBYGEMS_REPO) do
115
119
  system("git remote update")
116
120
  if rg == "master"
117
121
  system("git checkout origin/master")
@@ -126,7 +130,7 @@ begin
126
130
  puts "RUBYOPT=#{ENV['RUBYOPT']}"
127
131
  end
128
132
 
129
- task rg => ["clone_rubygems_#{rg}", "man:build"]
133
+ task rg => ["man:build", "clone_rubygems_#{rg}"]
130
134
  task "rubygems:all" => rg
131
135
  end
132
136
 
@@ -146,7 +150,7 @@ begin
146
150
 
147
151
  desc "Run the tests on Travis CI against a rubygem version (using ENV['RGV'])"
148
152
  task :travis do
149
- rg = ENV['RGV'] || 'v1.8.24'
153
+ rg = ENV['RGV'] || raise("Rubygems version is required on Travis!")
150
154
 
151
155
  puts "\n\e[1;33m[Travis CI] Running bundler specs against rubygems #{rg}\e[m\n\n"
152
156
  specs = safe_task { Rake::Task["spec:rubygems:#{rg}"].invoke }
@@ -220,6 +224,12 @@ rescue LoadError
220
224
  end
221
225
  end
222
226
 
227
+ desc "Update vendored SSL certs to match the certs vendored by Rubygems"
228
+ task :update_certs => "spec:rubygems:clone_rubygems_master" do
229
+ require 'bundler/ssl_certs/certificate_manager'
230
+ Bundler::SSLCerts::CertificateManager.update_from!(RUBYGEMS_REPO)
231
+ end
232
+
223
233
  require 'bundler/gem_tasks'
224
234
  task :build => ["man:clean", "man:build"]
225
235
  task :release => ["man:clean", "man:build"]
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.required_rubygems_version = '>= 1.3.6'
18
18
 
19
19
  spec.add_development_dependency 'ronn', '~> 0.7.3'
20
- spec.add_development_dependency 'rspec', '~> 2.11'
20
+ spec.add_development_dependency 'rspec', '~> 2.99.0.beta1'
21
21
 
22
22
  spec.files = `git ls-files -z`.split("\x0")
23
23
  spec.files += Dir.glob('lib/bundler/man/**/*') # man/ is ignored by git
@@ -90,7 +90,7 @@ module Bundler
90
90
  end
91
91
 
92
92
  def ui
93
- @ui ||= UI.new
93
+ @ui ||= UI::Silent.new
94
94
  end
95
95
 
96
96
  # Returns absolute path of where gems are installed on the filesystem.
@@ -154,9 +154,12 @@ module Bundler
154
154
  end
155
155
 
156
156
  def locked_gems
157
- @locked_gems ||= begin
157
+ return @locked_gems if defined?(@locked_gems)
158
+ if Bundler.default_lockfile.exist?
158
159
  lock = Bundler.read_file(Bundler.default_lockfile)
159
- LockfileParser.new(lock)
160
+ @lock_gems = LockfileParser.new(lock)
161
+ else
162
+ @locked_gems = nil
160
163
  end
161
164
  end
162
165
 
@@ -194,8 +197,9 @@ module Bundler
194
197
  root.join('.bundle')
195
198
  end
196
199
 
197
- def app_cache
198
- root.join("vendor/cache")
200
+ def app_cache(custom_path = nil)
201
+ path = custom_path || root
202
+ path.join("vendor/cache")
199
203
  end
200
204
 
201
205
  def tmp
@@ -1,5 +1,4 @@
1
1
  require 'bundler'
2
- require 'bundler/similarity_detector'
3
2
  require 'bundler/vendored_thor'
4
3
 
5
4
  module Bundler
@@ -302,11 +301,14 @@ module Bundler
302
301
  "Use the rubygems modern index instead of the API endpoint"
303
302
  method_option "jobs", :aliases => "-j", :type => :numeric, :banner =>
304
303
  "Specify the number of jobs to run in parallel"
304
+ method_option "group", :aliases => "-g", :type => :array, :banner =>
305
+ "Update a specific group"
305
306
  def update(*gems)
306
307
  sources = Array(options[:source])
308
+ groups = Array(options[:group]).map(&:to_sym)
307
309
  Bundler.ui.level = "warn" if options[:quiet]
308
310
 
309
- if gems.empty? && sources.empty?
311
+ if gems.empty? && sources.empty? && groups.empty?
310
312
  # We're doing a full update
311
313
  Bundler.definition(true)
312
314
  else
@@ -316,6 +318,12 @@ module Bundler
316
318
  next if names.include?(g)
317
319
  raise GemNotFound, not_found_message(g, names)
318
320
  end
321
+
322
+ if groups.any?
323
+ specs = Bundler.definition.specs_for groups
324
+ sources.concat(specs.map(&:name))
325
+ end
326
+
319
327
  Bundler.definition(:gems => gems, :sources => sources)
320
328
  end
321
329
 
@@ -513,6 +521,9 @@ module Bundler
513
521
  method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
514
522
  method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)."
515
523
  method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors."
524
+ method_option "path", :type => :string, :banner =>
525
+ "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
526
+ method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile"
516
527
  long_desc <<-D
517
528
  The package command will copy the .gem files for every gem in the bundle into the
518
529
  directory ./vendor/cache. If you then check that directory into your source
@@ -521,10 +532,12 @@ module Bundler
521
532
  D
522
533
  def package
523
534
  Bundler.ui.level = "warn" if options[:quiet]
535
+ Bundler.settings[:path] = File.expand_path(options[:path]) if options[:path]
524
536
  setup_cache_all
525
537
  install
526
538
  # TODO: move cache contents here now that all bundles are locked
527
- Bundler.load.cache
539
+ custom_path = Pathname.new(options[:path]) if options[:path]
540
+ Bundler.load.cache(custom_path)
528
541
  end
529
542
  map %w(pack) => :package
530
543
 
@@ -650,20 +663,50 @@ module Bundler
650
663
  return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor
651
664
  spec = select_spec(name, :regex_match)
652
665
  return unless spec
653
- Dir.chdir(spec.full_gem_path) do
654
- command = "#{editor} #{spec.full_gem_path}"
666
+ full_gem_path = spec.full_gem_path
667
+ Dir.chdir(full_gem_path) do
668
+ command = "#{editor} #{full_gem_path}"
655
669
  success = system(command)
656
670
  Bundler.ui.info "Could not run '#{command}'" unless success
657
671
  end
658
672
  end
659
673
 
674
+ CONSOLES = {
675
+ 'pry' => :Pry,
676
+ 'ripl' => :Ripl,
677
+ 'irb' => :IRB,
678
+ }
679
+
660
680
  desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded"
661
681
  def console(group = nil)
662
682
  group ? Bundler.require(:default, *(group.split.map! {|g| g.to_sym })) : Bundler.require
663
683
  ARGV.clear
664
684
 
665
- require 'irb'
666
- IRB.start
685
+ preferred = Bundler.settings[:console] || 'irb'
686
+
687
+ # See if console is available
688
+ begin
689
+ require preferred || true
690
+ rescue LoadError
691
+ # Is it in Gemfile?
692
+ Bundler.ui.error "Could not load the #{preferred} console"
693
+ Bundler.ui.info "Falling back on IRB..."
694
+
695
+ require 'irb'
696
+ preferred = 'irb'
697
+ end
698
+
699
+ constant = CONSOLES[preferred]
700
+
701
+ console = begin
702
+ Object.const_get(constant)
703
+ rescue NameError => e
704
+ Bundler.ui.error e.inspect
705
+ Bundler.ui.error "Could not load the #{constant} console"
706
+ return
707
+ end
708
+
709
+ console.start
667
710
  end
668
711
 
669
712
  desc "version", "Prints the bundler's version information"
@@ -892,10 +935,8 @@ module Bundler
892
935
  end
893
936
 
894
937
  def not_found_message(missing_gem_name, alternatives)
938
+ require 'bundler/similarity_detector'
895
939
  message = "Could not find gem '#{missing_gem_name}'."
896
-
897
- # This is called as the result of a GemNotFound, let's see if
898
- # there's any similarly named ones we can propose instead
899
940
  alternate_names = alternatives.map { |a| a.respond_to?(:name) ? a.name : a }
900
941
  suggestions = SimilarityDetector.new(alternate_names).similar_word_list(missing_gem_name)
901
942
  message += "\nDid you mean #{suggestions}?" if suggestions
@@ -1,4 +1,5 @@
1
1
  require 'bundler/dependency'
2
+ require 'bundler/ruby_dsl'
2
3
 
3
4
  module Bundler
4
5
  class Dsl
@@ -15,7 +16,6 @@ module Bundler
15
16
  attr_accessor :dependencies
16
17
 
17
18
  def initialize
18
- @rubygems_source = Source::Rubygems.new
19
19
  @source = nil
20
20
  @sources = []
21
21
  @dependencies = []
@@ -25,12 +25,16 @@ module Bundler
25
25
  @ruby_version = nil
26
26
  end
27
27
 
28
+ def rubygems_source
29
+ @rubygems_source ||= Source::Rubygems.new
30
+ end
31
+
28
32
  def eval_gemfile(gemfile, contents = nil)
29
33
  contents ||= Bundler.read_file(gemfile.to_s)
30
34
  instance_eval(contents, gemfile.to_s, 1)
31
35
  rescue SyntaxError => e
32
- bt = e.message.split("\n")[1..-1]
33
- raise GemfileError, ["Gemfile syntax error:", *bt].join("\n")
36
+ syntax_msg = e.message.gsub("#{gemfile.to_s}:", 'on line ')
37
+ raise GemfileError, "Gemfile syntax error #{syntax_msg}"
34
38
  rescue ScriptError, RegexpError, NameError, ArgumentError => e
35
39
  e.backtrace[0] = "#{e.backtrace[0]}: #{e.message} (#{e.class})"
36
40
  Bundler.ui.warn e.backtrace.join("\n ")
@@ -115,10 +119,10 @@ module Bundler
115
119
  Bundler.ui.warn "The source :#{source} is deprecated because HTTP " \
116
120
  "requests are insecure.\nPlease change your source to 'https://" \
117
121
  "rubygems.org' if possible, or 'http://rubygems.org' if not."
118
- @rubygems_source.add_remote "http://rubygems.org"
122
+ rubygems_source.add_remote "http://rubygems.org"
119
123
  return
120
124
  when String
121
- @rubygems_source.add_remote source
125
+ rubygems_source.add_remote source
122
126
  return
123
127
  else
124
128
  @source = source
@@ -155,7 +159,7 @@ module Bundler
155
159
  end
156
160
 
157
161
  def to_definition(lockfile, unlock)
158
- @sources << @rubygems_source unless @sources.include?(@rubygems_source)
162
+ @sources << rubygems_source unless @sources.include?(rubygems_source)
159
163
  Definition.new(lockfile, @dependencies, @sources, unlock, @ruby_version)
160
164
  end
161
165