rkh-bundler 1.2.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. data/.gitignore +22 -0
  2. data/.travis.yml +42 -0
  3. data/CHANGELOG.md +1105 -0
  4. data/ISSUES.md +67 -0
  5. data/LICENSE +23 -0
  6. data/README.md +31 -0
  7. data/Rakefile +208 -0
  8. data/UPGRADING.md +103 -0
  9. data/bin/bundle +31 -0
  10. data/bundler.gemspec +31 -0
  11. data/lib/bundler.rb +353 -0
  12. data/lib/bundler/capistrano.rb +11 -0
  13. data/lib/bundler/cli.rb +693 -0
  14. data/lib/bundler/definition.rb +568 -0
  15. data/lib/bundler/dep_proxy.rb +43 -0
  16. data/lib/bundler/dependency.rb +134 -0
  17. data/lib/bundler/deployment.rb +58 -0
  18. data/lib/bundler/dsl.rb +256 -0
  19. data/lib/bundler/endpoint_specification.rb +78 -0
  20. data/lib/bundler/environment.rb +47 -0
  21. data/lib/bundler/fetcher.rb +225 -0
  22. data/lib/bundler/gem_helper.rb +162 -0
  23. data/lib/bundler/gem_helpers.rb +23 -0
  24. data/lib/bundler/gem_installer.rb +9 -0
  25. data/lib/bundler/gem_tasks.rb +2 -0
  26. data/lib/bundler/graph.rb +148 -0
  27. data/lib/bundler/index.rb +187 -0
  28. data/lib/bundler/installer.rb +190 -0
  29. data/lib/bundler/lazy_specification.rb +79 -0
  30. data/lib/bundler/lockfile_parser.rb +127 -0
  31. data/lib/bundler/match_platform.rb +13 -0
  32. data/lib/bundler/psyched_yaml.rb +15 -0
  33. data/lib/bundler/remote_specification.rb +57 -0
  34. data/lib/bundler/resolver.rb +486 -0
  35. data/lib/bundler/ruby_version.rb +94 -0
  36. data/lib/bundler/rubygems_ext.rb +153 -0
  37. data/lib/bundler/rubygems_integration.rb +394 -0
  38. data/lib/bundler/runtime.rb +233 -0
  39. data/lib/bundler/settings.rb +128 -0
  40. data/lib/bundler/setup.rb +23 -0
  41. data/lib/bundler/shared_helpers.rb +71 -0
  42. data/lib/bundler/source.rb +869 -0
  43. data/lib/bundler/spec_set.rb +137 -0
  44. data/lib/bundler/templates/Executable +16 -0
  45. data/lib/bundler/templates/Executable.standalone +12 -0
  46. data/lib/bundler/templates/Gemfile +4 -0
  47. data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  48. data/lib/bundler/templates/newgem/LICENSE.tt +22 -0
  49. data/lib/bundler/templates/newgem/README.md.tt +29 -0
  50. data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
  51. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  52. data/lib/bundler/templates/newgem/gitignore.tt +17 -0
  53. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +9 -0
  54. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  55. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -0
  56. data/lib/bundler/ui.rb +88 -0
  57. data/lib/bundler/vendor/net/http/faster.rb +27 -0
  58. data/lib/bundler/vendor/net/http/persistent.rb +468 -0
  59. data/lib/bundler/vendor/thor.rb +358 -0
  60. data/lib/bundler/vendor/thor/actions.rb +314 -0
  61. data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
  62. data/lib/bundler/vendor/thor/actions/create_link.rb +57 -0
  63. data/lib/bundler/vendor/thor/actions/directory.rb +93 -0
  64. data/lib/bundler/vendor/thor/actions/empty_directory.rb +134 -0
  65. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +270 -0
  66. data/lib/bundler/vendor/thor/actions/inject_into_file.rb +109 -0
  67. data/lib/bundler/vendor/thor/base.rb +576 -0
  68. data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +9 -0
  69. data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  70. data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +100 -0
  71. data/lib/bundler/vendor/thor/error.rb +30 -0
  72. data/lib/bundler/vendor/thor/group.rb +273 -0
  73. data/lib/bundler/vendor/thor/invocation.rb +168 -0
  74. data/lib/bundler/vendor/thor/parser.rb +4 -0
  75. data/lib/bundler/vendor/thor/parser/argument.rb +67 -0
  76. data/lib/bundler/vendor/thor/parser/arguments.rb +161 -0
  77. data/lib/bundler/vendor/thor/parser/option.rb +120 -0
  78. data/lib/bundler/vendor/thor/parser/options.rb +172 -0
  79. data/lib/bundler/vendor/thor/rake_compat.rb +66 -0
  80. data/lib/bundler/vendor/thor/runner.rb +309 -0
  81. data/lib/bundler/vendor/thor/shell.rb +88 -0
  82. data/lib/bundler/vendor/thor/shell/basic.rb +302 -0
  83. data/lib/bundler/vendor/thor/shell/color.rb +108 -0
  84. data/lib/bundler/vendor/thor/shell/html.rb +121 -0
  85. data/lib/bundler/vendor/thor/task.rb +113 -0
  86. data/lib/bundler/vendor/thor/util.rb +229 -0
  87. data/lib/bundler/vendor/thor/version.rb +3 -0
  88. data/lib/bundler/vendored_thor.rb +7 -0
  89. data/lib/bundler/version.rb +6 -0
  90. data/lib/bundler/vlad.rb +11 -0
  91. data/man/bundle-config.ronn +130 -0
  92. data/man/bundle-exec.ronn +111 -0
  93. data/man/bundle-install.ronn +335 -0
  94. data/man/bundle-package.ronn +59 -0
  95. data/man/bundle-update.ronn +176 -0
  96. data/man/bundle.ronn +83 -0
  97. data/man/gemfile.5.ronn +324 -0
  98. data/man/index.txt +6 -0
  99. data/spec/bundler/dsl_spec.rb +48 -0
  100. data/spec/bundler/gem_helper_spec.rb +174 -0
  101. data/spec/bundler/source_spec.rb +25 -0
  102. data/spec/cache/gems_spec.rb +239 -0
  103. data/spec/cache/git_spec.rb +124 -0
  104. data/spec/cache/path_spec.rb +103 -0
  105. data/spec/cache/platform_spec.rb +57 -0
  106. data/spec/install/deploy_spec.rb +211 -0
  107. data/spec/install/gems/c_ext_spec.rb +48 -0
  108. data/spec/install/gems/dependency_api_spec.rb +402 -0
  109. data/spec/install/gems/env_spec.rb +107 -0
  110. data/spec/install/gems/flex_spec.rb +313 -0
  111. data/spec/install/gems/groups_spec.rb +268 -0
  112. data/spec/install/gems/packed_spec.rb +84 -0
  113. data/spec/install/gems/platform_spec.rb +208 -0
  114. data/spec/install/gems/post_install_spec.rb +47 -0
  115. data/spec/install/gems/resolving_spec.rb +72 -0
  116. data/spec/install/gems/simple_case_spec.rb +814 -0
  117. data/spec/install/gems/standalone_spec.rb +260 -0
  118. data/spec/install/gems/sudo_spec.rb +74 -0
  119. data/spec/install/gems/win32_spec.rb +26 -0
  120. data/spec/install/gemspec_spec.rb +170 -0
  121. data/spec/install/git_spec.rb +796 -0
  122. data/spec/install/invalid_spec.rb +35 -0
  123. data/spec/install/path_spec.rb +405 -0
  124. data/spec/install/upgrade_spec.rb +26 -0
  125. data/spec/lock/git_spec.rb +35 -0
  126. data/spec/lock/lockfile_spec.rb +809 -0
  127. data/spec/other/check_spec.rb +265 -0
  128. data/spec/other/clean_spec.rb +492 -0
  129. data/spec/other/config_spec.rb +138 -0
  130. data/spec/other/console_spec.rb +54 -0
  131. data/spec/other/exec_spec.rb +229 -0
  132. data/spec/other/ext_spec.rb +37 -0
  133. data/spec/other/help_spec.rb +39 -0
  134. data/spec/other/init_spec.rb +40 -0
  135. data/spec/other/newgem_spec.rb +87 -0
  136. data/spec/other/open_spec.rb +35 -0
  137. data/spec/other/outdated_spec.rb +93 -0
  138. data/spec/other/platform_spec.rb +881 -0
  139. data/spec/other/show_spec.rb +88 -0
  140. data/spec/quality_spec.rb +62 -0
  141. data/spec/realworld/edgecases_spec.rb +177 -0
  142. data/spec/resolver/basic_spec.rb +20 -0
  143. data/spec/resolver/platform_spec.rb +82 -0
  144. data/spec/runtime/executable_spec.rb +120 -0
  145. data/spec/runtime/load_spec.rb +107 -0
  146. data/spec/runtime/platform_spec.rb +90 -0
  147. data/spec/runtime/require_spec.rb +261 -0
  148. data/spec/runtime/setup_spec.rb +755 -0
  149. data/spec/runtime/with_clean_env_spec.rb +80 -0
  150. data/spec/spec_helper.rb +98 -0
  151. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
  152. data/spec/support/artifice/endpoint.rb +54 -0
  153. data/spec/support/artifice/endpoint_500.rb +37 -0
  154. data/spec/support/artifice/endpoint_api_missing.rb +16 -0
  155. data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
  156. data/spec/support/artifice/endpoint_extra.rb +27 -0
  157. data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
  158. data/spec/support/artifice/endpoint_fallback.rb +18 -0
  159. data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
  160. data/spec/support/artifice/endpoint_redirect.rb +15 -0
  161. data/spec/support/builders.rb +604 -0
  162. data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
  163. data/spec/support/fakeweb/windows.rb +23 -0
  164. data/spec/support/helpers.rb +317 -0
  165. data/spec/support/indexes.rb +112 -0
  166. data/spec/support/matchers.rb +77 -0
  167. data/spec/support/path.rb +73 -0
  168. data/spec/support/platforms.rb +86 -0
  169. data/spec/support/ruby_ext.rb +20 -0
  170. data/spec/support/rubygems_ext.rb +37 -0
  171. data/spec/support/rubygems_hax/platform.rb +22 -0
  172. data/spec/support/sudo.rb +21 -0
  173. data/spec/update/gems_spec.rb +134 -0
  174. data/spec/update/git_spec.rb +196 -0
  175. data/spec/update/source_spec.rb +51 -0
  176. metadata +338 -0
@@ -0,0 +1,313 @@
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, :expect_err => true
189
+ require 'bundler/setup'
190
+ RUBY
191
+ err.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 from 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) ruby depends on
203
+ rack (= 1.2) ruby
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
+
273
+ # This was written to test github issue #636, but it passed.
274
+ # It's insanoly slow (3.36s) so I'm not going to run it
275
+ # describe "when a locked child dependency conflicts" do
276
+ # before(:each) do
277
+ # build_repo2 do
278
+ # build_gem "capybara", "0.3.9" do |s|
279
+ # s.add_dependency "rack", ">= 1.0.0"
280
+ # end
281
+ #
282
+ # build_gem "rack", "1.1.0"
283
+ # build_gem "rails", "3.0.0.rc4" do |s|
284
+ # s.add_dependency "rack", "~> 1.1.0"
285
+ # end
286
+ #
287
+ # build_gem "rack", "1.2.1"
288
+ # build_gem "rails", "3.0.0" do |s|
289
+ # s.add_dependency "rack", "~> 1.2.1"
290
+ # end
291
+ # end
292
+ # end
293
+ #
294
+ # it "prints the correct error message" do
295
+ # # install Rails 3.0.0.rc
296
+ # install_gemfile <<-G
297
+ # source "file://#{gem_repo2}"
298
+ # gem "rails", "3.0.0.rc4"
299
+ # gem "capybara", "0.3.9"
300
+ # G
301
+ #
302
+ # # upgrade Rails to 3.0.0 and then install again
303
+ # install_gemfile <<-G
304
+ # source "file://#{gem_repo2}"
305
+ # gem "rails", "3.0.0"
306
+ # gem "capybara", "0.3.9"
307
+ # G
308
+ #
309
+ # out.should match(/Gemfile.lock/)
310
+ # end
311
+ # end
312
+
313
+ end
@@ -0,0 +1,268 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install with gem sources" do
4
+ describe "with groups" do
5
+ describe "installing with no options" do
6
+ before :each do
7
+ install_gemfile <<-G
8
+ source "file://#{gem_repo1}"
9
+ gem "rack"
10
+ group :emo do
11
+ gem "activesupport", "2.3.5"
12
+ end
13
+ gem "thin", :groups => [:emo]
14
+ G
15
+ end
16
+
17
+ it "installs gems in the default group" do
18
+ should_be_installed "rack 1.0.0"
19
+ end
20
+
21
+ it "installs gems in a group block into that group" do
22
+ should_be_installed "activesupport 2.3.5"
23
+
24
+ load_error_run <<-R, 'activesupport', :default
25
+ require 'activesupport'
26
+ puts ACTIVESUPPORT
27
+ R
28
+
29
+ err.should == "ZOMG LOAD ERROR"
30
+ end
31
+
32
+ it "installs gems with inline :groups into those groups" do
33
+ should_be_installed "thin 1.0"
34
+
35
+ load_error_run <<-R, 'thin', :default
36
+ require 'thin'
37
+ puts THIN
38
+ R
39
+
40
+ err.should == "ZOMG LOAD ERROR"
41
+ end
42
+
43
+ it "sets up everything if Bundler.setup is used with no groups" do
44
+ out = run("require 'rack'; puts RACK")
45
+ out.should eq('1.0.0')
46
+
47
+ out = run("require 'activesupport'; puts ACTIVESUPPORT")
48
+ out.should eq('2.3.5')
49
+
50
+ out = run("require 'thin'; puts THIN")
51
+ out.should eq('1.0')
52
+ end
53
+
54
+ it "removes old groups when new groups are set up" do
55
+ load_error_run <<-RUBY, 'thin', :emo
56
+ Bundler.setup(:default)
57
+ require 'thin'
58
+ puts THIN
59
+ RUBY
60
+
61
+ err.should == "ZOMG LOAD ERROR"
62
+ end
63
+
64
+ it "sets up old groups when they have previously been removed" do
65
+ out = run <<-RUBY, :emo
66
+ Bundler.setup(:default)
67
+ Bundler.setup(:default, :emo)
68
+ require 'thin'; puts THIN
69
+ RUBY
70
+ out.should == '1.0'
71
+ end
72
+ end
73
+
74
+ describe "installing --without" do
75
+ describe "with gems assigned to a single group" do
76
+ before :each do
77
+ gemfile <<-G
78
+ source "file://#{gem_repo1}"
79
+ gem "rack"
80
+ group :emo do
81
+ gem "activesupport", "2.3.5"
82
+ end
83
+ G
84
+ end
85
+
86
+ it "installs gems in the default group" do
87
+ bundle :install, :without => "emo"
88
+ should_be_installed "rack 1.0.0", :groups => [:default]
89
+ end
90
+
91
+ it "does not install gems from the excluded group" do
92
+ bundle :install, :without => "emo"
93
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
94
+ end
95
+
96
+ it "does not install gems from the previously excluded group" do
97
+ bundle :install, :without => "emo"
98
+ should_not_be_installed "activesupport 2.3.5"
99
+ bundle :install
100
+ should_not_be_installed "activesupport 2.3.5"
101
+ end
102
+
103
+ it "does not say it installed gems from the excluded group" do
104
+ bundle :install, :without => "emo"
105
+ out.should_not include("activesupport")
106
+ end
107
+
108
+ it "allows Bundler.setup for specific groups" do
109
+ bundle :install, :without => "emo"
110
+ run("require 'rack'; puts RACK", :default)
111
+ out.should == '1.0.0'
112
+ end
113
+
114
+ it "does not effect the resolve" do
115
+ gemfile <<-G
116
+ source "file://#{gem_repo1}"
117
+ gem "activesupport"
118
+ group :emo do
119
+ gem "rails", "2.3.2"
120
+ end
121
+ G
122
+
123
+ bundle :install, :without => "emo"
124
+ should_be_installed "activesupport 2.3.2", :groups => [:default]
125
+ end
126
+
127
+ it "still works on a different machine and excludes gems" do
128
+ bundle :install, :without => "emo"
129
+
130
+ simulate_new_machine
131
+ bundle :install, :without => "emo"
132
+
133
+ should_be_installed "rack 1.0.0", :groups => [:default]
134
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
135
+ end
136
+
137
+ it "still works when BUNDLE_WITHOUT is set" do
138
+ ENV["BUNDLE_WITHOUT"] = "emo"
139
+
140
+ bundle :install
141
+ out.should_not include("activesupport")
142
+
143
+ should_be_installed "rack 1.0.0", :groups => [:default]
144
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
145
+
146
+ ENV["BUNDLE_WITHOUT"] = nil
147
+ end
148
+
149
+ it "clears without when passed an empty list" do
150
+ bundle :install, :without => "emo"
151
+
152
+ bundle 'install --without ""'
153
+ should_be_installed "activesupport 2.3.5"
154
+ end
155
+
156
+ it "doesn't clear without when nothing is passed" do
157
+ bundle :install, :without => "emo"
158
+
159
+ bundle :install
160
+ should_not_be_installed "activesupport 2.3.5"
161
+ end
162
+ end
163
+
164
+ describe "with gems assigned to multiple groups" do
165
+ before :each do
166
+ gemfile <<-G
167
+ source "file://#{gem_repo1}"
168
+ gem "rack"
169
+ group :emo, :lolercoaster do
170
+ gem "activesupport", "2.3.5"
171
+ end
172
+ G
173
+ end
174
+
175
+ it "installs gems in the default group" do
176
+ bundle :install, :without => "emo lolercoaster"
177
+ should_be_installed "rack 1.0.0"
178
+ end
179
+
180
+ it "installs the gem if any of its groups are installed" do
181
+ bundle "install --without emo"
182
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
183
+ end
184
+
185
+ it "works when locked as well" do
186
+ bundle "install --without emo"
187
+ bundle "lock"
188
+
189
+ simulate_new_machine
190
+
191
+ bundle "install --without lolercoaster"
192
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
193
+ end
194
+
195
+ describe "with a gem defined multiple times in different groups" do
196
+ before :each do
197
+ gemfile <<-G
198
+ source "file://#{gem_repo1}"
199
+ gem "rack"
200
+
201
+ group :emo do
202
+ gem "activesupport", "2.3.5"
203
+ end
204
+
205
+ group :lolercoaster do
206
+ gem "activesupport", "2.3.5"
207
+ end
208
+ G
209
+ end
210
+
211
+ it "installs the gem w/ option --without emo" do
212
+ bundle "install --without emo"
213
+ should_be_installed "activesupport 2.3.5"
214
+ end
215
+
216
+ it "installs the gem w/ option --without lolercoaster" do
217
+ bundle "install --without lolercoaster"
218
+ should_be_installed "activesupport 2.3.5"
219
+ end
220
+
221
+ it "does not install the gem w/ option --without emo lolercoaster" do
222
+ bundle "install --without emo lolercoaster"
223
+ should_not_be_installed "activesupport 2.3.5"
224
+ end
225
+
226
+ it "does not install the gem w/ option --without 'emo lolercoaster'" do
227
+ bundle "install --without 'emo lolercoaster'"
228
+ should_not_be_installed "activesupport 2.3.5"
229
+ end
230
+ end
231
+ end
232
+
233
+ describe "nesting groups" do
234
+ before :each do
235
+ gemfile <<-G
236
+ source "file://#{gem_repo1}"
237
+ gem "rack"
238
+ group :emo do
239
+ group :lolercoaster do
240
+ gem "activesupport", "2.3.5"
241
+ end
242
+ end
243
+ G
244
+ end
245
+
246
+ it "installs gems in the default group" do
247
+ bundle :install, :without => "emo lolercoaster"
248
+ should_be_installed "rack 1.0.0"
249
+ end
250
+
251
+ it "installs the gem if any of its groups are installed" do
252
+ bundle "install --without emo"
253
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
254
+ end
255
+
256
+ it "works when locked as well" do
257
+ bundle "install --without emo"
258
+ bundle "lock"
259
+
260
+ simulate_new_machine
261
+
262
+ bundle "install --without lolercoaster"
263
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
264
+ end
265
+ end
266
+ end
267
+ end
268
+ end