bundler 1.7.15 → 1.8.0.pre

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 (191) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -14
  3. data/.rspec +1 -0
  4. data/.travis.yml +22 -15
  5. data/CHANGELOG.md +43 -13
  6. data/CODE_OF_CONDUCT.md +40 -0
  7. data/CONTRIBUTING.md +14 -12
  8. data/DEVELOPMENT.md +4 -2
  9. data/ISSUES.md +1 -1
  10. data/README.md +10 -14
  11. data/Rakefile +10 -10
  12. data/bin/bundle +1 -1
  13. data/bundler.gemspec +5 -4
  14. data/lib/bundler.rb +22 -3
  15. data/lib/bundler/anonymizable_uri.rb +24 -8
  16. data/lib/bundler/cli.rb +103 -66
  17. data/lib/bundler/cli/cache.rb +1 -0
  18. data/lib/bundler/cli/clean.rb +11 -4
  19. data/lib/bundler/cli/common.rb +2 -0
  20. data/lib/bundler/cli/console.rb +22 -26
  21. data/lib/bundler/cli/exec.rb +29 -22
  22. data/lib/bundler/cli/gem.rb +125 -37
  23. data/lib/bundler/cli/install.rb +22 -9
  24. data/lib/bundler/cli/outdated.rb +1 -1
  25. data/lib/bundler/cli/package.rb +8 -1
  26. data/lib/bundler/cli/show.rb +29 -3
  27. data/lib/bundler/cli/update.rb +2 -2
  28. data/lib/bundler/cli/viz.rb +1 -1
  29. data/lib/bundler/definition.rb +14 -22
  30. data/lib/bundler/dependency.rb +8 -1
  31. data/lib/bundler/dsl.rb +17 -4
  32. data/lib/bundler/endpoint_specification.rb +1 -1
  33. data/lib/bundler/env.rb +44 -25
  34. data/lib/bundler/fetcher.rb +33 -25
  35. data/lib/bundler/friendly_errors.rb +38 -5
  36. data/lib/bundler/gem_helper.rb +16 -10
  37. data/lib/bundler/gem_helpers.rb +1 -0
  38. data/lib/bundler/graph.rb +4 -1
  39. data/lib/bundler/index.rb +15 -25
  40. data/lib/bundler/installer.rb +6 -6
  41. data/lib/bundler/lockfile_parser.rb +7 -7
  42. data/lib/bundler/resolver.rb +2 -1
  43. data/lib/bundler/ruby_version.rb +1 -1
  44. data/lib/bundler/rubygems_ext.rb +1 -0
  45. data/lib/bundler/rubygems_integration.rb +1 -1
  46. data/lib/bundler/runtime.rb +22 -40
  47. data/lib/bundler/settings.rb +14 -5
  48. data/lib/bundler/setup.rb +2 -1
  49. data/lib/bundler/shared_helpers.rb +56 -4
  50. data/lib/bundler/source.rb +8 -9
  51. data/lib/bundler/source/git.rb +5 -1
  52. data/lib/bundler/source/git/git_proxy.rb +4 -0
  53. data/lib/bundler/source/path.rb +8 -11
  54. data/lib/bundler/source/path/installer.rb +0 -2
  55. data/lib/bundler/source/rubygems.rb +58 -72
  56. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +13 -0
  57. data/lib/bundler/templates/newgem/LICENSE.txt.tt +17 -18
  58. data/lib/bundler/templates/newgem/README.md.tt +9 -1
  59. data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
  60. data/lib/bundler/templates/newgem/bin/console.tt +14 -0
  61. data/lib/bundler/templates/newgem/bin/setup.tt +7 -0
  62. data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
  63. data/lib/bundler/templates/newgem/gitignore.tt +2 -0
  64. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +1 -1
  65. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -13
  66. data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +1 -1
  67. data/lib/bundler/ui/shell.rb +1 -1
  68. data/lib/bundler/version.rb +1 -1
  69. data/lib/bundler/worker.rb +73 -0
  70. data/man/bundle-config.ronn +17 -15
  71. data/man/bundle-install.ronn +102 -93
  72. data/man/bundle-update.ronn +39 -30
  73. data/man/bundle.ronn +6 -0
  74. data/man/gemfile.5.ronn +74 -13
  75. metadata +10 -231
  76. data/lib/bundler/parallel_workers.rb +0 -18
  77. data/lib/bundler/parallel_workers/thread_worker.rb +0 -30
  78. data/lib/bundler/parallel_workers/unix_worker.rb +0 -101
  79. data/lib/bundler/parallel_workers/worker.rb +0 -69
  80. data/lib/bundler/templates/newgem/bin/newgem.tt +0 -3
  81. data/spec/bundler/anonymizable_uri_spec.rb +0 -32
  82. data/spec/bundler/bundler_spec.rb +0 -72
  83. data/spec/bundler/cli_spec.rb +0 -16
  84. data/spec/bundler/definition_spec.rb +0 -22
  85. data/spec/bundler/dsl_spec.rb +0 -82
  86. data/spec/bundler/friendly_errors_spec.rb +0 -13
  87. data/spec/bundler/gem_helper_spec.rb +0 -226
  88. data/spec/bundler/psyched_yaml_spec.rb +0 -8
  89. data/spec/bundler/retry_spec.rb +0 -59
  90. data/spec/bundler/settings_spec.rb +0 -13
  91. data/spec/bundler/source/rubygems_spec.rb +0 -25
  92. data/spec/bundler/source_list_spec.rb +0 -361
  93. data/spec/cache/gems_spec.rb +0 -284
  94. data/spec/cache/git_spec.rb +0 -188
  95. data/spec/cache/path_spec.rb +0 -121
  96. data/spec/cache/platform_spec.rb +0 -57
  97. data/spec/commands/binstubs_spec.rb +0 -219
  98. data/spec/commands/check_spec.rb +0 -278
  99. data/spec/commands/clean_spec.rb +0 -592
  100. data/spec/commands/config_spec.rb +0 -263
  101. data/spec/commands/console_spec.rb +0 -76
  102. data/spec/commands/exec_spec.rb +0 -309
  103. data/spec/commands/help_spec.rb +0 -39
  104. data/spec/commands/init_spec.rb +0 -39
  105. data/spec/commands/inject_spec.rb +0 -78
  106. data/spec/commands/licenses_spec.rb +0 -18
  107. data/spec/commands/newgem_spec.rb +0 -428
  108. data/spec/commands/open_spec.rb +0 -68
  109. data/spec/commands/outdated_spec.rb +0 -156
  110. data/spec/commands/package_spec.rb +0 -114
  111. data/spec/commands/show_spec.rb +0 -125
  112. data/spec/install/binstubs_spec.rb +0 -24
  113. data/spec/install/bundler_spec.rb +0 -146
  114. data/spec/install/deploy_spec.rb +0 -250
  115. data/spec/install/gemfile/gemspec_spec.rb +0 -170
  116. data/spec/install/gemfile/git_spec.rb +0 -967
  117. data/spec/install/gemfile/path_spec.rb +0 -500
  118. data/spec/install/gemfile_spec.rb +0 -44
  119. data/spec/install/gems/c_ext_spec.rb +0 -48
  120. data/spec/install/gems/dependency_api_spec.rb +0 -652
  121. data/spec/install/gems/env_spec.rb +0 -107
  122. data/spec/install/gems/flex_spec.rb +0 -314
  123. data/spec/install/gems/groups_spec.rb +0 -308
  124. data/spec/install/gems/mirror_spec.rb +0 -39
  125. data/spec/install/gems/platform_spec.rb +0 -195
  126. data/spec/install/gems/post_install_spec.rb +0 -121
  127. data/spec/install/gems/resolving_spec.rb +0 -124
  128. data/spec/install/gems/simple_case_spec.rb +0 -377
  129. data/spec/install/gems/sources_spec.rb +0 -386
  130. data/spec/install/gems/standalone_spec.rb +0 -260
  131. data/spec/install/gems/sudo_spec.rb +0 -136
  132. data/spec/install/gems/win32_spec.rb +0 -26
  133. data/spec/install/gemspecs_spec.rb +0 -50
  134. data/spec/install/path_spec.rb +0 -150
  135. data/spec/install/post_bundle_message_spec.rb +0 -142
  136. data/spec/install/prereleases_spec.rb +0 -43
  137. data/spec/install/security_policy_spec.rb +0 -77
  138. data/spec/install/upgrade_spec.rb +0 -26
  139. data/spec/lock/git_spec.rb +0 -34
  140. data/spec/lock/lockfile_spec.rb +0 -924
  141. data/spec/other/bundle_ruby_spec.rb +0 -142
  142. data/spec/other/cli_dispatch_spec.rb +0 -21
  143. data/spec/other/ext_spec.rb +0 -60
  144. data/spec/other/platform_spec.rb +0 -1285
  145. data/spec/other/ssl_cert_spec.rb +0 -23
  146. data/spec/quality_spec.rb +0 -88
  147. data/spec/realworld/dependency_api_spec.rb +0 -60
  148. data/spec/realworld/edgecases_spec.rb +0 -212
  149. data/spec/realworld/parallel_spec.rb +0 -71
  150. data/spec/resolver/basic_spec.rb +0 -66
  151. data/spec/resolver/platform_spec.rb +0 -88
  152. data/spec/runtime/executable_spec.rb +0 -149
  153. data/spec/runtime/load_spec.rb +0 -107
  154. data/spec/runtime/platform_spec.rb +0 -90
  155. data/spec/runtime/require_spec.rb +0 -332
  156. data/spec/runtime/setup_spec.rb +0 -853
  157. data/spec/runtime/with_clean_env_spec.rb +0 -91
  158. data/spec/spec_helper.rb +0 -123
  159. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +0 -13
  160. data/spec/support/artifice/endpoint.rb +0 -71
  161. data/spec/support/artifice/endpoint_500.rb +0 -37
  162. data/spec/support/artifice/endpoint_api_forbidden.rb +0 -11
  163. data/spec/support/artifice/endpoint_api_missing.rb +0 -16
  164. data/spec/support/artifice/endpoint_basic_authentication.rb +0 -13
  165. data/spec/support/artifice/endpoint_creds_diff_host.rb +0 -38
  166. data/spec/support/artifice/endpoint_extra.rb +0 -31
  167. data/spec/support/artifice/endpoint_extra_api.rb +0 -32
  168. data/spec/support/artifice/endpoint_extra_missing.rb +0 -15
  169. data/spec/support/artifice/endpoint_fallback.rb +0 -17
  170. data/spec/support/artifice/endpoint_host_redirect.rb +0 -15
  171. data/spec/support/artifice/endpoint_marshal_fail.rb +0 -11
  172. data/spec/support/artifice/endpoint_redirect.rb +0 -15
  173. data/spec/support/artifice/endpoint_strict_basic_authentication.rb +0 -18
  174. data/spec/support/artifice/endpoint_timeout.rb +0 -13
  175. data/spec/support/builders.rb +0 -693
  176. data/spec/support/fakeweb/rack-1.0.0.marshal +0 -2
  177. data/spec/support/fakeweb/windows.rb +0 -23
  178. data/spec/support/hax.rb +0 -22
  179. data/spec/support/helpers.rb +0 -361
  180. data/spec/support/indexes.rb +0 -280
  181. data/spec/support/matchers.rb +0 -77
  182. data/spec/support/path.rb +0 -85
  183. data/spec/support/permissions.rb +0 -10
  184. data/spec/support/platforms.rb +0 -94
  185. data/spec/support/ruby_ext.rb +0 -20
  186. data/spec/support/rubygems_ext.rb +0 -39
  187. data/spec/support/streams.rb +0 -13
  188. data/spec/support/sudo.rb +0 -16
  189. data/spec/update/gems_spec.rb +0 -201
  190. data/spec/update/git_spec.rb +0 -283
  191. data/spec/update/path_spec.rb +0 -18
@@ -1,263 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe ".bundle/config" do
4
- before :each do
5
- gemfile <<-G
6
- source "file://#{gem_repo1}"
7
- gem "rack", "1.0.0"
8
- G
9
- end
10
-
11
- describe "BUNDLE_APP_CONFIG" do
12
- it "can be moved with an environment variable" do
13
- ENV['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
14
- bundle "install --path vendor/bundle"
15
-
16
- expect(bundled_app('.bundle')).not_to exist
17
- expect(tmp('foo/bar/config')).to exist
18
- should_be_installed "rack 1.0.0"
19
- end
20
-
21
- it "can provide a relative path with the environment variable" do
22
- FileUtils.mkdir_p bundled_app('omg')
23
- Dir.chdir bundled_app('omg')
24
-
25
- ENV['BUNDLE_APP_CONFIG'] = "../foo"
26
- bundle "install --path vendor/bundle"
27
-
28
- expect(bundled_app(".bundle")).not_to exist
29
- expect(bundled_app("../foo/config")).to exist
30
- should_be_installed "rack 1.0.0"
31
- end
32
-
33
- it "removes environment.rb from BUNDLE_APP_CONFIG's path" do
34
- FileUtils.mkdir_p(tmp('foo/bar'))
35
- ENV['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
36
- bundle "install"
37
- FileUtils.touch tmp('foo/bar/environment.rb')
38
- should_be_installed "rack 1.0.0"
39
- expect(tmp('foo/bar/environment.rb')).not_to exist
40
- end
41
- end
42
-
43
- describe "global" do
44
- before(:each) { bundle :install }
45
-
46
- it "is the default" do
47
- bundle "config foo global"
48
- run "puts Bundler.settings[:foo]"
49
- expect(out).to eq("global")
50
- end
51
-
52
- it "can also be set explicitly" do
53
- bundle "config --global foo global"
54
- run "puts Bundler.settings[:foo]"
55
- expect(out).to eq("global")
56
- end
57
-
58
- it "has lower precedence than local" do
59
- bundle "config --local foo local"
60
-
61
- bundle "config --global foo global"
62
- expect(out).to match(/Your application has set foo to "local"/)
63
-
64
- run "puts Bundler.settings[:foo]"
65
- expect(out).to eq("local")
66
- end
67
-
68
- it "has lower precedence than env" do
69
- begin
70
- ENV["BUNDLE_FOO"] = "env"
71
-
72
- bundle "config --global foo global"
73
- expect(out).to match(/You have a bundler environment variable for foo set to "env"/)
74
-
75
- run "puts Bundler.settings[:foo]"
76
- expect(out).to eq("env")
77
- ensure
78
- ENV.delete("BUNDLE_FOO")
79
- end
80
- end
81
-
82
- it "can be deleted" do
83
- bundle "config --global foo global"
84
- bundle "config --delete foo"
85
-
86
- run "puts Bundler.settings[:foo] == nil"
87
- expect(out).to eq("true")
88
- end
89
-
90
- it "warns when overriding" do
91
- bundle "config --global foo previous"
92
- bundle "config --global foo global"
93
- expect(out).to match(/You are replacing the current global value of foo/)
94
-
95
- run "puts Bundler.settings[:foo]"
96
- expect(out).to eq("global")
97
- end
98
-
99
- it "expands the path at time of setting" do
100
- bundle "config --global local.foo .."
101
- run "puts Bundler.settings['local.foo']"
102
- expect(out).to eq(File.expand_path(Dir.pwd + "/.."))
103
- end
104
- end
105
-
106
- describe "local" do
107
- before(:each) { bundle :install }
108
-
109
- it "can also be set explicitly" do
110
- bundle "config --local foo local"
111
- run "puts Bundler.settings[:foo]"
112
- expect(out).to eq("local")
113
- end
114
-
115
- it "has higher precedence than env" do
116
- begin
117
- ENV["BUNDLE_FOO"] = "env"
118
- bundle "config --local foo local"
119
-
120
- run "puts Bundler.settings[:foo]"
121
- expect(out).to eq("local")
122
- ensure
123
- ENV.delete("BUNDLE_FOO")
124
- end
125
- end
126
-
127
- it "can be deleted" do
128
- bundle "config --local foo local"
129
- bundle "config --delete foo"
130
-
131
- run "puts Bundler.settings[:foo] == nil"
132
- expect(out).to eq("true")
133
- end
134
-
135
- it "warns when overriding" do
136
- bundle "config --local foo previous"
137
- bundle "config --local foo local"
138
- expect(out).to match(/You are replacing the current local value of foo/)
139
-
140
- run "puts Bundler.settings[:foo]"
141
- expect(out).to eq("local")
142
- end
143
-
144
- it "expands the path at time of setting" do
145
- bundle "config --local local.foo .."
146
- run "puts Bundler.settings['local.foo']"
147
- expect(out).to eq(File.expand_path(Dir.pwd + "/.."))
148
- end
149
- end
150
-
151
- describe "env" do
152
- before(:each) { bundle :install }
153
-
154
- it "can set boolean properties via the environment" do
155
- ENV["BUNDLE_FROZEN"] = "true"
156
-
157
- run "if Bundler.settings[:frozen]; puts 'true' else puts 'false' end"
158
- expect(out).to eq("true")
159
- end
160
-
161
- it "can set negative boolean properties via the environment" do
162
- run "if Bundler.settings[:frozen]; puts 'true' else puts 'false' end"
163
- expect(out).to eq("false")
164
-
165
- ENV["BUNDLE_FROZEN"] = "false"
166
-
167
- run "if Bundler.settings[:frozen]; puts 'true' else puts 'false' end"
168
- expect(out).to eq("false")
169
-
170
- ENV["BUNDLE_FROZEN"] = "0"
171
-
172
- run "if Bundler.settings[:frozen]; puts 'true' else puts 'false' end"
173
- expect(out).to eq("false")
174
-
175
- ENV["BUNDLE_FROZEN"] = ""
176
-
177
- run "if Bundler.settings[:frozen]; puts 'true' else puts 'false' end"
178
- expect(out).to eq("false")
179
- end
180
- end
181
-
182
- describe "gem mirrors" do
183
- before(:each) { bundle :install }
184
-
185
- it "configures mirrors using keys with `mirror.`" do
186
- bundle "config --local mirror.http://gems.example.org http://gem-mirror.example.org"
187
- run(<<-E)
188
- Bundler.settings.gem_mirrors.each do |k, v|
189
- puts "\#{k} => \#{v}"
190
- end
191
- E
192
- expect(out).to eq("http://gems.example.org/ => http://gem-mirror.example.org/")
193
- end
194
- end
195
-
196
- describe "quoting" do
197
- before(:each) { gemfile "# no gems" }
198
-
199
- it "saves quotes" do
200
- bundle "config foo something\\'"
201
- run "puts Bundler.settings[:foo]"
202
- expect(out).to eq("something'")
203
- end
204
-
205
- it "doesn't return quotes around values", :ruby => "1.9" do
206
- bundle "config foo '1'"
207
- run "puts Bundler.settings.send(:global_config_file).read"
208
- expect(out).to include("'1'")
209
- run "puts Bundler.settings[:foo]"
210
- expect(out).to eq("1")
211
- end
212
-
213
- it "doesn't duplicate quotes around values", :if => (RUBY_VERSION >= "2.1") do
214
- bundled_app(".bundle").mkpath
215
- File.open(bundled_app(".bundle/config"), 'w') do |f|
216
- f.write 'BUNDLE_FOO: "$BUILD_DIR"'
217
- end
218
-
219
- bundle "config bar baz"
220
- run "puts Bundler.settings.send(:local_config_file).read"
221
-
222
- # Starting in Ruby 2.1, YAML automatically adds double quotes
223
- # around some values, including $ and newlines.
224
- expect(out).to include('BUNDLE_FOO: "$BUILD_DIR"')
225
- end
226
-
227
- it "doesn't duplicate quotes around long wrapped values" do
228
- long_string = "--with-xml2-include=/usr/pkg/include/libxml2 --with-xml2-lib=/usr/pkg/lib --with-xslt-dir=/usr/pkg"
229
- bundle "config foo #{long_string}"
230
-
231
- run "puts Bundler.settings[:foo]"
232
- expect(out).to eq(long_string)
233
-
234
- bundle "config bar baz"
235
-
236
- run "puts Bundler.settings[:foo]"
237
- expect(out).to eq(long_string)
238
- end
239
- end
240
-
241
- describe "very long lines" do
242
- before(:each) { bundle :install }
243
- let(:long_string) do
244
- "--with-xml2-include=/usr/pkg/include/libxml2 --with-xml2-lib=/usr/pkg/lib --with-xslt-dir=/usr/pkg"
245
- end
246
- let(:long_string_without_special_characters) do
247
- "here is quite a long string that will wrap to a second line but will not be surrounded by quotes"
248
- end
249
-
250
- it "doesn't wrap values" do
251
- bundle "config foo #{long_string}"
252
- run "puts Bundler.settings[:foo]"
253
- expect(out).to match(long_string)
254
- end
255
-
256
- it "can read wrapped unquoted values" do
257
- bundle "config foo #{long_string_without_special_characters}"
258
- run "puts Bundler.settings[:foo]"
259
- expect(out).to match(long_string_without_special_characters)
260
- end
261
- end
262
-
263
- end
@@ -1,76 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "bundle console" do
4
- before :each do
5
- install_gemfile <<-G
6
- source "file://#{gem_repo1}"
7
- gem "rack"
8
- gem "activesupport", :group => :test
9
- gem "rack_middleware", :group => :development
10
- G
11
- end
12
-
13
- it "starts IRB with the default group loaded" do
14
- bundle "console" do |input|
15
- input.puts("puts RACK")
16
- input.puts("exit")
17
- end
18
- expect(out).to include("0.9.1")
19
- end
20
-
21
- it "starts another REPL if configured as such" do
22
- bundle "config console pry"
23
-
24
- bundle "console" do |input|
25
- input.puts("__callee__")
26
- input.puts("exit")
27
- end
28
- expect(out).to include("pry")
29
- end
30
-
31
- it "falls back to IRB if the other REPL isn't available" do
32
- bundle "config console pry"
33
- # make sure pry isn't there
34
-
35
- bundle "console" do |input|
36
- input.puts("__callee__")
37
- input.puts("exit")
38
- end
39
- expect(out).to include("irb")
40
- end
41
-
42
-
43
- it "doesn't load any other groups" do
44
- bundle "console" do |input|
45
- input.puts("puts ACTIVESUPPORT")
46
- input.puts("exit")
47
- end
48
- expect(out).to include("NameError")
49
- end
50
-
51
- describe "when given a group" do
52
- it "loads the given group" do
53
- bundle "console test" do |input|
54
- input.puts("puts ACTIVESUPPORT")
55
- input.puts("exit")
56
- end
57
- expect(out).to include("2.3.5")
58
- end
59
-
60
- it "loads the default group" do
61
- bundle "console test" do |input|
62
- input.puts("puts RACK")
63
- input.puts("exit")
64
- end
65
- expect(out).to include("0.9.1")
66
- end
67
-
68
- it "doesn't load other groups" do
69
- bundle "console test" do |input|
70
- input.puts("puts RACK_MIDDLEWARE")
71
- input.puts("exit")
72
- end
73
- expect(out).to include("NameError")
74
- end
75
- end
76
- end
@@ -1,309 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "bundle exec" do
4
- before :each do
5
- system_gems "rack-1.0.0", "rack-0.9.1"
6
- end
7
-
8
- it "activates the correct gem" do
9
- gemfile <<-G
10
- gem "rack", "0.9.1"
11
- G
12
-
13
- bundle "exec rackup"
14
- expect(out).to eq("0.9.1")
15
- end
16
-
17
- it "works when the bins are in ~/.bundle" do
18
- install_gemfile <<-G
19
- gem "rack"
20
- G
21
-
22
- bundle "exec rackup"
23
- expect(out).to eq("1.0.0")
24
- end
25
-
26
- it "works when running from a random directory" do
27
- install_gemfile <<-G
28
- gem "rack"
29
- G
30
-
31
- bundle "exec 'cd #{tmp('gems')} && rackup'"
32
-
33
- expect(out).to eq("1.0.0")
34
- end
35
-
36
- it "works when exec'ing something else" do
37
- install_gemfile 'gem "rack"'
38
- bundle "exec echo exec"
39
- expect(out).to eq("exec")
40
- end
41
-
42
- it "works when exec'ing to ruby" do
43
- install_gemfile 'gem "rack"'
44
- bundle "exec ruby -e 'puts %{hi}'"
45
- expect(out).to eq("hi")
46
- end
47
-
48
- it "accepts --verbose" do
49
- install_gemfile 'gem "rack"'
50
- bundle "exec --verbose echo foobar"
51
- expect(out).to eq("foobar")
52
- end
53
-
54
- it "passes --verbose to command if it is given after the command" do
55
- install_gemfile 'gem "rack"'
56
- bundle "exec echo --verbose"
57
- expect(out).to eq("--verbose")
58
- end
59
-
60
- it "handles --keep-file-descriptors" do
61
- require 'tempfile'
62
-
63
- bundle_bin = File.expand_path('../../../bin/bundle', __FILE__)
64
-
65
- command = Tempfile.new("io-test")
66
- command.sync = true
67
- command.write <<-G
68
- if ARGV[0]
69
- IO.for_fd(ARGV[0].to_i)
70
- else
71
- require 'tempfile'
72
- io = Tempfile.new("io-test-fd")
73
- args = %W[#{Gem.ruby} -I#{lib} #{bundle_bin} exec --keep-file-descriptors #{Gem.ruby} #{command.path} \#{io.to_i}]
74
- args << { io.to_i => io } if RUBY_VERSION >= "2.0"
75
- exec(*args)
76
- end
77
- G
78
-
79
- install_gemfile ''
80
- sys_exec("#{Gem.ruby} #{command.path}")
81
-
82
- if RUBY_VERSION >= "2.0"
83
- expect(out).to eq("")
84
- else
85
- expect(out).to eq("Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec.")
86
- end
87
-
88
- expect(err).to eq("")
89
- end
90
-
91
- it "accepts --keep-file-descriptors" do
92
- install_gemfile ''
93
- bundle "exec --keep-file-descriptors echo foobar"
94
-
95
- expect(err).to eq("")
96
- end
97
-
98
- it "can run a command named --verbose" do
99
- install_gemfile 'gem "rack"'
100
- File.open("--verbose", 'w') do |f|
101
- f.puts "#!/bin/sh"
102
- f.puts "echo foobar"
103
- end
104
- File.chmod(0744, "--verbose")
105
- ENV['PATH'] = "."
106
- bundle "exec -- --verbose"
107
- expect(out).to eq("foobar")
108
- end
109
-
110
- it "handles different versions in different bundles" do
111
- build_repo2 do
112
- build_gem "rack_two", "1.0.0" do |s|
113
- s.executables = "rackup"
114
- end
115
- end
116
-
117
- install_gemfile <<-G
118
- source "file://#{gem_repo1}"
119
- gem "rack", "0.9.1"
120
- G
121
-
122
- Dir.chdir bundled_app2 do
123
- install_gemfile bundled_app2('Gemfile'), <<-G
124
- source "file://#{gem_repo2}"
125
- gem "rack_two", "1.0.0"
126
- G
127
- end
128
-
129
- bundle "exec rackup"
130
-
131
- expect(out).to eq("0.9.1")
132
- expect(err).to match("deprecated")
133
-
134
- Dir.chdir bundled_app2 do
135
- bundle "exec rackup"
136
- expect(out).to eq("1.0.0")
137
- end
138
- end
139
-
140
- it "handles gems installed with --without" do
141
- install_gemfile <<-G, :without => :middleware
142
- source "file://#{gem_repo1}"
143
- gem "rack" # rack 0.9.1 and 1.0 exist
144
-
145
- group :middleware do
146
- gem "rack_middleware" # rack_middleware depends on rack 0.9.1
147
- end
148
- G
149
-
150
- bundle "exec rackup"
151
-
152
- expect(out).to eq("0.9.1")
153
- should_not_be_installed "rack_middleware 1.0"
154
- end
155
-
156
- it "does not duplicate already exec'ed RUBYOPT" do
157
- install_gemfile <<-G
158
- gem "rack"
159
- G
160
-
161
- rubyopt = ENV['RUBYOPT']
162
- rubyopt = "-rbundler/setup #{rubyopt}"
163
-
164
- bundle "exec 'echo $RUBYOPT'"
165
- expect(out).to have_rubyopts(rubyopt)
166
-
167
- bundle "exec 'echo $RUBYOPT'", :env => {"RUBYOPT" => rubyopt}
168
- expect(out).to have_rubyopts(rubyopt)
169
- end
170
-
171
- it "does not duplicate already exec'ed RUBYLIB" do
172
- install_gemfile <<-G
173
- gem "rack"
174
- G
175
-
176
- rubylib = ENV['RUBYLIB']
177
- rubylib = "#{rubylib}".split(File::PATH_SEPARATOR).unshift "#{bundler_path}"
178
- rubylib = rubylib.uniq.join(File::PATH_SEPARATOR)
179
-
180
- bundle "exec 'echo $RUBYLIB'"
181
- expect(out).to eq(rubylib)
182
-
183
- bundle "exec 'echo $RUBYLIB'", :env => {"RUBYLIB" => rubylib}
184
- expect(out).to eq(rubylib)
185
- end
186
-
187
- it "errors nicely when the argument doesn't exist" do
188
- install_gemfile <<-G
189
- gem "rack"
190
- G
191
-
192
- bundle "exec foobarbaz", :exitstatus => true
193
- expect(exitstatus).to eq(127)
194
- expect(out).to include("bundler: command not found: foobarbaz")
195
- expect(out).to include("Install missing gem executables with `bundle install`")
196
- end
197
-
198
- it "errors nicely when the argument is not executable" do
199
- install_gemfile <<-G
200
- gem "rack"
201
- G
202
-
203
- bundle "exec touch foo"
204
- bundle "exec ./foo", :exitstatus => true
205
- expect(exitstatus).to eq(126)
206
- expect(out).to include("bundler: not executable: ./foo")
207
- end
208
-
209
- it "errors nicely when no arguments are passed" do
210
- install_gemfile <<-G
211
- gem "rack"
212
- G
213
-
214
- bundle "exec", :exitstatus => true
215
- expect(exitstatus).to eq(128)
216
- expect(out).to include("bundler: exec needs a command to run")
217
- end
218
-
219
- describe "with gem executables" do
220
- describe "run from a random directory" do
221
- before(:each) do
222
- install_gemfile <<-G
223
- gem "rack"
224
- G
225
- end
226
-
227
- it "works when unlocked" do
228
- bundle "exec 'cd #{tmp('gems')} && rackup'"
229
- expect(out).to eq("1.0.0")
230
- end
231
-
232
- it "works when locked" do
233
- should_be_locked
234
- bundle "exec 'cd #{tmp('gems')} && rackup'"
235
- expect(out).to eq("1.0.0")
236
- end
237
- end
238
-
239
- describe "from gems bundled via :path" do
240
- before(:each) do
241
- build_lib "fizz", :path => home("fizz") do |s|
242
- s.executables = "fizz"
243
- end
244
-
245
- install_gemfile <<-G
246
- gem "fizz", :path => "#{File.expand_path(home("fizz"))}"
247
- G
248
- end
249
-
250
- it "works when unlocked" do
251
- bundle "exec fizz"
252
- expect(out).to eq("1.0")
253
- end
254
-
255
- it "works when locked" do
256
- should_be_locked
257
-
258
- bundle "exec fizz"
259
- expect(out).to eq("1.0")
260
- end
261
- end
262
-
263
- describe "from gems bundled via :git" do
264
- before(:each) do
265
- build_git "fizz_git" do |s|
266
- s.executables = "fizz_git"
267
- end
268
-
269
- install_gemfile <<-G
270
- gem "fizz_git", :git => "#{lib_path('fizz_git-1.0')}"
271
- G
272
- end
273
-
274
- it "works when unlocked" do
275
- bundle "exec fizz_git"
276
- expect(out).to eq("1.0")
277
- end
278
-
279
- it "works when locked" do
280
- should_be_locked
281
- bundle "exec fizz_git"
282
- expect(out).to eq("1.0")
283
- end
284
- end
285
-
286
- describe "from gems bundled via :git with no gemspec" do
287
- before(:each) do
288
- build_git "fizz_no_gemspec", :gemspec => false do |s|
289
- s.executables = "fizz_no_gemspec"
290
- end
291
-
292
- install_gemfile <<-G
293
- gem "fizz_no_gemspec", "1.0", :git => "#{lib_path('fizz_no_gemspec-1.0')}"
294
- G
295
- end
296
-
297
- it "works when unlocked" do
298
- bundle "exec fizz_no_gemspec"
299
- expect(out).to eq("1.0")
300
- end
301
-
302
- it "works when locked" do
303
- should_be_locked
304
- bundle "exec fizz_no_gemspec"
305
- expect(out).to eq("1.0")
306
- end
307
- end
308
- end
309
- end