bundler 1.0.21 → 1.1.rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. data/.travis.yml +7 -0
  2. data/CHANGELOG.md +153 -1
  3. data/README.md +3 -3
  4. data/Rakefile +15 -27
  5. data/bin/bundle +7 -0
  6. data/bundler.gemspec +1 -1
  7. data/lib/bundler/cli.rb +126 -45
  8. data/lib/bundler/definition.rb +22 -5
  9. data/lib/bundler/dep_proxy.rb +35 -0
  10. data/lib/bundler/dsl.rb +17 -34
  11. data/lib/bundler/endpoint_specification.rb +69 -0
  12. data/lib/bundler/fetcher.rb +221 -0
  13. data/lib/bundler/gem_helper.rb +0 -1
  14. data/lib/bundler/gem_helpers.rb +23 -0
  15. data/lib/bundler/index.rb +77 -38
  16. data/lib/bundler/installer.rb +43 -1
  17. data/lib/bundler/man/bundle-benchmark +19 -0
  18. data/lib/bundler/man/bundle-benchmark.txt +27 -0
  19. data/lib/bundler/man/bundle-config +1 -1
  20. data/lib/bundler/man/bundle-config.txt +3 -3
  21. data/lib/bundler/man/bundle-install +288 -0
  22. data/lib/bundler/man/bundle-install.txt +74 -79
  23. data/lib/bundler/man/bundle-package +1 -1
  24. data/lib/bundler/man/bundle-package.txt +1 -1
  25. data/lib/bundler/man/bundle-update +1 -1
  26. data/lib/bundler/man/bundle-update.txt +41 -41
  27. data/lib/bundler/man/gemfile.5 +6 -7
  28. data/lib/bundler/man/gemfile.5.txt +9 -9
  29. data/lib/bundler/match_platform.rb +13 -0
  30. data/lib/bundler/remote_specification.rb +6 -8
  31. data/lib/bundler/resolver.rb +32 -19
  32. data/lib/bundler/rubygems_ext.rb +2 -86
  33. data/lib/bundler/rubygems_integration.rb +35 -0
  34. data/lib/bundler/runtime.rb +84 -1
  35. data/lib/bundler/source.rb +85 -88
  36. data/lib/bundler/spec_set.rb +2 -0
  37. data/lib/bundler/templates/Executable +1 -1
  38. data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  39. data/lib/bundler/templates/newgem/Rakefile.tt +1 -0
  40. data/lib/bundler/templates/newgem/bin/newgem.tt +1 -1
  41. data/lib/bundler/templates/newgem/gitignore.tt +14 -1
  42. data/lib/bundler/templates/newgem/newgem.gemspec.tt +13 -20
  43. data/lib/bundler/ui.rb +32 -17
  44. data/lib/bundler/vendor/net/http/faster.rb +27 -0
  45. data/lib/bundler/vendor/net/http/persistent.rb +468 -0
  46. data/lib/bundler/version.rb +1 -1
  47. data/lib/bundler.rb +56 -23
  48. data/man/bundle-install.ronn +7 -0
  49. data/man/bundle.ronn +3 -0
  50. data/man/gemfile.5.ronn +6 -6
  51. data/spec/bundler/dsl_spec.rb +22 -0
  52. data/spec/bundler/source_spec.rb +25 -0
  53. data/spec/install/deprecated_spec.rb +2 -3
  54. data/spec/install/gems/dependency_api_spec.rb +358 -0
  55. data/spec/install/gems/flex_spec.rb +1 -1
  56. data/spec/install/gems/groups_spec.rb +17 -8
  57. data/spec/install/gems/platform_spec.rb +16 -0
  58. data/spec/install/gems/post_install_spec.rb +47 -0
  59. data/spec/install/gems/simple_case_spec.rb +61 -64
  60. data/spec/install/gems/standalone_spec.rb +238 -0
  61. data/spec/install/git_spec.rb +62 -0
  62. data/spec/other/check_spec.rb +30 -0
  63. data/spec/other/clean_spec.rb +397 -0
  64. data/spec/other/exec_spec.rb +0 -29
  65. data/spec/other/newgem_spec.rb +39 -0
  66. data/spec/other/outdated_spec.rb +93 -0
  67. data/spec/other/show_spec.rb +6 -0
  68. data/spec/quality_spec.rb +1 -1
  69. data/spec/realworld/edgecases_spec.rb +12 -0
  70. data/spec/runtime/executable_spec.rb +10 -0
  71. data/spec/runtime/require_spec.rb +8 -9
  72. data/spec/runtime/with_clean_env_spec.rb +60 -7
  73. data/spec/spec_helper.rb +8 -1
  74. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
  75. data/spec/support/artifice/endpoint.rb +54 -0
  76. data/spec/support/artifice/endpoint_500.rb +37 -0
  77. data/spec/support/artifice/endpoint_api_missing.rb +16 -0
  78. data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
  79. data/spec/support/artifice/endpoint_extra.rb +27 -0
  80. data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
  81. data/spec/support/artifice/endpoint_fallback.rb +18 -0
  82. data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
  83. data/spec/support/artifice/endpoint_redirect.rb +15 -0
  84. data/spec/support/builders.rb +7 -0
  85. data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
  86. data/spec/support/fakeweb/windows.rb +23 -0
  87. data/spec/support/helpers.rb +36 -3
  88. data/spec/support/path.rb +2 -0
  89. data/spec/support/rubygems_ext.rb +3 -3
  90. metadata +48 -74
data/.travis.yml CHANGED
@@ -7,6 +7,7 @@ script: rake spec:travis
7
7
  rvm:
8
8
  - 1.8.7
9
9
  - 1.9.2
10
+ - 1.9.3
10
11
 
11
12
  env:
12
13
  - RGV=v1.3.6
@@ -26,6 +27,12 @@ matrix:
26
27
  env: RGV=v1.3.7
27
28
  - rvm: 1.9.2
28
29
  env: RGV=v1.4.2
30
+ - rvm: 1.9.3
31
+ env: RGV=v1.3.6
32
+ - rvm: 1.9.3
33
+ env: RGV=v1.3.7
34
+ - rvm: 1.9.3
35
+ env: RGV=v1.4.2
29
36
 
30
37
  notifications:
31
38
  email:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,155 @@
1
+ ## 1.1.rc (Oct 3, 2011)
2
+
3
+ Features:
4
+
5
+ - add `--shebang` option to bundle install (@bensie, #1467)
6
+ - build passes on ruby 1.9.3rc1 (#1458, #1469)
7
+ - hide basic auth credentials for custom sources (#1440, #1463)
8
+
9
+ Bugfixes:
10
+
11
+ - fix index search result caching (#1446, #1466)
12
+ - fix fetcher prints multiple times during install (#1445, #1462)
13
+ - don't mention API errors from non-rubygems.org sources
14
+ - fix autoclean so it doesn't remove bins that are used (#1459, #1460)
15
+
16
+ Documentation:
17
+
18
+ - add :require => [...] to the gemfile(5) manpage (@nono, #1468)
19
+
20
+ ## 1.1.pre.10 (Sep 27, 2011)
21
+
22
+ Features:
23
+
24
+ - `config system_bindir foo` added, works like "-n foo" in your .gemrc file
25
+
26
+ ## 1.1.pre.9 (Sep 18, 2011)
27
+
28
+ Features:
29
+
30
+ - `clean` will now clean up all old .gem and .gemspec files, cleaning up older pres
31
+ - `clean` will be automatically run after bundle install and update when using `--path` (#1420, #1425)
32
+ - `clean` now takes a `--force` option (#1247, #1426)
33
+ - `clean` will clean up cached git dirs in bundle clean (#1390)
34
+ - remove deprecations from DSL (#1119)
35
+ - autorequire tries directories for gems with dashed names (#1205)
36
+ - adds a `--paths` flag to `bundle show` to list all the paths of bundled gems (@tiegz, #1360)
37
+ - load rubygems plugins in the bundle binary (@tpope, #1364)
38
+ - make `--standalone` respect `--path` (@cowboyd, #1361)
39
+
40
+ Bugfixes:
41
+
42
+ - Fix `clean` to handle nested gems in a git repo (#1329)
43
+ - Fix conflict from revert of benchmark tool (@boffbowsh, #1355)
44
+ - Fix fatal error when unable to connect to gem source (#1269)
45
+ - Fix `outdated` to find pre-release gems that are installed. (#1359)
46
+ - Fix color for ui. (#1374)
47
+ - Fix installing to user-owned system gems on OS X
48
+ - Fix caching issue in the resolver (#1353, #1421)
49
+ - Fix :github DSL option
50
+
51
+ ## 1.1.pre.8 (Aug 13, 2011)
52
+
53
+ Bugfixes:
54
+
55
+ - Fix `bundle check` to not print fatal error message (@cldwalker, #1347)
56
+ - Fix require_sudo when Gem.bindir isn't writeable (#1352)
57
+ - Fix not asking Gemcutter API for dependency chain of git gems in --deployment (#1254)
58
+ - Fix `install --binstubs` when using --path (#1332)
59
+
60
+ ## 1.1.pre.7 (Aug 8, 2011)
61
+
62
+ Bugfixes:
63
+
64
+ - Fixed invalid byte sequence error while installing gem on Ruby 1.9 (#1341)
65
+ - Fixed exception when sudo was needed to install gems (@spastorino)
66
+
67
+ ## 1.1.pre.6 (Aug 8, 2011)
68
+
69
+ Bugfixes:
70
+
71
+ - Fix cross repository dependencies (#1138)
72
+ - Fix git dependency fetching from API endpoint (#1254)
73
+ - Fixes for bundle outdated (@joelmoss, #1238)
74
+ - Fix bundle standalone when using the endpoint (#1240)
75
+
76
+ Features:
77
+
78
+ - Implement `to_ary` to avoid calls to method_missing (@tenderlove, #1274)
79
+ - bundle clean removes old .gem files (@cldwalker, #1293)
80
+ - Correcly identify missing child dependency in error message
81
+ - Run pre-install, post-build, and post-install gem hooks for git gems (@warhammerkid, #1120)
82
+ - create Gemfile.lock for empty Gemfile (#1218)
83
+
84
+ ## 1.1.pre.5 (June 11, 2011)
85
+
86
+ Bugfixes:
87
+
88
+ - Fix LazySpecification on Ruby 1.9 (@dpiddy, #1232)
89
+ - Fix HTTP proxy support (@leobessa, #878)
90
+
91
+ Features:
92
+
93
+ - Speed up `install --deployment` by using the API endpoint
94
+ - Support Basic HTTP Auth for the API endpoint (@dpiddy, #1229)
95
+ - Add `install --full-index` to disable the API endpoint, just in case
96
+ - Significantly speed up install by removing unneeded gemspec fetches
97
+ - `outdated` command shows outdated gems (@joelmoss, #1130)
98
+ - Print gem post install messages (@csquared, #1155)
99
+ - Reduce memory use by removing Specification.new inside method_missing (@tenderlove, #1222)
100
+ - Allow `check --path`
101
+
102
+ ## 1.1.pre.4 (May 5, 2011)
103
+
104
+ Bugfixes:
105
+
106
+ - Fix bug that could prevent installing new gems
107
+
108
+ ## 1.1.pre.3 (May 4, 2011)
109
+
110
+ Features:
111
+
112
+ - Add `bundle outdated` to show outdated gems (@joelmoss)
113
+ - Remove BUNDLE_* from `Bundler.with_clean_env` (@wuputah)
114
+ - Add Bundler.clean_system, and clean_exec (@wuputah)
115
+ - Use git config for gem author name and email (@krekoten)
116
+
117
+ Bugfixes:
118
+
119
+ - Fix error calling Bundler.rubygems.gem_path
120
+ - Fix error when Gem.path returns Gem::FS instead of String
121
+
122
+ ## 1.1.pre.2 (April 28, 2011)
123
+
124
+ Features:
125
+
126
+ - Add :github option to Gemfile DSL for easy git repos
127
+ - Merge all fixes from 1.0.12 and 1.0.13
128
+
129
+ ## 1.1.pre.1 (February 2, 2011)
130
+
131
+ Bugfixes:
132
+
133
+ - Compatibility with changes made by Rubygems 1.5
134
+
135
+ ## 1.1.pre (January 21, 2011)
136
+
137
+ Features:
138
+
139
+ - Add bundle clean. Removes unused gems from --path directory
140
+ - Initial Gemcutter Endpoint API work, BAI Fetching source index
141
+ - Added bundle install --standalone
142
+ - Ignore Gemfile.lock when buliding new gems
143
+ - Make it possible to override a .gemspec dependency's source in the
144
+ Gemfile
145
+
146
+ Removed:
147
+
148
+ - Removed bundle lock
149
+ - Removed bundle install <path>
150
+ - Removed bundle install --production
151
+ - Removed bundle install --disable-shared-gems
152
+
1
153
  ## 1.0.21 (September 30, 2011)
2
154
 
3
155
  - No changes from RC
@@ -181,7 +333,7 @@ Bugfixes:
181
333
 
182
334
  - Fix a bug where Bundler.require could remove gems from the load
183
335
  path. In Rails apps with a default application.rb, this removed
184
- all gems in groups other than :default and Rails.env.
336
+ all gems in groups other than :default and Rails.env
185
337
 
186
338
  ## 1.0.8 (January 18, 2011)
187
339
 
data/README.md CHANGED
@@ -12,17 +12,17 @@ See [gembundler.com](http://gembundler.com) for up-to-date installation and usag
12
12
 
13
13
  ### Troubleshooting
14
14
 
15
- For help with common problems, see [ISSUES](http://github.com/carlhuda/bundler/blob/master/ISSUES.md).
15
+ For help with common problems, see [ISSUES](https://github.com/carlhuda/bundler/blob/master/ISSUES.md).
16
16
 
17
17
  ### Development
18
18
 
19
- To see what has changed in recent versions of bundler, see the [CHANGELOG](http://github.com/carlhuda/bundler/blob/master/CHANGELOG.md).
19
+ To see what has changed in recent versions of bundler, see the [CHANGELOG](https://github.com/carlhuda/bundler/blob/master/CHANGELOG.md).
20
20
 
21
21
  The `master` branch contains our current progress towards version 1.1. Because of that, please submit bugfix pull requests against the `1-0-stable` branch.
22
22
 
23
23
  ### Upgrading from Bundler 0.8 to 0.9 and above
24
24
 
25
- See [UPGRADING](http://github.com/carlhuda/bundler/blob/master/UPGRADING.md).
25
+ See [UPGRADING](https://github.com/carlhuda/bundler/blob/master/UPGRADING.md).
26
26
 
27
27
  ### Other questions
28
28
 
data/Rakefile CHANGED
@@ -34,6 +34,13 @@ begin
34
34
  rm_rf 'tmp'
35
35
  end
36
36
 
37
+ desc "Run the real-world spec suite (reequires internet)"
38
+ task :realworld => ["set_realworld", "spec"]
39
+
40
+ task :set_realworld do
41
+ ENV['BUNDLER_REALWORLD_TESTS'] = '1'
42
+ end
43
+
37
44
  desc "Run the spec suite with the sudo tests"
38
45
  task :sudo => ["set_sudo", "spec", "clean_sudo"]
39
46
 
@@ -59,6 +66,7 @@ begin
59
66
  # Create tasks like spec:rubygems:v1.8.3:sudo to run the sudo specs
60
67
  namespace rg do
61
68
  task :sudo => ["set_sudo", rg, "clean_sudo"]
69
+ task :realworld => ["set_realworld", rg]
62
70
  end
63
71
 
64
72
  task "clone_rubygems_#{rg}" do
@@ -96,33 +104,8 @@ begin
96
104
  task "rubygems:all" => "co"
97
105
  end
98
106
 
99
- namespace :ruby do
100
- # Ruby 1.8.6, 1.8.7, and 1.9.2 specs
101
- task "ensure_rvm" do
102
- raise "RVM is not available" unless File.exist?(File.expand_path("~/.rvm/scripts/rvm"))
103
- end
104
-
105
- %w(1.8.6-p420 1.8.7-p334 1.9.2-p180).each do |ruby|
106
- ruby_cmd = File.expand_path("~/.rvm/bin/ruby-#{ruby}")
107
-
108
- desc "Run specs on Ruby #{ruby}"
109
- RSpec::Core::RakeTask.new(ruby) do |t|
110
- t.rspec_opts = %w(-fs --color)
111
- t.ruby_opts = %w(-w)
112
- end
113
-
114
- task "ensure_ruby_#{ruby}" do
115
- raise "Could not find Ruby #{ruby} at #{ruby_cmd}" unless File.exist?(ruby_cmd)
116
- end
117
-
118
- task "ensure_ruby_#{ruby}" => "ensure_rvm"
119
- task ruby => "ensure_ruby_#{ruby}"
120
- task "ruby:all" => ruby
121
- end
122
- end
123
-
124
107
  desc "Run the tests on Travis CI against a rubygem version (using ENV['RGV'])"
125
- task "travis" do
108
+ task :travis do
126
109
  rg = ENV['RGV'] || 'master'
127
110
 
128
111
  puts "\n\e[1;33m[Travis CI] Running bundler specs against rubygems #{rg}\e[m\n\n"
@@ -133,7 +116,12 @@ begin
133
116
  puts "\n\e[1;33m[Travis CI] Running bundler sudo specs against rubygems #{rg}\e[m\n\n"
134
117
  sudos = safe_task { Rake::Task["spec:rubygems:#{rg}:sudo"].invoke }
135
118
 
136
- unless specs && sudos
119
+ Rake::Task["spec:rubygems:#{rg}"].reenable
120
+
121
+ puts "\n\e[1;33m[Travis CI] Running bundler real world specs against rubygems #{rg}\e[m\n\n"
122
+ realworld = safe_task { Rake::Task["spec:rubygems:#{rg}:realworld"].invoke }
123
+
124
+ unless specs && sudos && realworld
137
125
  fail "Bundler tests failed, please review the log for more information"
138
126
  end
139
127
  end
data/bin/bundle CHANGED
@@ -19,4 +19,11 @@ rescue Interrupt => e
19
19
  Bundler.ui.error "\nQuitting..."
20
20
  Bundler.ui.debug e.backtrace.join("\n")
21
21
  exit 1
22
+ rescue SystemExit => e
23
+ exit e.status
24
+ rescue Exception => e
25
+ Bundler.ui.error "Unfortunately, a fatal error has occurred. " +
26
+ "Please report this error to the Bundler issue tracker at " +
27
+ "https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!"
28
+ raise e
22
29
  end
data/bundler.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.rubyforge_project = "bundler"
19
19
 
20
20
  s.add_development_dependency "ronn"
21
- s.add_development_dependency "rspec"
21
+ s.add_development_dependency "rspec", "~> 2.0"
22
22
 
23
23
  # Man files are required because they are ignored by git
24
24
  man_files = Dir.glob("lib/bundler/man/**/*")
data/lib/bundler/cli.rb CHANGED
@@ -92,8 +92,12 @@ module Bundler
92
92
  D
93
93
  method_option "gemfile", :type => :string, :banner =>
94
94
  "Use the specified gemfile instead of Gemfile"
95
+ method_option "path", :type => :string, :banner =>
96
+ "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
95
97
  def check
96
98
  ENV['BUNDLE_GEMFILE'] = File.expand_path(options[:gemfile]) if options[:gemfile]
99
+
100
+ Bundler.settings[:path] = File.expand_path(options[:path]) if options[:path]
97
101
  begin
98
102
  not_installed = Bundler.definition.missing_specs
99
103
  rescue GemNotFound, VersionConflict
@@ -126,8 +130,6 @@ module Bundler
126
130
  D
127
131
  method_option "without", :type => :array, :banner =>
128
132
  "Exclude gems that are part of the specified named group."
129
- method_option "disable-shared-gems", :type => :boolean, :banner =>
130
- "This option is deprecated. Please do not use it."
131
133
  method_option "gemfile", :type => :string, :banner =>
132
134
  "Use the specified gemfile instead of Gemfile"
133
135
  method_option "no-prune", :type => :boolean, :banner =>
@@ -140,6 +142,8 @@ module Bundler
140
142
  "Do not attempt to fetch gems remotely and use the gem cache instead"
141
143
  method_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
142
144
  "Generate bin stubs for bundled gems to ./bin"
145
+ method_option "shebang", :type => :string, :banner =>
146
+ "Specify a different shebang executable name than the default (usually 'ruby')"
143
147
  method_option "path", :type => :string, :banner =>
144
148
  "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
145
149
  method_option "system", :type => :boolean, :banner =>
@@ -148,7 +152,13 @@ module Bundler
148
152
  "Do not allow the Gemfile.lock to be updated after this install"
149
153
  method_option "deployment", :type => :boolean, :banner =>
150
154
  "Install using defaults tuned for deployment environments"
151
- def install(path = nil)
155
+ method_option "standalone", :type => :array, :lazy_default => [], :banner =>
156
+ "Make a bundle that can work without the Bundler runtime"
157
+ method_option "full-index", :tpye => :boolean, :banner =>
158
+ "Use the rubygems modern index instead of the API endpoint"
159
+ method_option "clean", :type => :boolean, :default => true, :banner =>
160
+ "Run bundle clean automatically after clean"
161
+ def install
152
162
  opts = options.dup
153
163
  if opts[:without]
154
164
  opts[:without].map!{|g| g.split(" ") }
@@ -163,28 +173,12 @@ module Bundler
163
173
  # Just disable color in deployment mode
164
174
  Bundler.ui.shell = Thor::Shell::Basic.new if opts[:deployment]
165
175
 
166
- if (path || opts[:path] || opts[:deployment]) && opts[:system]
176
+ if (opts[:path] || opts[:deployment]) && opts[:system]
167
177
  Bundler.ui.error "You have specified both a path to install your gems to, \n" \
168
178
  "as well as --system. Please choose."
169
179
  exit 1
170
180
  end
171
181
 
172
- if path && opts[:path]
173
- Bundler.ui.error "You have specified a path via `bundle install #{path}` as well as\n" \
174
- "by `bundle install --path #{options[:path]}`. These options are\n" \
175
- "equivalent, so please use one or the other."
176
- exit 1
177
- end
178
-
179
- if opts["disable-shared-gems"]
180
- Bundler.ui.error "The disable-shared-gem option is no longer available.\n\n" \
181
- "Instead, use `bundle install` to install to your system,\n" \
182
- "or `bundle install --path path/to/gems` to install to an isolated\n" \
183
- "location. Bundler will resolve relative paths relative to\n" \
184
- "your `Gemfile`."
185
- exit 1
186
- end
187
-
188
182
  if opts[:deployment] || opts[:frozen]
189
183
  unless Bundler.default_lockfile.exist?
190
184
  flag = opts[:deployment] ? '--deployment' : '--frozen'
@@ -206,16 +200,22 @@ module Bundler
206
200
  opts[:system] = true
207
201
  end
208
202
 
209
- Bundler.settings[:path] = nil if opts[:system]
210
- Bundler.settings[:path] = "vendor/bundle" if opts[:deployment]
211
- Bundler.settings[:path] = path if path
212
- Bundler.settings[:path] = opts[:path] if opts[:path]
213
- Bundler.settings[:bin] = opts["binstubs"] if opts[:binstubs]
203
+ # Can't use Bundler.settings for this because settings needs gemfile.dirname
204
+ Bundler.settings[:path] = nil if opts[:system]
205
+ Bundler.settings[:path] = "vendor/bundle" if opts[:deployment]
206
+ Bundler.settings[:path] = opts[:path] if opts[:path]
207
+ Bundler.settings[:path] ||= "bundle" if opts[:standalone]
208
+ Bundler.settings[:bin] = opts["binstubs"] if opts[:binstubs]
209
+ Bundler.settings[:shebang] = opts["shebang"] if opts[:shebang]
214
210
  Bundler.settings[:no_prune] = true if opts["no-prune"]
215
211
  Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? '1' : nil
216
212
  Bundler.settings.without = opts[:without]
217
213
  Bundler.ui.be_quiet! if opts[:quiet]
218
214
 
215
+ Bundler::Fetcher.disable_endpoint = opts["full-index"]
216
+ # rubygems plugins sometimes hook into the gem install process
217
+ Gem.load_plugins if Gem.respond_to?(:load_plugins)
218
+
219
219
  Installer.install(Bundler.root, Bundler.definition, opts)
220
220
  Bundler.load.cache if Bundler.root.join("vendor/cache").exist? && !options["no-cache"]
221
221
 
@@ -228,12 +228,11 @@ module Bundler
228
228
  Bundler.ui.confirm "Your bundle is complete! " +
229
229
  "Use `bundle show [gemname]` to see where a bundled gem is installed."
230
230
  end
231
-
232
- if path
233
- Bundler.ui.warn "The path argument to `bundle install` is deprecated. " +
234
- "It will be removed in version 1.1. " +
235
- "Please use `bundle install --path #{path}` instead."
231
+ Installer.post_install_messages.to_a.each do |name, msg|
232
+ Bundler.ui.confirm "Post-install message from #{name}:\n#{msg}"
236
233
  end
234
+
235
+ clean if opts["clean"] && Bundler.settings[:path]
237
236
  rescue GemNotFound => e
238
237
  if opts[:local] && Bundler.app_cache.exist?
239
238
  Bundler.ui.warn "Some gems seem to be missing from your vendor/cache directory."
@@ -254,6 +253,8 @@ module Bundler
254
253
  method_option "source", :type => :array, :banner => "Update a specific source (and all gems associated with it)"
255
254
  method_option "local", :type => :boolean, :banner =>
256
255
  "Do not attempt to fetch gems remotely and use the gem cache instead"
256
+ method_option "clean", :type => :boolean, :default => true, :banner =>
257
+ "Run bundle clean automatically after clean"
257
258
  def update(*gems)
258
259
  sources = Array(options[:source])
259
260
 
@@ -265,32 +266,32 @@ module Bundler
265
266
  end
266
267
 
267
268
  opts = {"update" => true, "local" => options[:local]}
269
+ # rubygems plugins sometimes hook into the gem install process
270
+ Gem.load_plugins if Gem.respond_to?(:load_plugins)
271
+
268
272
  Installer.install Bundler.root, Bundler.definition, opts
269
273
  Bundler.load.cache if Bundler.root.join("vendor/cache").exist?
274
+ clean if options["clean"] && Bundler.settings[:path]
270
275
  Bundler.ui.confirm "Your bundle is updated! " +
271
276
  "Use `bundle show [gemname]` to see where a bundled gem is installed."
272
277
  end
273
278
 
274
- desc "lock", "Locks the bundle to the current set of dependencies, including all child dependencies."
275
- def lock
276
- Bundler.ui.warn "Lock is deprecated. Your bundle is now locked whenever you run `bundle install`."
277
- end
278
-
279
- desc "unlock", "Unlock the bundle. This allows gem versions to be changed."
280
- def unlock
281
- Bundler.ui.warn "Unlock is deprecated. To update to newer gem versions, use `bundle update`."
282
- end
283
-
284
279
  desc "show [GEM]", "Shows all gems that are part of the bundle, or the path to a given gem"
285
280
  long_desc <<-D
286
281
  Show lists the names and versions of all gems that are required by your Gemfile.
287
282
  Calling show with [GEM] will list the exact location of that gem on your machine.
288
283
  D
284
+ method_option "paths", :type => :boolean,
285
+ :banner => "List the paths of all gems that are required by your Gemfile."
289
286
  def show(gem_name = nil)
290
287
  Bundler.load.lock
291
288
 
292
289
  if gem_name
293
290
  Bundler.ui.info locate_gem(gem_name)
291
+ elsif options[:paths]
292
+ Bundler.load.specs.sort_by { |s| s.name }.each do |s|
293
+ Bundler.ui.info locate_gem(s.name)
294
+ end
294
295
  else
295
296
  Bundler.ui.info "Gems included by the bundle:"
296
297
  Bundler.load.specs.sort_by { |s| s.name }.each do |s|
@@ -300,6 +301,71 @@ module Bundler
300
301
  end
301
302
  map %w(list) => "show"
302
303
 
304
+ desc "outdated [GEM]", "list installed gems with newer versions available"
305
+ long_desc <<-D
306
+ Outdated lists the names and versions of gems that have a newer version available
307
+ in the given source. Calling outdated with [GEM [GEM]] will only check for newer
308
+ versions of the given gems. By default, available prerelease gems will be ignored.
309
+ D
310
+ method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
311
+ method_option "source", :type => :array, :banner => "Check against a specific source"
312
+ method_option "local", :type => :boolean, :banner =>
313
+ "Do not attempt to fetch gems remotely and use the gem cache instead"
314
+ def outdated(*gems)
315
+ sources = Array(options[:source])
316
+ current_specs = Bundler.load.specs
317
+
318
+ if gems.empty? && sources.empty?
319
+ # We're doing a full update
320
+ definition = Bundler.definition(true)
321
+ else
322
+ definition = Bundler.definition(:gems => gems, :sources => sources)
323
+ end
324
+ options["local"] ? definition.resolve_with_cache! : definition.resolve_remotely!
325
+
326
+ Bundler.ui.info ""
327
+ if options["pre"]
328
+ Bundler.ui.info "Outdated gems included in the bundle (including pre-releases):"
329
+ else
330
+ Bundler.ui.info "Outdated gems included in the bundle:"
331
+ end
332
+
333
+ out_count = 0
334
+ definition.specs.each do |spec|
335
+ next if !gems.empty? && !gems.include?(spec.name)
336
+
337
+ spec.source.fetch(spec) if spec.source.respond_to?(:fetch)
338
+
339
+ if spec.source.is_a?(Bundler::Source::Git)
340
+ current = current_specs.find{|s| spec.name == s.name }
341
+ next if current.nil?
342
+ else
343
+ current = spec
344
+ spec = definition.index[current.name].sort_by{|b| b.version }
345
+
346
+ if !current.version.prerelease? && !options[:pre] && spec.size > 1
347
+ spec = spec.delete_if{|b| b.respond_to?(:version) && b.version.prerelease? }
348
+ end
349
+
350
+ spec = spec.last
351
+ next if spec.nil?
352
+ end
353
+
354
+ gem_outdated = Gem::Version.new(spec.version) > Gem::Version.new(current.version)
355
+ git_outdated = current.git_version != spec.git_version
356
+ if gem_outdated || git_outdated
357
+ spec_version = "#{spec.version}#{spec.git_version}"
358
+ current_version = "#{current.version}#{current.git_version}"
359
+ Bundler.ui.info " * #{spec.name} (#{spec_version} > #{current_version})"
360
+ out_count += 1
361
+ end
362
+ Bundler.ui.debug "from #{spec.loaded_from}"
363
+ end
364
+
365
+ Bundler.ui.info " Your bundle is up to date!" if out_count < 1
366
+ Bundler.ui.info ""
367
+ end
368
+
303
369
  desc "cache", "Cache all the gems to vendor/cache", :hide => true
304
370
  method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
305
371
  def cache
@@ -478,12 +544,16 @@ module Bundler
478
544
  constant_name = name.split('_').map{|p| p[0..0].upcase + p[1..-1] }.join
479
545
  constant_name = constant_name.split('-').map{|q| q[0..0].upcase + q[1..-1] }.join('::') if constant_name =~ /-/
480
546
  constant_array = constant_name.split('::')
481
- git_author_name = `git config user.name`.chomp
482
- git_author_email = `git config user.email`.chomp
483
- author_name = git_author_name.empty? ? "TODO: Write your name" : git_author_name
484
- author_email = git_author_email.empty? ? "TODO: Write your email address" : git_author_email
485
547
  FileUtils.mkdir_p(File.join(target, 'lib', name))
486
- opts = {:name => name, :constant_name => constant_name, :constant_array => constant_array, :author_name => author_name, :author_email => author_email}
548
+ git_user_name = `git config user.name`.chomp
549
+ git_user_email = `git config user.email`.chomp
550
+ opts = {
551
+ :name => name,
552
+ :constant_name => constant_name,
553
+ :constant_array => constant_array,
554
+ :author => git_user_name.empty? ? "TODO: Write your name" : git_user_name,
555
+ :email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email
556
+ }
487
557
  template(File.join("newgem/Gemfile.tt"), File.join(target, "Gemfile"), opts)
488
558
  template(File.join("newgem/Rakefile.tt"), File.join(target, "Rakefile"), opts)
489
559
  template(File.join("newgem/gitignore.tt"), File.join(target, ".gitignore"), opts)
@@ -501,6 +571,17 @@ module Bundler
501
571
  File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
502
572
  end
503
573
 
574
+ desc "clean", "Cleans up unused gems in your bundler directory"
575
+ method_option "force", :type => :boolean, :default => false, :banner =>
576
+ "forces clean even if --path is set"
577
+ def clean
578
+ if Bundler.settings[:path] || options[:force]
579
+ Bundler.load.clean
580
+ else
581
+ Bundler.ui.error "Can only use bundle clean when --path is set or --force is set"
582
+ end
583
+ end
584
+
504
585
  private
505
586
 
506
587
  def have_groff?
@@ -141,6 +141,10 @@ module Bundler
141
141
  @locked_specs
142
142
  else
143
143
  last_resolve = converge_locked_specs
144
+
145
+ # Record the specs available in each gem's source, so that those
146
+ # specs will be available later when the resolver knows where to
147
+ # look for that gemspec (or its dependencies)
144
148
  source_requirements = {}
145
149
  dependencies.each do |dep|
146
150
  next unless dep.source
@@ -155,17 +159,30 @@ module Bundler
155
159
 
156
160
  def index
157
161
  @index ||= Index.build do |idx|
158
- @sources.each do |s|
159
- idx.use s.specs
162
+ other_sources = @sources.find_all{|s| !s.is_a?(Bundler::Source::Rubygems) }
163
+ rubygems_sources = @sources.find_all{|s| s.is_a?(Bundler::Source::Rubygems) }
164
+
165
+ dependency_names = @dependencies.dup || []
166
+ dependency_names.map! {|d| d.name }
167
+ other_sources.each do |s|
168
+ source_index = s.specs
169
+ dependency_names += source_index.unmet_dependency_names
170
+ idx.add_source source_index
171
+ end
172
+
173
+ rubygems_sources.each do |s|
174
+ s.dependency_names = dependency_names.uniq if s.is_a?(Bundler::Source::Rubygems)
175
+ idx.add_source s.specs
160
176
  end
161
177
  end
162
178
  end
163
179
 
180
+ # used when frozen is enabled so we can find the bundler
181
+ # spec, even if (say) a git gem is not checked out.
164
182
  def rubygems_index
165
183
  @rubygems_index ||= Index.build do |idx|
166
- @sources.find_all{|s| s.is_a?(Source::Rubygems) }.each do |s|
167
- idx.use s.specs
168
- end
184
+ rubygems = @sources.find{|s| s.is_a?(Source::Rubygems) }
185
+ idx.add_source rubygems.specs
169
186
  end
170
187
  end
171
188
 
@@ -0,0 +1,35 @@
1
+ module Bundler
2
+ class DepProxy
3
+
4
+ attr_reader :required_by, :__platform, :dep
5
+
6
+ def initialize(dep, platform)
7
+ @dep, @__platform, @required_by = dep, platform, []
8
+ end
9
+
10
+ def hash
11
+ @hash ||= dep.hash
12
+ end
13
+
14
+ def ==(o)
15
+ dep == o.dep && __platform == o.__platform
16
+ end
17
+
18
+ alias eql? ==
19
+
20
+ def type
21
+ @dep.type
22
+ end
23
+
24
+ def to_s
25
+ "#{name} (#{requirement}) #{__platform}"
26
+ end
27
+
28
+ private
29
+
30
+ def method_missing(*args)
31
+ @dep.send(*args)
32
+ end
33
+
34
+ end
35
+ end