bundler 1.1.pre.4 → 1.1.pre.5

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 (65) hide show
  1. data/.travis.yml +1 -0
  2. data/CHANGELOG.md +51 -2
  3. data/ISSUES.md +25 -11
  4. data/README.md +3 -3
  5. data/Rakefile +44 -48
  6. data/lib/bundler.rb +21 -20
  7. data/lib/bundler/cli.rb +46 -11
  8. data/lib/bundler/definition.rb +6 -4
  9. data/lib/bundler/dependency.rb +5 -0
  10. data/lib/bundler/dsl.rb +1 -7
  11. data/lib/bundler/endpoint_specification.rb +22 -0
  12. data/lib/bundler/fetcher.rb +76 -22
  13. data/lib/bundler/gem_helper.rb +2 -7
  14. data/lib/bundler/gem_tasks.rb +2 -0
  15. data/lib/bundler/index.rb +48 -41
  16. data/lib/bundler/installer.rb +5 -0
  17. data/lib/bundler/lazy_specification.rb +7 -6
  18. data/lib/bundler/resolver.rb +1 -1
  19. data/lib/bundler/rubygems_ext.rb +1 -1
  20. data/lib/bundler/rubygems_integration.rb +69 -31
  21. data/lib/bundler/runtime.rb +2 -2
  22. data/lib/bundler/setup.rb +3 -0
  23. data/lib/bundler/shared_helpers.rb +2 -2
  24. data/lib/bundler/source.rb +48 -46
  25. data/lib/bundler/spec_set.rb +1 -0
  26. data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  27. data/lib/bundler/templates/newgem/Rakefile.tt +2 -2
  28. data/lib/bundler/templates/newgem/bin/newgem.tt +1 -1
  29. data/lib/bundler/templates/newgem/gitignore.tt +14 -1
  30. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +2 -0
  31. data/lib/bundler/templates/newgem/newgem.gemspec.tt +13 -17
  32. data/lib/bundler/ui.rb +29 -15
  33. data/lib/bundler/vendor/net/http/persistent.rb +4 -0
  34. data/lib/bundler/vendored_thor.rb +7 -0
  35. data/lib/bundler/version.rb +1 -1
  36. data/man/bundle-install.ronn +7 -0
  37. data/man/bundle.ronn +6 -0
  38. data/man/gemfile.5.ronn +2 -0
  39. data/spec/cache/gems_spec.rb +11 -0
  40. data/spec/install/deploy_spec.rb +1 -1
  41. data/spec/install/gems/dependency_api_spec.rb +62 -7
  42. data/spec/install/gems/groups_spec.rb +3 -3
  43. data/spec/install/gems/post_install_spec.rb +47 -0
  44. data/spec/install/gems/sudo_spec.rb +3 -2
  45. data/spec/install/git_spec.rb +1 -2
  46. data/spec/install/path_spec.rb +1 -1
  47. data/spec/lock/lockfile_spec.rb +1 -1
  48. data/spec/other/check_spec.rb +30 -6
  49. data/spec/other/exec_spec.rb +4 -33
  50. data/spec/other/init_spec.rb +3 -3
  51. data/spec/other/newgem_spec.rb +5 -1
  52. data/spec/other/outdated_spec.rb +36 -6
  53. data/spec/quality_spec.rb +5 -1
  54. data/spec/runtime/require_spec.rb +10 -10
  55. data/spec/runtime/setup_spec.rb +31 -8
  56. data/spec/spec_helper.rb +1 -5
  57. data/spec/support/artifice/endpoint.rb +4 -0
  58. data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
  59. data/spec/support/artifice/endpoint_fallback.rb +0 -4
  60. data/spec/support/artifice/endpoint_redirect.rb +4 -0
  61. data/spec/support/builders.rb +6 -1
  62. data/spec/support/matchers.rb +1 -1
  63. data/spec/support/rubygems_ext.rb +4 -3
  64. data/spec/update/git_spec.rb +2 -2
  65. metadata +55 -143
@@ -191,7 +191,7 @@ describe "bundle install with explicit source paths" do
191
191
  gemspec :path => "#{lib_path("foo")}"
192
192
  G
193
193
 
194
- check exitstatus.should == 15
194
+ exitstatus.should eq(15)
195
195
  out.should =~ /There are multiple gemspecs/
196
196
  end
197
197
 
@@ -318,7 +318,7 @@ describe "the lockfile format" do
318
318
  actionpack (= 2.3.2)
319
319
  activerecord (= 2.3.2)
320
320
  activeresource (= 2.3.2)
321
- rake
321
+ rake (= 0.8.7)
322
322
  rake (0.8.7)
323
323
 
324
324
  PLATFORMS
@@ -8,7 +8,7 @@ describe "bundle check" do
8
8
  G
9
9
 
10
10
  bundle :check, :exitstatus => true
11
- check @exitstatus.should == 0
11
+ @exitstatus.should eq(0)
12
12
  out.should == "The Gemfile's dependencies are satisfied"
13
13
  end
14
14
 
@@ -55,7 +55,7 @@ describe "bundle check" do
55
55
  G
56
56
 
57
57
  bundle :check, :exitstatus => true
58
- check @exitstatus.should > 0
58
+ @exitstatus.should be > 0
59
59
  out.should include("could not be satisfied")
60
60
  end
61
61
 
@@ -89,7 +89,7 @@ describe "bundle check" do
89
89
 
90
90
  bundle "install --without foo"
91
91
  bundle "check", :exitstatus => true
92
- check @exitstatus.should == 0
92
+ @exitstatus.should eq(0)
93
93
  out.should include("The Gemfile's dependencies are satisfied")
94
94
  end
95
95
 
@@ -175,7 +175,7 @@ describe "bundle check" do
175
175
 
176
176
  it "outputs an error when the default Gemfile is not found" do
177
177
  bundle :check, :exitstatus => true
178
- check @exitstatus.should == 10
178
+ @exitstatus.should eq(10)
179
179
  out.should include("Could not locate Gemfile")
180
180
  end
181
181
 
@@ -190,11 +190,35 @@ describe "bundle check" do
190
190
  last_out = out
191
191
  3.times do |i|
192
192
  bundle :check
193
- check out.should == last_out
193
+ out.should eq(last_out)
194
194
  err.should be_empty
195
195
  end
196
196
  end
197
197
 
198
+ context "--path" do
199
+ before do
200
+ gemfile <<-G
201
+ source "file://#{gem_repo1}"
202
+ gem "rails"
203
+ G
204
+ bundle "install --path vendor/bundle"
205
+
206
+ FileUtils.rm_rf(bundled_app(".bundle"))
207
+ end
208
+
209
+ it "returns success" do
210
+ bundle "check --path vendor/bundle", :exitstatus => true
211
+ @exitstatus.should eq(0)
212
+ out.should == "The Gemfile's dependencies are satisfied"
213
+ end
214
+
215
+ it "should write to .bundle/config" do
216
+ bundle "check --path vendor/bundle", :exitstatus => true
217
+ bundle "check", :exitstatus => true
218
+ @exitstatus.should eq(0)
219
+ end
220
+ end
221
+
198
222
  describe "when locked" do
199
223
  before :each do
200
224
  system_gems "rack-1.0.0"
@@ -207,7 +231,7 @@ describe "bundle check" do
207
231
  it "returns success when the Gemfile is satisfied" do
208
232
  bundle :install
209
233
  bundle :check, :exitstatus => true
210
- check @exitstatus.should == 0
234
+ @exitstatus.should eq(0)
211
235
  out.should == "The Gemfile's dependencies are satisfied"
212
236
  end
213
237
 
@@ -54,7 +54,7 @@ describe "bundle exec" do
54
54
 
55
55
  bundle "exec rackup"
56
56
 
57
- check out.should == "0.9.1"
57
+ out.should eq("0.9.1")
58
58
 
59
59
  Dir.chdir bundled_app2 do
60
60
  bundle "exec rackup"
@@ -74,7 +74,7 @@ describe "bundle exec" do
74
74
 
75
75
  bundle "exec rackup"
76
76
 
77
- check out.should == "0.9.1"
77
+ out.should eq("0.9.1")
78
78
  should_not_be_installed "rack_middleware 1.0"
79
79
  end
80
80
 
@@ -99,7 +99,7 @@ describe "bundle exec" do
99
99
  G
100
100
 
101
101
  bundle "exec foobarbaz", :exitstatus => true
102
- check exitstatus.should == 127
102
+ exitstatus.should eq(127)
103
103
  out.should include("bundler: command not found: foobarbaz")
104
104
  out.should include("Install missing gem binaries with `bundle install`")
105
105
  end
@@ -111,7 +111,7 @@ describe "bundle exec" do
111
111
 
112
112
  bundle "exec touch foo"
113
113
  bundle "exec ./foo", :exitstatus => true
114
- check exitstatus.should == 126
114
+ exitstatus.should eq(126)
115
115
  out.should include("bundler: not executable: ./foo")
116
116
  end
117
117
 
@@ -210,33 +210,4 @@ describe "bundle exec" do
210
210
  end
211
211
 
212
212
  end
213
-
214
- describe "bundling bundler" do
215
- before(:each) do
216
- gemfile <<-G
217
- source "file://#{gem_repo1}"
218
- gem "rack"
219
- G
220
-
221
- bundle "install --path vendor/bundle --disable-shared-gems"
222
- end
223
-
224
- it "does not explode with --disable-shared-gems" do
225
- bundle "exec bundle check", :exitstatus => true
226
- exitstatus.should == 0
227
- end
228
-
229
- it "does not explode when starting with Bundler.setup" do
230
- ruby <<-R
231
- require "rubygems"
232
- require "bundler"
233
- Bundler.setup
234
- puts `bundle check`
235
- puts $?.exitstatus
236
- R
237
-
238
- out.should include("satisfied")
239
- out.should include("\n0")
240
- end
241
- end
242
213
  end
@@ -32,9 +32,9 @@ describe "bundle init" do
32
32
 
33
33
  gemfile = bundled_app("Gemfile").read
34
34
  gemfile.should =~ /source :gemcutter/
35
- check gemfile.scan(/gem "rack", "= 1.0.1"/).size.should == 1
36
- check gemfile.scan(/gem "rspec", "= 1.2"/).size.should == 1
37
- check gemfile.scan(/group :development/).size.should == 1
35
+ gemfile.scan(/gem "rack", "= 1.0.1"/).size.should eq(1)
36
+ gemfile.scan(/gem "rspec", "= 1.2"/).size.should eq(1)
37
+ gemfile.scan(/group :development/).size.should eq(1)
38
38
  end
39
39
 
40
40
  end
@@ -60,4 +60,8 @@ describe "bundle gem" do
60
60
  generated_gem.gemspec.email.first.should == "TODO: Write your email address"
61
61
  end
62
62
  end
63
- end
63
+
64
+ it "requires the version file" do
65
+ bundled_app("test-gem/lib/test-gem.rb").read.should =~ /require "test-gem\/version"/
66
+ end
67
+ end
@@ -1,13 +1,16 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe "bundle outdated" do
4
+
4
5
  before :each do
5
- build_repo2
6
+ build_repo2 do
7
+ build_git "foo", :path => lib_path("foo")
8
+ end
6
9
 
7
10
  install_gemfile <<-G
8
11
  source "file://#{gem_repo2}"
9
- gem "activesupport"
10
- gem "rack-obama"
12
+ gem "activesupport", "2.3.5"
13
+ gem "foo", :git => "#{lib_path('foo')}"
11
14
  G
12
15
  end
13
16
 
@@ -15,11 +18,12 @@ describe "bundle outdated" do
15
18
  it "returns list of outdated gems" do
16
19
  update_repo2 do
17
20
  build_gem "activesupport", "3.0"
21
+ update_git "foo", :path => lib_path("foo")
18
22
  end
19
23
 
20
24
  bundle "outdated"
21
25
  out.should include("activesupport (3.0 > 2.3.5)")
22
- out.should include("rack (1.2 > 1.0.0)")
26
+ out.should include("foo (1.0")
23
27
  end
24
28
  end
25
29
 
@@ -36,11 +40,37 @@ describe "bundle outdated" do
36
40
  it "returns list of outdated gems" do
37
41
  update_repo2 do
38
42
  build_gem "activesupport", "3.0"
43
+ update_git "foo", :path => lib_path("foo")
39
44
  end
40
45
 
41
- bundle "outdated rack"
46
+ bundle "outdated foo"
42
47
  out.should_not include("activesupport (3.0 > 2.3.5)")
43
- out.should include("rack (1.2 > 1.0.0)")
48
+ out.should include("foo (1.0")
49
+ end
50
+ end
51
+
52
+ describe "pre-release gems" do
53
+ context "without the --pre option" do
54
+ it "ignores pre-release versions" do
55
+ update_repo2 do
56
+ build_gem "activesupport", "3.0.0.beta"
57
+ end
58
+
59
+ bundle "outdated"
60
+ out.should_not include("activesupport (3.0.0.beta > 2.3.5)")
61
+ end
62
+ end
63
+
64
+ describe "with the --pre option" do
65
+ it "includes pre-release versions" do
66
+ update_repo2 do
67
+ build_gem "activesupport", "3.0.0.beta"
68
+ end
69
+
70
+ bundle "outdated --pre"
71
+ out.should include("activesupport (3.0.0.beta > 2.3.5)")
72
+ end
44
73
  end
45
74
  end
75
+
46
76
  end
@@ -1,5 +1,9 @@
1
1
  require "spec_helper"
2
2
 
3
+ if defined?(Encoding)
4
+ Encoding.default_external = "UTF-8"
5
+ end
6
+
3
7
  describe "The library itself" do
4
8
  def check_for_tab_characters(filename)
5
9
  failing_lines = []
@@ -49,7 +53,7 @@ describe "The library itself" do
49
53
  it "can still be built" do
50
54
  Dir.chdir(root) do
51
55
  `gem build bundler.gemspec`
52
- check $?.should == 0
56
+ $?.should eq(0)
53
57
 
54
58
  # clean up the .gem generated
55
59
  system("rm bundler-#{Bundler::VERSION}.gem")
@@ -48,23 +48,23 @@ describe "Bundler.require" do
48
48
  it "requires the gems" do
49
49
  # default group
50
50
  run "Bundler.require"
51
- check out.should == "two"
51
+ out.should eq("two")
52
52
 
53
53
  # specific group
54
54
  run "Bundler.require(:bar)"
55
- check out.should == "baz\nqux"
55
+ out.should eq("baz\nqux")
56
56
 
57
57
  # default and specific group
58
58
  run "Bundler.require(:default, :bar)"
59
- check out.should == "baz\nqux\ntwo"
59
+ out.should eq("baz\nqux\ntwo")
60
60
 
61
61
  # specific group given as a string
62
62
  run "Bundler.require('bar')"
63
- check out.should == "baz\nqux"
63
+ out.should eq("baz\nqux")
64
64
 
65
65
  # specific group declared as a string
66
66
  run "Bundler.require(:string)"
67
- check out.should == "six"
67
+ out.should eq("six")
68
68
 
69
69
  # required in resolver order instead of gemfile order
70
70
  run("Bundler.require(:not)")
@@ -95,10 +95,10 @@ describe "Bundler.require" do
95
95
  describe "using bundle exec" do
96
96
  it "requires the locked gems" do
97
97
  bundle "exec ruby -e 'Bundler.require'"
98
- check out.should == "two"
98
+ out.should eq("two")
99
99
 
100
100
  bundle "exec ruby -e 'Bundler.require(:bar)'"
101
- check out.should == "baz\nqux"
101
+ out.should eq("baz\nqux")
102
102
 
103
103
  bundle "exec ruby -e 'Bundler.require(:default, :bar)'"
104
104
  out.should == "baz\nqux\ntwo"
@@ -138,7 +138,7 @@ describe "Bundler.require" do
138
138
  G
139
139
 
140
140
  run "Bundler.require"
141
- check out.should == "two\nmodule_two\none"
141
+ out.should eq("two\nmodule_two\none")
142
142
  end
143
143
 
144
144
  describe "a gem with different requires for different envs" do
@@ -178,7 +178,7 @@ describe "Bundler.require" do
178
178
  G
179
179
 
180
180
  run "Bundler.require"
181
- check out.should == "two_not_loaded\none\ntwo"
181
+ out.should eq("two_not_loaded\none\ntwo")
182
182
  end
183
183
 
184
184
  describe "with busted gems" do
@@ -225,7 +225,7 @@ describe "Bundler.require with platform specific dependencies" do
225
225
 
226
226
  run "Bundler.require; puts RACK", :expect_err => true
227
227
 
228
- check out.should == "1.0.0"
228
+ out.should eq("1.0.0")
229
229
  err.should be_empty
230
230
  end
231
231
  end
@@ -16,8 +16,8 @@ describe "Bundler.setup" do
16
16
  require 'rack'
17
17
  puts RACK
18
18
  RUBY
19
- err.should == ""
20
- out.should == "1.0.0"
19
+ err.should eq("")
20
+ out.should eq("1.0.0")
21
21
  end
22
22
  end
23
23
 
@@ -41,8 +41,8 @@ describe "Bundler.setup" do
41
41
  puts "WIN"
42
42
  end
43
43
  RUBY
44
- err.should == ""
45
- out.should == "WIN"
44
+ err.should eq("")
45
+ out.should eq("WIN")
46
46
  end
47
47
 
48
48
  it "leaves all groups available if they were already" do
@@ -55,8 +55,8 @@ describe "Bundler.setup" do
55
55
  require 'rack'
56
56
  puts RACK
57
57
  RUBY
58
- err.should == ""
59
- out.should == "1.0.0"
58
+ err.should eq("")
59
+ out.should eq("1.0.0")
60
60
  end
61
61
  end
62
62
 
@@ -528,6 +528,28 @@ describe "Bundler.setup" do
528
528
  out.should == "[]"
529
529
  end
530
530
 
531
+ describe "when a vendored gem specification uses the :path option" do
532
+ it "should resolve paths relative to the Gemfile" do
533
+ path = bundled_app(File.join('vendor', 'foo'))
534
+ build_lib "foo", :path => path
535
+
536
+ # If the .gemspec exists, then Bundler handles the path differently.
537
+ # See Source::Path.load_spec_files for details.
538
+ FileUtils.rm(File.join(path, 'foo.gemspec'))
539
+
540
+ install_gemfile <<-G
541
+ gem 'foo', '1.2.3', :path => 'vendor/foo'
542
+ G
543
+
544
+ Dir.chdir(bundled_app.parent) do
545
+ run <<-R, :env => {"BUNDLE_GEMFILE" => bundled_app('Gemfile')}
546
+ require 'foo'
547
+ R
548
+ end
549
+ err.should == ""
550
+ end
551
+ end
552
+
531
553
  describe "with git gems that don't have gemspecs" do
532
554
  before :each do
533
555
  build_git "no-gemspec", :gemspec => false
@@ -670,8 +692,8 @@ describe "Bundler.setup" do
670
692
  Bundler.load
671
693
  RUBY
672
694
 
673
- err.should == ""
674
- out.should == ""
695
+ err.should eq("")
696
+ out.should eq("")
675
697
  end
676
698
  end
677
699
 
@@ -685,4 +707,5 @@ describe "Bundler.setup" do
685
707
  err.should be_empty
686
708
  end
687
709
  end
710
+
688
711
  end
@@ -5,6 +5,7 @@ require 'fileutils'
5
5
  require 'rubygems'
6
6
  require 'bundler'
7
7
  require 'rspec'
8
+ require 'uri'
8
9
 
9
10
  # Require the correct version of popen for the current platform
10
11
  if RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
@@ -57,11 +58,6 @@ RSpec.configure do |config|
57
58
  pending "JRuby executables do not have a proper shebang" if RUBY_PLATFORM == "java"
58
59
  end
59
60
 
60
- def check(*args)
61
- # suppresses ruby warnings about "useless use of == in void context"
62
- # e.g. check foo.should == bar
63
- end
64
-
65
61
  config.before :all do
66
62
  build_repo1
67
63
  end