bundler 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

Files changed (108) hide show
  1. data/.gitignore +12 -0
  2. data/CHANGELOG.md +28 -6
  3. data/ISSUES.md +1 -1
  4. data/README.md +7 -5
  5. data/Rakefile +173 -0
  6. data/UPGRADING.md +103 -0
  7. data/bundler.gemspec +28 -0
  8. data/lib/bundler.rb +1 -0
  9. data/lib/bundler/capistrano.rb +2 -31
  10. data/lib/bundler/cli.rb +18 -16
  11. data/lib/bundler/deployment.rb +37 -0
  12. data/lib/bundler/dsl.rb +3 -3
  13. data/lib/bundler/gem_helper.rb +4 -7
  14. data/lib/bundler/graph.rb +3 -3
  15. data/lib/bundler/installer.rb +1 -0
  16. data/lib/bundler/lockfile_parser.rb +1 -1
  17. data/lib/bundler/man/bundle +1 -1
  18. data/lib/bundler/man/bundle-config +92 -0
  19. data/lib/bundler/man/bundle-config.txt +72 -30
  20. data/lib/bundler/man/bundle-exec +1 -1
  21. data/lib/bundler/man/bundle-exec.txt +1 -1
  22. data/lib/bundler/man/bundle-install +1 -1
  23. data/lib/bundler/man/bundle-install.txt +1 -1
  24. data/lib/bundler/man/bundle-package +1 -1
  25. data/lib/bundler/man/bundle-package.txt +1 -1
  26. data/lib/bundler/man/bundle-update +1 -1
  27. data/lib/bundler/man/bundle-update.txt +1 -1
  28. data/lib/bundler/man/bundle.txt +1 -1
  29. data/lib/bundler/man/gemfile.5 +2 -2
  30. data/lib/bundler/man/gemfile.5.txt +2 -2
  31. data/lib/bundler/settings.rb +2 -2
  32. data/lib/bundler/source.rb +2 -3
  33. data/lib/bundler/templates/Executable +1 -1
  34. data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  35. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  36. data/lib/bundler/templates/newgem/newgem.gemspec.tt +11 -12
  37. data/lib/bundler/version.rb +1 -1
  38. data/lib/bundler/vlad.rb +9 -0
  39. data/man/bundle-config.ronn +90 -0
  40. data/man/bundle-exec.ronn +98 -0
  41. data/man/bundle-install.ronn +310 -0
  42. data/man/bundle-package.ronn +59 -0
  43. data/man/bundle-update.ronn +176 -0
  44. data/man/bundle.ronn +77 -0
  45. data/man/gemfile.5.ronn +254 -0
  46. data/man/index.txt +6 -0
  47. data/spec/cache/gems_spec.rb +205 -0
  48. data/spec/cache/git_spec.rb +9 -0
  49. data/spec/cache/path_spec.rb +27 -0
  50. data/spec/cache/platform_spec.rb +57 -0
  51. data/spec/install/deploy_spec.rb +171 -0
  52. data/spec/install/deprecated_spec.rb +43 -0
  53. data/spec/install/gems/c_ext_spec.rb +48 -0
  54. data/spec/install/gems/env_spec.rb +107 -0
  55. data/spec/install/gems/flex_spec.rb +272 -0
  56. data/spec/install/gems/groups_spec.rb +209 -0
  57. data/spec/install/gems/locked_spec.rb +48 -0
  58. data/spec/install/gems/packed_spec.rb +72 -0
  59. data/spec/install/gems/platform_spec.rb +181 -0
  60. data/spec/install/gems/resolving_spec.rb +72 -0
  61. data/spec/install/gems/simple_case_spec.rb +709 -0
  62. data/spec/install/gems/sudo_spec.rb +77 -0
  63. data/spec/install/gems/win32_spec.rb +26 -0
  64. data/spec/install/gemspec_spec.rb +96 -0
  65. data/spec/install/git_spec.rb +552 -0
  66. data/spec/install/invalid_spec.rb +17 -0
  67. data/spec/install/path_spec.rb +335 -0
  68. data/spec/install/upgrade_spec.rb +26 -0
  69. data/spec/lock/flex_spec.rb +625 -0
  70. data/spec/lock/git_spec.rb +35 -0
  71. data/spec/other/check_spec.rb +221 -0
  72. data/spec/other/config_spec.rb +40 -0
  73. data/spec/other/console_spec.rb +102 -0
  74. data/spec/other/exec_spec.rb +241 -0
  75. data/spec/other/ext_spec.rb +16 -0
  76. data/spec/other/gem_helper_spec.rb +116 -0
  77. data/spec/other/help_spec.rb +36 -0
  78. data/spec/other/init_spec.rb +40 -0
  79. data/spec/other/newgem_spec.rb +24 -0
  80. data/spec/other/open_spec.rb +51 -0
  81. data/spec/other/show_spec.rb +99 -0
  82. data/spec/pack/gems_spec.rb +22 -0
  83. data/spec/quality_spec.rb +55 -0
  84. data/spec/resolver/basic_spec.rb +20 -0
  85. data/spec/resolver/platform_spec.rb +57 -0
  86. data/spec/runtime/environment_rb_spec.rb +170 -0
  87. data/spec/runtime/executable_spec.rb +110 -0
  88. data/spec/runtime/load_spec.rb +107 -0
  89. data/spec/runtime/platform_spec.rb +90 -0
  90. data/spec/runtime/require_spec.rb +261 -0
  91. data/spec/runtime/setup_spec.rb +412 -0
  92. data/spec/runtime/with_clean_env_spec.rb +15 -0
  93. data/spec/spec_helper.rb +81 -0
  94. data/spec/support/builders.rb +566 -0
  95. data/spec/support/helpers.rb +243 -0
  96. data/spec/support/indexes.rb +113 -0
  97. data/spec/support/matchers.rb +89 -0
  98. data/spec/support/path.rb +71 -0
  99. data/spec/support/platforms.rb +49 -0
  100. data/spec/support/ruby_ext.rb +19 -0
  101. data/spec/support/rubygems_ext.rb +30 -0
  102. data/spec/support/rubygems_hax/rubygems_plugin.rb +9 -0
  103. data/spec/support/sudo.rb +21 -0
  104. data/spec/update/gems_spec.rb +86 -0
  105. data/spec/update/git_spec.rb +159 -0
  106. data/spec/update/source_spec.rb +50 -0
  107. metadata +170 -32
  108. data/ROADMAP.md +0 -36
@@ -0,0 +1,43 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install with deprecated features" do
4
+ before :each do
5
+ in_app_root
6
+ end
7
+
8
+ %w( only except disable_system_gems disable_rubygems
9
+ clear_sources bundle_path bin_path ).each do |deprecated|
10
+
11
+ it "reports that #{deprecated} is deprecated" do
12
+ gemfile <<-G
13
+ #{deprecated}
14
+ G
15
+
16
+ bundle :install
17
+ out.should =~ /'#{deprecated}' has been removed/
18
+ out.should =~ /See the README for more information/
19
+ end
20
+
21
+ end
22
+
23
+
24
+ %w( require_as vendored_at only except ).each do |deprecated|
25
+
26
+ it "reports that :#{deprecated} is deprecated" do
27
+ gemfile <<-G
28
+ gem "rack", :#{deprecated} => true
29
+ G
30
+
31
+ bundle :install
32
+ out.should =~ /Please replace :#{deprecated}|The :#{deprecated} option is no longer supported/
33
+ end
34
+
35
+ end
36
+
37
+ it "reports that --production is deprecated" do
38
+ gemfile %{gem "rack"}
39
+ bundle "install --production"
40
+ out.should =~ /--production option is deprecated/
41
+ end
42
+
43
+ end
@@ -0,0 +1,48 @@
1
+ require "spec_helper"
2
+
3
+ describe "installing a gem with C extensions" do
4
+ it "installs" do
5
+ build_repo2 do
6
+ build_gem "c_extension" do |s|
7
+ s.extensions = ["ext/extconf.rb"]
8
+ s.write "ext/extconf.rb", <<-E
9
+ require "mkmf"
10
+ name = "c_extension_bundle"
11
+ dir_config(name)
12
+ raise "OMG" unless with_config("c_extension") == "hello"
13
+ create_makefile(name)
14
+ E
15
+
16
+ s.write "ext/c_extension.c", <<-C
17
+ #include "ruby.h"
18
+
19
+ VALUE c_extension_true(VALUE self) {
20
+ return Qtrue;
21
+ }
22
+
23
+ void Init_c_extension_bundle() {
24
+ VALUE c_Extension = rb_define_class("CExtension", rb_cObject);
25
+ rb_define_method(c_Extension, "its_true", c_extension_true, 0);
26
+ }
27
+ C
28
+
29
+ s.write "lib/c_extension.rb", <<-C
30
+ require "c_extension_bundle"
31
+ C
32
+ end
33
+ end
34
+
35
+ gemfile <<-G
36
+ source "file://#{gem_repo2}"
37
+ gem "c_extension"
38
+ G
39
+
40
+ bundle "config build.c_extension --with-c_extension=hello"
41
+ bundle "install"
42
+
43
+ out.should_not include("extconf.rb failed")
44
+
45
+ run "Bundler.require; puts CExtension.new.its_true"
46
+ out.should == "true"
47
+ end
48
+ end
@@ -0,0 +1,107 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install with ENV conditionals" do
4
+ describe "when just setting an ENV key as a string" do
5
+ before :each do
6
+ gemfile <<-G
7
+ source "file://#{gem_repo1}"
8
+
9
+ env "BUNDLER_TEST" do
10
+ gem "rack"
11
+ end
12
+ G
13
+ end
14
+
15
+ it "excludes the gems when the ENV variable is not set" do
16
+ bundle :install
17
+ should_not_be_installed "rack"
18
+ end
19
+
20
+ it "includes the gems when the ENV variable is set" do
21
+ ENV['BUNDLER_TEST'] = '1'
22
+ bundle :install
23
+ should_be_installed "rack 1.0"
24
+ end
25
+ end
26
+
27
+ describe "when just setting an ENV key as a symbol" do
28
+ before :each do
29
+ gemfile <<-G
30
+ source "file://#{gem_repo1}"
31
+
32
+ env :BUNDLER_TEST do
33
+ gem "rack"
34
+ end
35
+ G
36
+ end
37
+
38
+ it "excludes the gems when the ENV variable is not set" do
39
+ bundle :install
40
+ should_not_be_installed "rack"
41
+ end
42
+
43
+ it "includes the gems when the ENV variable is set" do
44
+ ENV['BUNDLER_TEST'] = '1'
45
+ bundle :install
46
+ should_be_installed "rack 1.0"
47
+ end
48
+ end
49
+
50
+ describe "when setting a string to match the env" do
51
+ before :each do
52
+ gemfile <<-G
53
+ source "file://#{gem_repo1}"
54
+
55
+ env "BUNDLER_TEST" => "foo" do
56
+ gem "rack"
57
+ end
58
+ G
59
+ end
60
+
61
+ it "excludes the gems when the ENV variable is not set" do
62
+ bundle :install
63
+ should_not_be_installed "rack"
64
+ end
65
+
66
+ it "excludes the gems when the ENV variable is set but does not match the condition" do
67
+ ENV['BUNDLER_TEST'] = '1'
68
+ bundle :install
69
+ should_not_be_installed "rack"
70
+ end
71
+
72
+ it "includes the gems when the ENV variable is set and matches the condition" do
73
+ ENV['BUNDLER_TEST'] = 'foo'
74
+ bundle :install
75
+ should_be_installed "rack 1.0"
76
+ end
77
+ end
78
+
79
+ describe "when setting a regex to match the env" do
80
+ before :each do
81
+ gemfile <<-G
82
+ source "file://#{gem_repo1}"
83
+
84
+ env "BUNDLER_TEST" => /foo/ do
85
+ gem "rack"
86
+ end
87
+ G
88
+ end
89
+
90
+ it "excludes the gems when the ENV variable is not set" do
91
+ bundle :install
92
+ should_not_be_installed "rack"
93
+ end
94
+
95
+ it "excludes the gems when the ENV variable is set but does not match the condition" do
96
+ ENV['BUNDLER_TEST'] = 'fo'
97
+ bundle :install
98
+ should_not_be_installed "rack"
99
+ end
100
+
101
+ it "includes the gems when the ENV variable is set and matches the condition" do
102
+ ENV['BUNDLER_TEST'] = 'foobar'
103
+ bundle :install
104
+ should_be_installed "rack 1.0"
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,272 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle flex_install" do
4
+ it "installs the gems as expected" do
5
+ install_gemfile <<-G
6
+ source "file://#{gem_repo1}"
7
+ gem 'rack'
8
+ G
9
+
10
+ should_be_installed "rack 1.0.0"
11
+ should_be_locked
12
+ end
13
+
14
+ it "installs even when the lockfile is invalid" do
15
+ install_gemfile <<-G
16
+ source "file://#{gem_repo1}"
17
+ gem 'rack'
18
+ G
19
+
20
+ should_be_installed "rack 1.0.0"
21
+ should_be_locked
22
+
23
+ gemfile <<-G
24
+ source "file://#{gem_repo1}"
25
+ gem 'rack', '1.0'
26
+ G
27
+
28
+ bundle :install
29
+ should_be_installed "rack 1.0.0"
30
+ should_be_locked
31
+ end
32
+
33
+ it "keeps child dependencies at the same version" do
34
+ build_repo2
35
+
36
+ install_gemfile <<-G
37
+ source "file://#{gem_repo2}"
38
+ gem "rack-obama"
39
+ G
40
+
41
+ should_be_installed "rack 1.0.0", "rack-obama 1.0.0"
42
+
43
+ update_repo2
44
+ install_gemfile <<-G
45
+ source "file://#{gem_repo2}"
46
+ gem "rack-obama", "1.0"
47
+ G
48
+
49
+ should_be_installed "rack 1.0.0", "rack-obama 1.0.0"
50
+ end
51
+
52
+ describe "adding new gems" do
53
+ it "installs added gems without updating previously installed gems" do
54
+ build_repo2
55
+
56
+ install_gemfile <<-G
57
+ source "file://#{gem_repo2}"
58
+ gem 'rack'
59
+ G
60
+
61
+ update_repo2
62
+
63
+ install_gemfile <<-G
64
+ source "file://#{gem_repo2}"
65
+ gem 'rack'
66
+ gem 'activesupport', '2.3.5'
67
+ G
68
+
69
+ should_be_installed "rack 1.0.0", 'activesupport 2.3.5'
70
+ end
71
+
72
+ it "keeps child dependencies pinned" do
73
+ build_repo2
74
+
75
+ install_gemfile <<-G
76
+ source "file://#{gem_repo2}"
77
+ gem "rack-obama"
78
+ G
79
+
80
+ update_repo2
81
+
82
+ install_gemfile <<-G
83
+ source "file://#{gem_repo2}"
84
+ gem "rack-obama"
85
+ gem "thin"
86
+ G
87
+
88
+ should_be_installed "rack 1.0.0", 'rack-obama 1.0', 'thin 1.0'
89
+ end
90
+ end
91
+
92
+ describe "removing gems" do
93
+ it "removes gems without changing the versions of remaining gems" do
94
+ build_repo2
95
+ install_gemfile <<-G
96
+ source "file://#{gem_repo2}"
97
+ gem 'rack'
98
+ gem 'activesupport', '2.3.5'
99
+ G
100
+
101
+ update_repo2
102
+
103
+ install_gemfile <<-G
104
+ source "file://#{gem_repo2}"
105
+ gem 'rack'
106
+ G
107
+
108
+ should_be_installed "rack 1.0.0"
109
+ should_not_be_installed "activesupport 2.3.5"
110
+
111
+ install_gemfile <<-G
112
+ source "file://#{gem_repo2}"
113
+ gem 'rack'
114
+ gem 'activesupport', '2.3.2'
115
+ G
116
+
117
+ should_be_installed "rack 1.0.0", 'activesupport 2.3.2'
118
+ end
119
+
120
+ it "removes top level dependencies when removed from the Gemfile while leaving other dependencies intact" do
121
+ build_repo2
122
+ install_gemfile <<-G
123
+ source "file://#{gem_repo2}"
124
+ gem 'rack'
125
+ gem 'activesupport', '2.3.5'
126
+ G
127
+
128
+ update_repo2
129
+
130
+ install_gemfile <<-G
131
+ source "file://#{gem_repo2}"
132
+ gem 'rack'
133
+ G
134
+
135
+ should_not_be_installed "activesupport 2.3.5"
136
+ end
137
+
138
+ it "removes child dependencies" do
139
+ build_repo2
140
+ install_gemfile <<-G
141
+ source "file://#{gem_repo2}"
142
+ gem 'rack-obama'
143
+ gem 'activesupport'
144
+ G
145
+
146
+ should_be_installed "rack 1.0.0", "rack-obama 1.0.0", "activesupport 2.3.5"
147
+
148
+ update_repo2
149
+ install_gemfile <<-G
150
+ source "file://#{gem_repo2}"
151
+ gem 'activesupport'
152
+ G
153
+
154
+ should_be_installed 'activesupport 2.3.5'
155
+ should_not_be_installed "rack-obama", "rack"
156
+ end
157
+ end
158
+
159
+ describe "when Gemfile conflicts with lockfile" do
160
+ before(:each) do
161
+ build_repo2
162
+ install_gemfile <<-G
163
+ source "file://#{gem_repo2}"
164
+ gem "rack_middleware"
165
+ G
166
+
167
+ should_be_installed "rack_middleware 1.0", "rack 0.9.1"
168
+
169
+ build_repo2
170
+ update_repo2 do
171
+ build_gem "rack-obama", "2.0" do |s|
172
+ s.add_dependency "rack", "=1.2"
173
+ end
174
+ build_gem "rack_middleware", "2.0" do |s|
175
+ s.add_dependency "rack", ">=1.0"
176
+ end
177
+ end
178
+
179
+ gemfile <<-G
180
+ source "file://#{gem_repo2}"
181
+ gem "rack-obama", "2.0"
182
+ gem "rack_middleware"
183
+ G
184
+ end
185
+
186
+ it "does not install gems whose dependencies are not met" do
187
+ bundle :install
188
+ ruby <<-RUBY
189
+ require 'bundler/setup'
190
+ RUBY
191
+ out.should =~ /could not find gem 'rack-obama/i
192
+ end
193
+
194
+ it "suggests bundle update when the Gemfile requires different versions than the lock" do
195
+ nice_error = <<-E.strip.gsub(/^ {8}/, '')
196
+ Fetching source index for file:#{gem_repo2}/
197
+ Bundler could not find compatible versions for gem "rack":
198
+ In snapshot (Gemfile.lock):
199
+ rack (0.9.1)
200
+
201
+ In Gemfile:
202
+ rack-obama (= 2.0) depends on
203
+ rack (= 1.2)
204
+
205
+ Running `bundle update` will rebuild your snapshot from scratch, using only
206
+ the gems in your Gemfile, which may resolve the conflict.
207
+ E
208
+
209
+ bundle :install
210
+ out.should == nice_error
211
+ end
212
+ end
213
+
214
+ describe "subtler cases" do
215
+ before :each do
216
+ install_gemfile <<-G
217
+ source "file://#{gem_repo1}"
218
+ gem "rack"
219
+ gem "rack-obama"
220
+ G
221
+
222
+ gemfile <<-G
223
+ source "file://#{gem_repo1}"
224
+ gem "rack", "0.9.1"
225
+ gem "rack-obama"
226
+ G
227
+ end
228
+
229
+ it "does something" do
230
+ lambda {
231
+ bundle "install"
232
+ }.should_not change { File.read(bundled_app('Gemfile.lock')) }
233
+
234
+ out.should include('rack = 0.9.1')
235
+ out.should include('locked at 1.0.0')
236
+ out.should include('bundle update rack')
237
+ end
238
+
239
+ it "should work when you update" do
240
+ bundle "update rack"
241
+ end
242
+ end
243
+
244
+ describe "when adding a new source" do
245
+ it "updates the lockfile" do
246
+ build_repo2
247
+ install_gemfile <<-G
248
+ source "file://#{gem_repo1}"
249
+ gem "rack"
250
+ G
251
+ install_gemfile <<-G
252
+ source "file://#{gem_repo1}"
253
+ source "file://#{gem_repo2}"
254
+ gem "rack"
255
+ G
256
+
257
+ lockfile_should_be <<-L
258
+ GEM
259
+ remote: file:#{gem_repo1}/
260
+ remote: file:#{gem_repo2}/
261
+ specs:
262
+ rack (1.0.0)
263
+
264
+ PLATFORMS
265
+ ruby
266
+
267
+ DEPENDENCIES
268
+ rack
269
+ L
270
+ end
271
+ end
272
+ end