bundler 1.1.rc → 1.1.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.

@@ -1,3 +1,29 @@
1
+ ## 1.1.rc.2 (Dec 6, 2011)
2
+
3
+ Features:
4
+
5
+ - Added README.md to `newgem` (@ognevsky, #1574)
6
+ - Added LICENSE (MIT) to newgem (@ognevsky, #1571)
7
+
8
+ Bugfixes:
9
+
10
+ - only auto-namespace requires for implied requires (#1531)
11
+ - fix bundle clean output for git repos (#1473)
12
+ - use Gem.bindir for bundle clean (#1544, #1532)
13
+ - use `Gem.load_env_plugins` instead of `Gem.load_env_plugins` (#1500, #1543)
14
+ - differentiate Ruby 2.0 (trunk) from Ruby 1.9 (@tenderlove, #1539)
15
+ - `bundle clean` handles 7 length git hash for bundle clean (#1490, #1491)
16
+ - fix Psych loading issues
17
+ - Search $PATH for a binary rather than shelling out to `which` (@tenderlove, #1573)
18
+ - do not clear RG cache unless we actually modify GEM_PATH and GEM_HOME- use `Gem.load_env_plugins` instead of `Gem.load_env_plugins` (#1500, #1543)
19
+ - `newgem` now uses https://rubygems.org (#1562)
20
+ - `bundle init` now uses https://rubygems.org (@jjb, #1522)
21
+ - `bundle install/update` does not autoclean when using --path for semver
22
+
23
+ Documentation:
24
+
25
+ - added documentation for --shebang option for `bundle install` (@lunks, #1475, #1558)
26
+
1
27
  ## 1.1.rc (Oct 3, 2011)
2
28
 
3
29
  Features:
data/ISSUES.md CHANGED
@@ -1,15 +1,5 @@
1
1
  # Bundler Issues
2
2
 
3
- ## Frequently encountered issues
4
-
5
- ### REE and Zlib::GzipFile::Error
6
-
7
- Ruby Enterprise Edition users may see a `Zlib::GzipFile::Error` while installing gems. It is due to [a bug in REE](http://code.google.com/p/rubyenterpriseedition/issues/detail?id=45). You may be able to resolve the issue by upgrading REE, or changing to a different interpreter.
8
-
9
- ### Rake activation error
10
-
11
- Anyone who has installed the Spork gem may see activation errors while running `rake` directly. This is because old versions of Spork would [install the newest rake using a mkmf file](https://github.com/timcharper/spork/issues/119). To resolve the issue, update the Spork version requirement in your Gemfile to at least `"~>0.8.5"` or `"~>0.9.0.rc8"`.
12
-
13
3
  ## Troubleshooting
14
4
 
15
5
  Instructions for common Bundler use-cases can be found on the [Bundler documentation site](http://gembundler.com/v1.0/).
@@ -36,6 +26,21 @@ After reading the documentation, try these troubleshooting steps:
36
26
  # try to install one more time
37
27
  bundle install
38
28
 
29
+ ## Frequently encountered issues
30
+
31
+ ### Heroku errors
32
+
33
+ Open a ticket with Heroku. If the issue somehow turns out to be with Bundler itself, the Heroku support team will forward the details of your issue to us.
34
+
35
+ ### REE and Zlib::GzipFile::Error
36
+
37
+ Ruby Enterprise Edition users may see a `Zlib::GzipFile::Error` while installing gems. It is due to [a bug in REE](http://code.google.com/p/rubyenterpriseedition/issues/detail?id=45). You may be able to resolve the issue by upgrading REE, or changing to a different interpreter.
38
+
39
+ ### Rake activation error
40
+
41
+ Anyone who has installed the Spork gem may see activation errors while running `rake` directly. This is because old versions of Spork would [install the newest rake using a mkmf file](https://github.com/timcharper/spork/issues/119). To resolve the issue, update the Spork version requirement in your Gemfile to at least `"~>0.8.5"` or `"~>0.9.0.rc8"`.
42
+
43
+
39
44
  ## Reporting unresolved problems
40
45
 
41
46
  Instructions that allow the Bundler team to reproduce your issue are vitally important. When you report a bug, please include the following information:
data/bin/bundle CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ require 'bundler'
2
3
  begin
3
- require 'bundler'
4
4
  # Check if an older version of bundler is installed
5
5
  $:.each do |path|
6
6
  if path =~ %r'/bundler-0.(\d+)' && $1.to_i < 9
@@ -1,14 +1,7 @@
1
1
  require 'rbconfig'
2
2
  require 'fileutils'
3
3
  require 'pathname'
4
-
5
- begin
6
- # Pull in Psych if we can, but not if Syck is already loaded
7
- require 'psych' unless defined?(Syck)
8
- rescue LoadError
9
- end
10
-
11
- require 'yaml'
4
+ require 'bundler/psyched_yaml'
12
5
  require 'bundler/rubygems_ext'
13
6
  require 'bundler/rubygems_integration'
14
7
  require 'bundler/version'
@@ -236,7 +229,7 @@ module Bundler
236
229
 
237
230
  path = bundle_path
238
231
  path = path.parent until path.exist?
239
- sudo_present = !(`which sudo` rescue '').empty?
232
+ sudo_present = which "sudo"
240
233
  bin_dir = Pathname.new(Bundler.system_bindir)
241
234
  bin_dir = bin_dir.parent until bin_dir.exist?
242
235
 
@@ -253,6 +246,17 @@ module Bundler
253
246
  end
254
247
  end
255
248
 
249
+ def which(executable)
250
+ if File.executable?(executable)
251
+ executable
252
+ else
253
+ path = ENV['PATH'].split(File::PATH_SEPARATOR).find { |path|
254
+ File.executable?(File.join(path, executable))
255
+ }
256
+ path && File.expand_path(executable, path)
257
+ end
258
+ end
259
+
256
260
  def sudo(str)
257
261
  `sudo -p 'Enter your password to install the bundled RubyGems to your system: ' #{str}`
258
262
  end
@@ -278,7 +282,7 @@ module Bundler
278
282
  msg << " from\n #{original_line}" if original_line
279
283
  msg << "\n"
280
284
 
281
- if RUBY_VERSION >= "1.9.0"
285
+ if RUBY_VERSION >= "1.9"
282
286
  msg << "\nDoes it try to require a relative path? That doesn't work in Ruby 1.9."
283
287
  end
284
288
 
@@ -294,17 +298,20 @@ module Bundler
294
298
  if settings[:disable_shared_gems]
295
299
  ENV['GEM_PATH'] = ''
296
300
  ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
301
+ # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
302
+ FileUtils.mkdir_p bundle_path.to_s rescue nil
303
+
304
+ Bundler.rubygems.clear_paths
297
305
  elsif Bundler.rubygems.gem_dir != bundle_path.to_s
298
306
  possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
299
307
  paths = possibles.flatten.compact.uniq.reject { |p| p.empty? }
300
308
  ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
301
309
  ENV["GEM_HOME"] = bundle_path.to_s
302
- end
310
+ # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
311
+ FileUtils.mkdir_p bundle_path.to_s rescue nil
303
312
 
304
- # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
305
- FileUtils.mkdir_p bundle_path.to_s rescue nil
306
-
307
- Bundler.rubygems.clear_paths
313
+ Bundler.rubygems.clear_paths
314
+ end
308
315
  end
309
316
 
310
317
  def upgrade_lockfile
@@ -154,10 +154,10 @@ module Bundler
154
154
  "Install using defaults tuned for deployment environments"
155
155
  method_option "standalone", :type => :array, :lazy_default => [], :banner =>
156
156
  "Make a bundle that can work without the Bundler runtime"
157
- method_option "full-index", :tpye => :boolean, :banner =>
157
+ method_option "full-index", :type => :boolean, :banner =>
158
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"
159
+ method_option "clean", :type => :boolean, :banner =>
160
+ "Run bundle clean automatically after install"
161
161
  def install
162
162
  opts = options.dup
163
163
  if opts[:without]
@@ -211,10 +211,11 @@ module Bundler
211
211
  Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? '1' : nil
212
212
  Bundler.settings.without = opts[:without]
213
213
  Bundler.ui.be_quiet! if opts[:quiet]
214
+ Bundler.settings[:clean] = opts[:clean] if opts[:clean]
214
215
 
215
216
  Bundler::Fetcher.disable_endpoint = opts["full-index"]
216
217
  # rubygems plugins sometimes hook into the gem install process
217
- Gem.load_plugins if Gem.respond_to?(:load_plugins)
218
+ Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins)
218
219
 
219
220
  Installer.install(Bundler.root, Bundler.definition, opts)
220
221
  Bundler.load.cache if Bundler.root.join("vendor/cache").exist? && !options["no-cache"]
@@ -232,7 +233,7 @@ module Bundler
232
233
  Bundler.ui.confirm "Post-install message from #{name}:\n#{msg}"
233
234
  end
234
235
 
235
- clean if opts["clean"] && Bundler.settings[:path]
236
+ clean if Bundler.settings[:clean] && Bundler.settings[:path]
236
237
  rescue GemNotFound => e
237
238
  if opts[:local] && Bundler.app_cache.exist?
238
239
  Bundler.ui.warn "Some gems seem to be missing from your vendor/cache directory."
@@ -253,8 +254,6 @@ module Bundler
253
254
  method_option "source", :type => :array, :banner => "Update a specific source (and all gems associated with it)"
254
255
  method_option "local", :type => :boolean, :banner =>
255
256
  "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"
258
257
  def update(*gems)
259
258
  sources = Array(options[:source])
260
259
 
@@ -267,11 +266,11 @@ module Bundler
267
266
 
268
267
  opts = {"update" => true, "local" => options[:local]}
269
268
  # rubygems plugins sometimes hook into the gem install process
270
- Gem.load_plugins if Gem.respond_to?(:load_plugins)
269
+ Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins)
271
270
 
272
271
  Installer.install Bundler.root, Bundler.definition, opts
273
272
  Bundler.load.cache if Bundler.root.join("vendor/cache").exist?
274
- clean if options["clean"] && Bundler.settings[:path]
273
+ clean if Bundler.settings[:clean] && Bundler.settings[:path]
275
274
  Bundler.ui.confirm "Your bundle is updated! " +
276
275
  "Use `bundle show [gemname]` to see where a bundled gem is installed."
277
276
  end
@@ -415,6 +414,9 @@ module Bundler
415
414
  Bundler.ui.error "bundler: command not found: #{ARGV.first}"
416
415
  Bundler.ui.warn "Install missing gem executables with `bundle install`"
417
416
  exit 127
417
+ rescue ArgumentError
418
+ Bundler.ui.error "bundle exec needs a command to run"
419
+ exit 128
418
420
  end
419
421
  end
420
422
 
@@ -556,6 +558,8 @@ module Bundler
556
558
  }
557
559
  template(File.join("newgem/Gemfile.tt"), File.join(target, "Gemfile"), opts)
558
560
  template(File.join("newgem/Rakefile.tt"), File.join(target, "Rakefile"), opts)
561
+ template(File.join("newgem/LICENSE.tt"), File.join(target, "LICENSE"), opts)
562
+ template(File.join("newgem/README.md.tt"), File.join(target, "README.md"), opts)
559
563
  template(File.join("newgem/gitignore.tt"), File.join(target, ".gitignore"), opts)
560
564
  template(File.join("newgem/newgem.gemspec.tt"), File.join(target, "#{name}.gemspec"), opts)
561
565
  template(File.join("newgem/lib/newgem.rb.tt"), File.join(target, "lib/#{name}.rb"), opts)
@@ -579,6 +583,7 @@ module Bundler
579
583
  Bundler.load.clean
580
584
  else
581
585
  Bundler.ui.error "Can only use bundle clean when --path is set or --force is set"
586
+ exit 1
582
587
  end
583
588
  end
584
589
 
@@ -21,6 +21,14 @@ module Bundler
21
21
  @dep.type
22
22
  end
23
23
 
24
+ def name
25
+ @dep.name
26
+ end
27
+
28
+ def requirement
29
+ @dep.requirement
30
+ end
31
+
24
32
  def to_s
25
33
  "#{name} (#{requirement}) #{__platform}"
26
34
  end
@@ -87,7 +87,7 @@ module Bundler
87
87
  end
88
88
 
89
89
  def ruby_19?
90
- ruby? && RUBY_VERSION >= "1.9"
90
+ ruby? && RUBY_VERSION >= "1.9" && RUBY_VERSION < "2.0"
91
91
  end
92
92
 
93
93
  def mri?
@@ -99,7 +99,7 @@ module Bundler
99
99
  end
100
100
 
101
101
  def mri_19?
102
- mri? && RUBY_VERSION >= "1.9"
102
+ mri? && RUBY_VERSION >= "1.9" && RUBY_VERSION < "2.0"
103
103
  end
104
104
 
105
105
  def rbx?
@@ -133,7 +133,7 @@ module Bundler
133
133
  begin
134
134
  Bundler.ui.debug "Fetching from: #{uri}"
135
135
  response = @@connection.request(uri)
136
- rescue SocketError, Timeout, Net::HTTP::Persistent::Error
136
+ rescue SocketError, Timeout::Error, Net::HTTP::Persistent::Error
137
137
  raise Bundler::HTTPError, "Network error while fetching #{uri}"
138
138
  end
139
139
 
@@ -172,7 +172,7 @@ module Bundler
172
172
  raise GemspecError, %{Unfortunately, the gem #{s[:name]} (#{s[:number]}) } +
173
173
  %{has an invalid gemspec. As a result, Bundler cannot install this Gemfile. } +
174
174
  %{Please ask the gem author to yank the bad version to fix this issue. For } +
175
- %{more information, see http://bit.ly/illformed-requirement.}
175
+ %{more information, see http://bit.ly/syck-defaultkey.}
176
176
  else
177
177
  raise e
178
178
  end
@@ -130,7 +130,8 @@ module Bundler
130
130
  end
131
131
 
132
132
  def search_by_dependency(dependency, base = nil)
133
- @cache[dependency.hash^base.hash] ||= begin
133
+ @cache[base || false] ||= {}
134
+ @cache[base || false][dependency] ||= begin
134
135
  specs = specs_by_name(dependency.name) + (base || [])
135
136
  found = specs.select do |spec|
136
137
  if base # allow all platforms when searching from a lockfile
@@ -0,0 +1,15 @@
1
+ # Psych could be a gem
2
+ begin
3
+ gem 'psych'
4
+ rescue Gem::LoadError
5
+ end if defined?(Gem)
6
+
7
+ # Psych could be a stdlib
8
+ begin
9
+ # it's too late if Syck is already loaded
10
+ require 'psych' unless defined?(Syck)
11
+ rescue LoadError
12
+ end
13
+
14
+ # Psych might NOT EXIST AT ALL
15
+ require 'yaml'
@@ -255,14 +255,9 @@ module Bundler
255
255
  # by monkeypatching it into the method in Rubygems 1.3.6 and 1.3.7.
256
256
  def backport_segment_generation
257
257
  Gem::Version.send(:define_method, :segments) do
258
- @segments_generated ||= false
259
- unless @segments_generated
260
- @segments ||= @version.scan(/[0-9a-z]+/i).map do |s|
261
- /^\d+$/ =~ s ? s.to_i : s
262
- end
258
+ @segments ||= @version.scan(/[0-9]+|[a-z]+/i).map do |s|
259
+ /^\d+$/ =~ s ? s.to_i : s
263
260
  end
264
- @segments_generated = true
265
- @segments
266
261
  end
267
262
  end
268
263
 
@@ -68,9 +68,7 @@ module Bundler
68
68
  Kernel.require file
69
69
  end
70
70
  rescue LoadError => e
71
- REGEXPS.find { |r| r =~ e.message }
72
-
73
- if dep.name.include?('-')
71
+ if dep.autorequire.nil? && dep.name.include?('-')
74
72
  begin
75
73
  namespaced_file = dep.name.gsub('-', '/')
76
74
  Kernel.require namespaced_file
@@ -79,6 +77,7 @@ module Bundler
79
77
  raise if dep.autorequire || $1.gsub('-', '/') != namespaced_file
80
78
  end
81
79
  else
80
+ REGEXPS.find { |r| r =~ e.message }
82
81
  raise if dep.autorequire || $1 != required_file
83
82
  end
84
83
  end
@@ -146,10 +145,10 @@ module Bundler
146
145
  specs.each do |spec|
147
146
  spec_gem_paths << spec.full_gem_path
148
147
  # need to check here in case gems are nested like for the rails git repo
149
- md = %r{(.+bundler/gems/.+-[a-f0-9]{12})}.match(spec.full_gem_path)
148
+ md = %r{(.+bundler/gems/.+-[a-f0-9]{7,12})}.match(spec.full_gem_path)
150
149
  spec_git_paths << md[1] if md
151
150
  spec_gem_executables << spec.executables.collect do |executable|
152
- "#{Gem.dir}/#{spec.bindir}/#{executable}"
151
+ "#{Bundler.rubygems.gem_bindir}/#{executable}"
153
152
  end
154
153
  spec_cache_paths << spec.cache_file
155
154
  spec_gemspec_paths << spec.spec_file
@@ -185,10 +184,9 @@ module Bundler
185
184
  FileUtils.rm_rf(gem_dir)
186
185
 
187
186
  parts = full_name.split('-')
188
- name = parts[0..-3].join('-')
187
+ name = parts[0..-2].join('-')
189
188
  revision = parts[-1]
190
- version = parts[-2]
191
- output = "#{name} (#{version} #{revision})"
189
+ output = "#{name} (#{revision})"
192
190
 
193
191
  Bundler.ui.info "Removing #{output}"
194
192
 
@@ -1,4 +1,4 @@
1
1
  # A sample Gemfile
2
- source "http://rubygems.org"
2
+ source "https://rubygems.org"
3
3
 
4
4
  # gem "rails"
@@ -1,4 +1,4 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in <%=config[:name]%>.gemspec
4
4
  gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) <%=Time.now.year%> <%=config[:author]%>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # <%=config[:constant_name]%>
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem '<%=config[:name]%>'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install <%=config[:name]%>
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -2,5 +2,5 @@ module Bundler
2
2
  # We're doing this because we might write tests that deal
3
3
  # with other versions of bundler and we are unsure how to
4
4
  # handle this better.
5
- VERSION = "1.1.rc" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.1.rc.2" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -70,6 +70,11 @@ update process below under [CONSERVATIVE UPDATING][].
70
70
  a `bin/rails` executable that ensures that all dependencies used
71
71
  come from the bundled gems.
72
72
 
73
+ * `--shebang ruby-install-name`:
74
+ Uses the ruby executable (usually `ruby`) provided to execute the scripts created
75
+ with --binstubs. For instance, if you use --binstubs with `--shebang jruby`,
76
+ all executables will be created to use jruby instead.
77
+
73
78
  * `--standalone[=<list>]`:
74
79
  Make a bundle that can work without Ruby Gems or Bundler at runtime.
75
80
  It takes a space separated list of groups to install. It creates a
@@ -32,7 +32,7 @@ describe "bundle clean" do
32
32
 
33
33
  gem "thin"
34
34
  G
35
- bundle "install --no-clean"
35
+ bundle "install"
36
36
 
37
37
  bundle :clean
38
38
 
@@ -60,7 +60,7 @@ describe "bundle clean" do
60
60
  gem "rack", "1.0.0"
61
61
  gem "foo"
62
62
  G
63
- bundle "install --no-clean"
63
+ bundle "install"
64
64
 
65
65
  bundle :clean
66
66
 
@@ -88,7 +88,7 @@ describe "bundle clean" do
88
88
  gem "rack", "0.9.1"
89
89
  gem "foo"
90
90
  G
91
- bundle "install --no-clean"
91
+ bundle "install"
92
92
 
93
93
  bundle :clean
94
94
 
@@ -111,8 +111,8 @@ describe "bundle clean" do
111
111
  end
112
112
  G
113
113
 
114
- bundle "install --path vendor/bundle --no-clean"
115
- bundle "install --without test_group --no-clean"
114
+ bundle "install --path vendor/bundle"
115
+ bundle "install --without test_group"
116
116
  bundle :clean
117
117
 
118
118
  out.should eq("Removing rack (1.0.0)")
@@ -137,7 +137,7 @@ describe "bundle clean" do
137
137
  end
138
138
  G
139
139
 
140
- bundle "install --path vendor/bundle --no-clean"
140
+ bundle "install --path vendor/bundle"
141
141
 
142
142
  bundle :clean
143
143
 
@@ -146,9 +146,9 @@ describe "bundle clean" do
146
146
  end
147
147
 
148
148
  it "removes unused git gems" do
149
- build_git "foo"
150
- revision = revision_for(lib_path("foo-1.0"))
151
- git_path = lib_path('foo-1.0')
149
+ build_git "foo", :path => lib_path("foo")
150
+ git_path = lib_path('foo')
151
+ revision = revision_for(git_path)
152
152
 
153
153
  gemfile <<-G
154
154
  source "file://#{gem_repo1}"
@@ -159,23 +159,23 @@ describe "bundle clean" do
159
159
  end
160
160
  G
161
161
 
162
- bundle "install --path vendor/bundle --no-clean"
162
+ bundle "install --path vendor/bundle"
163
163
 
164
164
  gemfile <<-G
165
165
  source "file://#{gem_repo1}"
166
166
 
167
167
  gem "rack", "1.0.0"
168
168
  G
169
- bundle "install --no-clean"
169
+ bundle "install"
170
170
 
171
171
  bundle :clean
172
172
 
173
- out.should eq("Removing foo (1.0 #{revision[0..11]})")
173
+ out.should eq("Removing foo (#{revision[0..11]})")
174
174
 
175
175
  vendored_gems("gems/rack-1.0.0").should exist
176
- vendored_gems("bundler/gems/foo-1.0-#{revision[0..11]}").should_not exist
176
+ vendored_gems("bundler/gems/foo-#{revision[0..11]}").should_not exist
177
177
  digest = Digest::SHA1.hexdigest(git_path.to_s)
178
- vendored_gems("cache/bundler/git/foo-1.0-#{digest}").should_not exist
178
+ vendored_gems("cache/bundler/git/foo-#{digest}").should_not exist
179
179
 
180
180
  vendored_gems("specifications/rack-1.0.0.gemspec").should exist
181
181
 
@@ -183,31 +183,31 @@ describe "bundle clean" do
183
183
  end
184
184
 
185
185
  it "removes old git gems" do
186
- build_git "foo"
187
- revision = revision_for(lib_path("foo-1.0"))
186
+ build_git "foo-bar", :path => lib_path("foo-bar")
187
+ revision = revision_for(lib_path("foo-bar"))
188
188
 
189
189
  gemfile <<-G
190
190
  source "file://#{gem_repo1}"
191
191
 
192
192
  gem "rack", "1.0.0"
193
- git "#{lib_path('foo-1.0')}" do
194
- gem "foo"
193
+ git "#{lib_path('foo-bar')}" do
194
+ gem "foo-bar"
195
195
  end
196
196
  G
197
197
 
198
- bundle "install --path vendor/bundle --no-clean"
198
+ bundle "install --path vendor/bundle"
199
199
 
200
- update_git "foo"
201
- revision2 = revision_for(lib_path("foo-1.0"))
200
+ update_git "foo", :path => lib_path("foo-bar")
201
+ revision2 = revision_for(lib_path("foo-bar"))
202
202
 
203
- bundle "update --no-clean"
203
+ bundle "update"
204
204
  bundle :clean
205
205
 
206
- out.should eq("Removing foo (1.0 #{revision[0..11]})")
206
+ out.should eq("Removing foo-bar (#{revision[0..11]})")
207
207
 
208
208
  vendored_gems("gems/rack-1.0.0").should exist
209
- vendored_gems("bundler/gems/foo-1.0-#{revision[0..11]}").should_not exist
210
- vendored_gems("bundler/gems/foo-1.0-#{revision2[0..11]}").should exist
209
+ vendored_gems("bundler/gems/foo-bar-#{revision[0..11]}").should_not exist
210
+ vendored_gems("bundler/gems/foo-bar-#{revision2[0..11]}").should exist
211
211
 
212
212
  vendored_gems("specifications/rack-1.0.0.gemspec").should exist
213
213
 
@@ -225,7 +225,7 @@ describe "bundle clean" do
225
225
  gem "activesupport", :git => "#{lib_path('rails')}", :ref => '#{revision}'
226
226
  G
227
227
 
228
- bundle "install --path vendor/bundle --no-clean"
228
+ bundle "install --path vendor/bundle"
229
229
  bundle :clean
230
230
  out.should eq("")
231
231
 
@@ -239,8 +239,9 @@ describe "bundle clean" do
239
239
  gem "rack", "1.0.0"
240
240
  G
241
241
 
242
- bundle :clean
242
+ bundle :clean, :exitstatus => true
243
243
 
244
+ exitstatus.should eq(1)
244
245
  out.should == "Can only use bundle clean when --path is set or --force is set"
245
246
  end
246
247
 
@@ -253,14 +254,14 @@ describe "bundle clean" do
253
254
  gem "foo"
254
255
  G
255
256
 
256
- bundle "install --path vendor/bundle --no-clean"
257
+ bundle "install --path vendor/bundle"
257
258
 
258
259
  gemfile <<-G
259
260
  source "file://#{gem_repo1}"
260
261
 
261
262
  gem "foo"
262
263
  G
263
- bundle "install --no-clean"
264
+ bundle "install"
264
265
 
265
266
  FileUtils.rm(vendored_gems("bin/rackup"))
266
267
  FileUtils.rm_rf(vendored_gems("gems/thin-1.0"))
@@ -295,27 +296,47 @@ describe "bundle clean" do
295
296
  out.should include("thin (1.0)")
296
297
  end
297
298
 
298
- it "--clean should override the bundle setting" do
299
+ it "--clean should override the bundle setting on install" do
299
300
  gemfile <<-G
300
301
  source "file://#{gem_repo1}"
301
302
 
302
303
  gem "thin"
303
304
  gem "rack"
304
305
  G
305
- bundle "install --path vendor/bundle --no-clean"
306
+ bundle "install --path vendor/bundle --clean"
306
307
 
307
308
  gemfile <<-G
308
309
  source "file://#{gem_repo1}"
309
310
 
310
311
  gem "rack"
311
312
  G
312
- bundle "install --clean"
313
+ bundle "install"
313
314
 
314
315
  should_have_gems 'rack-1.0.0'
315
316
  should_not_have_gems 'thin-1.0'
316
317
  end
317
318
 
318
- it "clean automatically on --path" do
319
+ it "--clean should override the bundle setting on update" do
320
+ build_repo2
321
+
322
+ gemfile <<-G
323
+ source "file://#{gem_repo2}"
324
+
325
+ gem "foo"
326
+ G
327
+ bundle "install --path vendor/bundle --clean"
328
+
329
+ update_repo2 do
330
+ build_gem 'foo', '1.0.1'
331
+ end
332
+
333
+ bundle "update"
334
+
335
+ should_have_gems 'foo-1.0.1'
336
+ should_not_have_gems 'foo-1.0'
337
+ end
338
+
339
+ it "does not clean automatically on --path" do
319
340
  gemfile <<-G
320
341
  source "file://#{gem_repo1}"
321
342
 
@@ -331,11 +352,10 @@ describe "bundle clean" do
331
352
  G
332
353
  bundle "install"
333
354
 
334
- should_have_gems 'rack-1.0.0'
335
- should_not_have_gems 'thin-1.0'
355
+ should_have_gems 'rack-1.0.0', 'thin-1.0'
336
356
  end
337
357
 
338
- it "cleans on bundle update with --path" do
358
+ it "does not clean on bundle update with --path" do
339
359
  build_repo2
340
360
 
341
361
  gemfile <<-G
@@ -350,7 +370,7 @@ describe "bundle clean" do
350
370
  end
351
371
 
352
372
  bundle :update
353
- should_not_have_gems 'foo-1.0'
373
+ should_have_gems 'foo-1.0', 'foo-1.0.1'
354
374
  end
355
375
 
356
376
  it "does not clean on bundle update when using --system" do
@@ -394,4 +414,58 @@ describe "bundle clean" do
394
414
  out.should_not include("foo (1.0)")
395
415
  out.should include("rack (1.0.0)")
396
416
  end
417
+
418
+ it "cleans git gems with a 7 length git revision" do
419
+ build_git "foo"
420
+ revision = revision_for(lib_path("foo-1.0"))
421
+
422
+ gemfile <<-G
423
+ source "file://#{gem_repo1}"
424
+
425
+ gem "foo", :git => "#{lib_path('foo-1.0')}"
426
+ G
427
+
428
+ bundle "install --path vendor/bundle"
429
+
430
+ # mimic 7 length git revisions in Gemfile.lock
431
+ gemfile_lock = File.read(bundled_app('Gemfile.lock')).split("\n")
432
+ gemfile_lock.each_with_index do |line, index|
433
+ gemfile_lock[index] = line[0..(11 + 7)] if line.include?(" revision:")
434
+ end
435
+ File.open(bundled_app('Gemfile.lock'), 'w') do |file|
436
+ file.print gemfile_lock.join("\n")
437
+ end
438
+
439
+ bundle "install --path vendor/bundle"
440
+
441
+ bundle :clean
442
+
443
+ out.should_not include("Removing foo (1.0 #{revision[0..6]})")
444
+
445
+ vendored_gems("bundler/gems/foo-1.0-#{revision[0..6]}").should exist
446
+ end
447
+
448
+ it "when using --force on system gems, it doesn't remove binaries" do
449
+ build_repo2
450
+ update_repo2 do
451
+ build_gem 'bindir' do |s|
452
+ s.bindir = "exe"
453
+ s.executables = "foo"
454
+ end
455
+ end
456
+
457
+ gemfile <<-G
458
+ source "file://#{gem_repo2}"
459
+
460
+ gem "bindir"
461
+ G
462
+ bundle :install
463
+
464
+ bundle "clean --force"
465
+
466
+ sys_status "foo"
467
+
468
+ exitstatus.should == 0
469
+ out.should == "1.0"
470
+ end
397
471
  end
@@ -121,6 +121,16 @@ describe "bundle exec" do
121
121
  out.should include("bundler: not executable: ./foo")
122
122
  end
123
123
 
124
+ it "errors nicely when no arguments are passed" do
125
+ install_gemfile <<-G
126
+ gem "rack"
127
+ G
128
+
129
+ bundle "exec", :exitstatus => true
130
+ # exitstatus.should eq(128)
131
+ out.should include("bundle exec needs a command to run")
132
+ end
133
+
124
134
  describe "with gem executables" do
125
135
  describe "run from a random directory" do
126
136
  before(:each) do
@@ -1,12 +1,50 @@
1
+ require 'spec_helper'
2
+
1
3
  describe "real world edgecases", :realworld => true do
2
- if RUBY_VERSION < "1.9"
3
- # there is no rbx-relative-require gem that will install on 1.9
4
- it "ignores extra gems with bad platforms" do
5
- install_gemfile <<-G
6
- source :rubygems
7
- gem "linecache", "0.46"
8
- G
9
- err.should eq("")
10
- end
4
+ # there is no rbx-relative-require gem that will install on 1.9
5
+ it "ignores extra gems with bad platforms", :ruby => "1.8" do
6
+ install_gemfile <<-G
7
+ source :rubygems
8
+ gem "linecache", "0.46"
9
+ G
10
+ err.should eq("")
11
+ end
12
+
13
+ # https://github.com/carlhuda/bundler/issues/1202
14
+ it "bundle cache works with rubygems 1.3.7 and pre gems" do
15
+ install_gemfile <<-G
16
+ source :rubygems
17
+ gem "rack", "1.3.0.beta2"
18
+ G
19
+ bundle :cache
20
+ out.should_not include("Removing outdated .gem files from vendor/cache")
21
+ end
22
+
23
+ # https://github.com/carlhuda/bundler/issues/1486
24
+ # this is a hash collision that only manifests on 1.8.7
25
+ it "finds the correct child versions" do
26
+ install_gemfile <<-G
27
+ source :rubygems
28
+
29
+ gem 'i18n', '~> 0.4'
30
+ gem 'activesupport', '~> 3.0'
31
+ gem 'activerecord', '~> 3.0'
32
+ gem 'builder', '~> 2.1.2'
33
+ G
34
+ out.should include("activemodel (3.0.5)")
35
+ end
36
+
37
+ # https://github.com/carlhuda/bundler/issues/1500
38
+ it "does not fail install because of gem plugins" do
39
+ realworld_system_gems("open_gem --version 1.4.2", "rake --version 0.9.2")
40
+ gemfile <<-G
41
+ source :rubygems
42
+
43
+ gem 'rack', '1.0.0'
44
+ G
45
+
46
+ bundle "install --path vendor/bundle", :expect_err => true
47
+ err.should_not include("Could not find rake")
48
+ err.should be_empty
11
49
  end
12
50
  end
@@ -89,6 +89,37 @@ describe "Bundler.require" do
89
89
  err.should == "ZOMG LOAD ERROR"
90
90
  end
91
91
 
92
+ describe "with namespaced gems" do
93
+ before :each do
94
+ build_lib "jquery-rails", "1.0.0" do |s|
95
+ s.write "lib/jquery/rails.rb", "puts 'jquery/rails'"
96
+ end
97
+ lib_path('jquery-rails-1.0.0/lib/jquery-rails.rb').rmtree
98
+ end
99
+
100
+ it "requires gem names that are namespaced" do
101
+ gemfile <<-G
102
+ path '#{lib_path}'
103
+ gem 'jquery-rails'
104
+ G
105
+
106
+ run "Bundler.require"
107
+ out.should eq("jquery/rails")
108
+ end
109
+
110
+ it "does not mangle explictly given requires" do
111
+ gemfile <<-G
112
+ path "#{lib_path}"
113
+ gem 'jquery-rails', :require => 'jquery-rails'
114
+ G
115
+
116
+ load_error_run <<-R, 'jquery-rails'
117
+ Bundler.require
118
+ R
119
+ err.should == "ZOMG LOAD ERROR"
120
+ end
121
+ end
122
+
92
123
  describe "using bundle exec" do
93
124
  it "requires the locked gems" do
94
125
  bundle "exec ruby -e 'Bundler.require'"
@@ -697,7 +697,7 @@ describe "Bundler.setup" do
697
697
  out.should include("was a LoadError while evaluating bar.gemspec")
698
698
  out.should include("foobarbaz")
699
699
  out.should include("bar.gemspec:1")
700
- out.should include("try to require a relative path") if RUBY_VERSION >= "1.9.0"
700
+ out.should include("try to require a relative path") if RUBY_VERSION >= "1.9"
701
701
  end
702
702
 
703
703
  it "evals each gemspec with a binding from the top level" do
@@ -1,18 +1,12 @@
1
1
  $:.unshift File.expand_path('..', __FILE__)
2
2
  $:.unshift File.expand_path('../../lib', __FILE__)
3
-
4
- begin
5
- require 'psych'
6
- rescue LoadError
7
- ensure
8
- require 'yaml'
9
- end
10
-
3
+ require 'bundler/psyched_yaml'
11
4
  require 'fileutils'
12
5
  require 'rubygems'
13
6
  require 'bundler'
14
7
  require 'rspec'
15
8
  require 'uri'
9
+ require 'digest/sha1'
16
10
 
17
11
  # Require the correct version of popen for the current platform
18
12
  if RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
@@ -59,6 +53,12 @@ RSpec.configure do |config|
59
53
  config.filter_run_excluding :realworld => true
60
54
  end
61
55
 
56
+ if RUBY_VERSION >= "1.9"
57
+ config.filter_run_excluding :ruby => "1.8"
58
+ else
59
+ config.filter_run_excluding :ruby => "1.9"
60
+ end
61
+
62
62
  config.filter_run :focused => true unless ENV['CI']
63
63
  config.run_all_when_everything_filtered = true
64
64
  config.alias_example_to :fit, :focused => true
@@ -96,4 +96,3 @@ RSpec.configure do |config|
96
96
  ENV['BUNDLE_APP_CONFIG'] = nil
97
97
  end
98
98
  end
99
-
@@ -421,7 +421,7 @@ module Spec
421
421
 
422
422
  def executables=(val)
423
423
  Array(val).each do |file|
424
- write "bin/#{file}", "require '#{@name}' ; puts #{@name.upcase}"
424
+ write "#{@spec.bindir}/#{file}", "require '#{@name}' ; puts #{@name.upcase}"
425
425
  end
426
426
  @spec.executables = Array(val)
427
427
  end
@@ -232,6 +232,30 @@ module Spec
232
232
  end
233
233
  end
234
234
 
235
+ def realworld_system_gems(*gems)
236
+ gems = gems.flatten
237
+
238
+ FileUtils.rm_rf(system_gem_path)
239
+ FileUtils.mkdir_p(system_gem_path)
240
+
241
+ Gem.clear_paths
242
+
243
+ gem_home, gem_path, path = ENV['GEM_HOME'], ENV['GEM_PATH'], ENV['PATH']
244
+ ENV['GEM_HOME'], ENV['GEM_PATH'] = system_gem_path.to_s, system_gem_path.to_s
245
+
246
+ gems.each do |gem|
247
+ gem_command :install, "--no-rdoc --no-ri #{gem}"
248
+ end
249
+ if block_given?
250
+ begin
251
+ yield
252
+ ensure
253
+ ENV['GEM_HOME'], ENV['GEM_PATH'] = gem_home, gem_path
254
+ ENV['PATH'] = path
255
+ end
256
+ end
257
+ end
258
+
235
259
  def cache_gems(*gems)
236
260
  gems = gems.flatten
237
261
 
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7712070
4
+ hash: 15424249
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
9
  - rc
10
- version: 1.1.rc
10
+ - 2
11
+ version: 1.1.rc.2
11
12
  platform: ruby
12
13
  authors:
13
14
  - "Andr\xC3\xA9 Arko"
@@ -18,7 +19,7 @@ autorequire:
18
19
  bindir: bin
19
20
  cert_chain: []
20
21
 
21
- date: 2011-10-04 00:00:00 -05:00
22
+ date: 2011-12-06 00:00:00 -08:00
22
23
  default_executable:
23
24
  dependencies:
24
25
  - !ruby/object:Gem::Dependency
@@ -91,6 +92,7 @@ files:
91
92
  - lib/bundler/lazy_specification.rb
92
93
  - lib/bundler/lockfile_parser.rb
93
94
  - lib/bundler/match_platform.rb
95
+ - lib/bundler/psyched_yaml.rb
94
96
  - lib/bundler/remote_specification.rb
95
97
  - lib/bundler/resolver.rb
96
98
  - lib/bundler/rubygems_ext.rb
@@ -104,6 +106,8 @@ files:
104
106
  - lib/bundler/templates/Executable
105
107
  - lib/bundler/templates/Gemfile
106
108
  - lib/bundler/templates/newgem/Gemfile.tt
109
+ - lib/bundler/templates/newgem/LICENSE.tt
110
+ - lib/bundler/templates/newgem/README.md.tt
107
111
  - lib/bundler/templates/newgem/Rakefile.tt
108
112
  - lib/bundler/templates/newgem/bin/newgem.tt
109
113
  - lib/bundler/templates/newgem/gitignore.tt
@@ -234,7 +238,6 @@ files:
234
238
  - lib/bundler/man/bundle
235
239
  - lib/bundler/man/bundle-install
236
240
  - lib/bundler/man/gemfile.5
237
- - lib/bundler/man/bundle-benchmark
238
241
  - lib/bundler/man/bundle-package
239
242
  - lib/bundler/man/bundle-update
240
243
  - lib/bundler/man/bundle-exec.txt
@@ -242,7 +245,6 @@ files:
242
245
  - lib/bundler/man/bundle-update.txt
243
246
  - lib/bundler/man/bundle-config
244
247
  - lib/bundler/man/bundle-config.txt
245
- - lib/bundler/man/bundle-benchmark.txt
246
248
  - lib/bundler/man/bundle.txt
247
249
  - lib/bundler/man/bundle-package.txt
248
250
  - lib/bundler/man/bundle-install.txt