bundler-prehistoric 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (284) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +100 -0
  5. data/CHANGELOG.md +1640 -0
  6. data/CONTRIBUTING.md +32 -0
  7. data/DEVELOPMENT.md +117 -0
  8. data/Gemfile +3 -0
  9. data/ISSUES.md +96 -0
  10. data/LICENSE.md +23 -0
  11. data/README.md +46 -0
  12. data/Rakefile +256 -0
  13. data/UPGRADING.md +103 -0
  14. data/bin/bundle +21 -0
  15. data/bin/bundle_ruby +56 -0
  16. data/bin/bundler +21 -0
  17. data/bundler.gemspec +33 -0
  18. data/lib/bundler.rb +442 -0
  19. data/lib/bundler/backports/time.rb +7 -0
  20. data/lib/bundler/capistrano.rb +16 -0
  21. data/lib/bundler/cli.rb +395 -0
  22. data/lib/bundler/cli/binstubs.rb +38 -0
  23. data/lib/bundler/cli/cache.rb +34 -0
  24. data/lib/bundler/cli/check.rb +35 -0
  25. data/lib/bundler/cli/clean.rb +19 -0
  26. data/lib/bundler/cli/common.rb +54 -0
  27. data/lib/bundler/cli/config.rb +84 -0
  28. data/lib/bundler/cli/console.rb +39 -0
  29. data/lib/bundler/cli/exec.rb +37 -0
  30. data/lib/bundler/cli/gem.rb +101 -0
  31. data/lib/bundler/cli/init.rb +33 -0
  32. data/lib/bundler/cli/inject.rb +33 -0
  33. data/lib/bundler/cli/install.rb +133 -0
  34. data/lib/bundler/cli/open.rb +23 -0
  35. data/lib/bundler/cli/outdated.rb +80 -0
  36. data/lib/bundler/cli/package.rb +36 -0
  37. data/lib/bundler/cli/platform.rb +43 -0
  38. data/lib/bundler/cli/show.rb +48 -0
  39. data/lib/bundler/cli/update.rb +73 -0
  40. data/lib/bundler/cli/viz.rb +27 -0
  41. data/lib/bundler/constants.rb +5 -0
  42. data/lib/bundler/current_ruby.rb +155 -0
  43. data/lib/bundler/definition.rb +604 -0
  44. data/lib/bundler/dep_proxy.rb +43 -0
  45. data/lib/bundler/dependency.rb +106 -0
  46. data/lib/bundler/deployment.rb +59 -0
  47. data/lib/bundler/deprecate.rb +15 -0
  48. data/lib/bundler/dsl.rb +305 -0
  49. data/lib/bundler/endpoint_specification.rb +76 -0
  50. data/lib/bundler/env.rb +56 -0
  51. data/lib/bundler/environment.rb +42 -0
  52. data/lib/bundler/fetcher.rb +396 -0
  53. data/lib/bundler/friendly_errors.rb +42 -0
  54. data/lib/bundler/gem_helper.rb +169 -0
  55. data/lib/bundler/gem_helpers.rb +25 -0
  56. data/lib/bundler/gem_installer.rb +9 -0
  57. data/lib/bundler/gem_path_manipulation.rb +8 -0
  58. data/lib/bundler/gem_tasks.rb +2 -0
  59. data/lib/bundler/graph.rb +169 -0
  60. data/lib/bundler/index.rb +184 -0
  61. data/lib/bundler/injector.rb +64 -0
  62. data/lib/bundler/installer.rb +332 -0
  63. data/lib/bundler/lazy_specification.rb +83 -0
  64. data/lib/bundler/lockfile_parser.rb +146 -0
  65. data/lib/bundler/match_platform.rb +13 -0
  66. data/lib/bundler/parallel_workers.rb +18 -0
  67. data/lib/bundler/parallel_workers/thread_worker.rb +30 -0
  68. data/lib/bundler/parallel_workers/unix_worker.rb +101 -0
  69. data/lib/bundler/parallel_workers/worker.rb +69 -0
  70. data/lib/bundler/psyched_yaml.rb +26 -0
  71. data/lib/bundler/remote_specification.rb +57 -0
  72. data/lib/bundler/resolver.rb +534 -0
  73. data/lib/bundler/retry.rb +60 -0
  74. data/lib/bundler/ruby_dsl.rb +11 -0
  75. data/lib/bundler/ruby_version.rb +117 -0
  76. data/lib/bundler/rubygems_ext.rb +171 -0
  77. data/lib/bundler/rubygems_integration.rb +578 -0
  78. data/lib/bundler/runtime.rb +310 -0
  79. data/lib/bundler/settings.rb +176 -0
  80. data/lib/bundler/setup.rb +23 -0
  81. data/lib/bundler/shared_helpers.rb +110 -0
  82. data/lib/bundler/similarity_detector.rb +63 -0
  83. data/lib/bundler/source.rb +29 -0
  84. data/lib/bundler/source/git.rb +289 -0
  85. data/lib/bundler/source/git/git_proxy.rb +158 -0
  86. data/lib/bundler/source/path.rb +225 -0
  87. data/lib/bundler/source/path/installer.rb +38 -0
  88. data/lib/bundler/source/rubygems.rb +334 -0
  89. data/lib/bundler/source/svn.rb +260 -0
  90. data/lib/bundler/source/svn/svn_proxy.rb +110 -0
  91. data/lib/bundler/spec_set.rb +154 -0
  92. data/lib/bundler/ssl_certs/.document +1 -0
  93. data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +14 -0
  94. data/lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +23 -0
  95. data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +28 -0
  96. data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +20 -0
  97. data/lib/bundler/ssl_certs/certificate_manager.rb +41 -0
  98. data/lib/bundler/templates/Executable +16 -0
  99. data/lib/bundler/templates/Executable.standalone +12 -0
  100. data/lib/bundler/templates/Gemfile +4 -0
  101. data/lib/bundler/templates/newgem/.travis.yml.tt +3 -0
  102. data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  103. data/lib/bundler/templates/newgem/LICENSE.txt.tt +22 -0
  104. data/lib/bundler/templates/newgem/README.md.tt +31 -0
  105. data/lib/bundler/templates/newgem/Rakefile.tt +26 -0
  106. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  107. data/lib/bundler/templates/newgem/consolerc.tt +3 -0
  108. data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
  109. data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
  110. data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
  111. data/lib/bundler/templates/newgem/gitignore.tt +16 -0
  112. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
  113. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  114. data/lib/bundler/templates/newgem/newgem.gemspec.tt +38 -0
  115. data/lib/bundler/templates/newgem/rspec.tt +2 -0
  116. data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
  117. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
  118. data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +4 -0
  119. data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +11 -0
  120. data/lib/bundler/ui.rb +7 -0
  121. data/lib/bundler/ui/rg_proxy.rb +21 -0
  122. data/lib/bundler/ui/shell.rb +98 -0
  123. data/lib/bundler/ui/silent.rb +44 -0
  124. data/lib/bundler/vendor/.document +0 -0
  125. data/lib/bundler/vendor/net/http/faster.rb +26 -0
  126. data/lib/bundler/vendor/net/http/persistent.rb +1230 -0
  127. data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
  128. data/lib/bundler/vendor/thor.rb +480 -0
  129. data/lib/bundler/vendor/thor/actions.rb +319 -0
  130. data/lib/bundler/vendor/thor/actions/create_file.rb +103 -0
  131. data/lib/bundler/vendor/thor/actions/create_link.rb +59 -0
  132. data/lib/bundler/vendor/thor/actions/directory.rb +118 -0
  133. data/lib/bundler/vendor/thor/actions/empty_directory.rb +135 -0
  134. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +316 -0
  135. data/lib/bundler/vendor/thor/actions/inject_into_file.rb +107 -0
  136. data/lib/bundler/vendor/thor/base.rb +656 -0
  137. data/lib/bundler/vendor/thor/command.rb +133 -0
  138. data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +77 -0
  139. data/lib/bundler/vendor/thor/core_ext/io_binary_read.rb +10 -0
  140. data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +98 -0
  141. data/lib/bundler/vendor/thor/error.rb +32 -0
  142. data/lib/bundler/vendor/thor/group.rb +281 -0
  143. data/lib/bundler/vendor/thor/invocation.rb +173 -0
  144. data/lib/bundler/vendor/thor/line_editor.rb +17 -0
  145. data/lib/bundler/vendor/thor/line_editor/basic.rb +35 -0
  146. data/lib/bundler/vendor/thor/line_editor/readline.rb +88 -0
  147. data/lib/bundler/vendor/thor/parser.rb +4 -0
  148. data/lib/bundler/vendor/thor/parser/argument.rb +73 -0
  149. data/lib/bundler/vendor/thor/parser/arguments.rb +175 -0
  150. data/lib/bundler/vendor/thor/parser/option.rb +121 -0
  151. data/lib/bundler/vendor/thor/parser/options.rb +218 -0
  152. data/lib/bundler/vendor/thor/rake_compat.rb +71 -0
  153. data/lib/bundler/vendor/thor/runner.rb +322 -0
  154. data/lib/bundler/vendor/thor/shell.rb +81 -0
  155. data/lib/bundler/vendor/thor/shell/basic.rb +420 -0
  156. data/lib/bundler/vendor/thor/shell/color.rb +149 -0
  157. data/lib/bundler/vendor/thor/shell/html.rb +126 -0
  158. data/lib/bundler/vendor/thor/util.rb +267 -0
  159. data/lib/bundler/vendor/thor/version.rb +3 -0
  160. data/lib/bundler/vendored_persistent.rb +3 -0
  161. data/lib/bundler/vendored_thor.rb +8 -0
  162. data/lib/bundler/version.rb +6 -0
  163. data/lib/bundler/vlad.rb +11 -0
  164. data/man/bundle-config.ronn +155 -0
  165. data/man/bundle-exec.ronn +136 -0
  166. data/man/bundle-install.ronn +372 -0
  167. data/man/bundle-package.ronn +59 -0
  168. data/man/bundle-platform.ronn +42 -0
  169. data/man/bundle-update.ronn +179 -0
  170. data/man/bundle.ronn +92 -0
  171. data/man/gemfile.5.ronn +369 -0
  172. data/man/index.txt +7 -0
  173. data/spec/bundler/bundler_spec.rb +74 -0
  174. data/spec/bundler/cli_spec.rb +16 -0
  175. data/spec/bundler/definition_spec.rb +21 -0
  176. data/spec/bundler/dsl_spec.rb +108 -0
  177. data/spec/bundler/friendly_errors_spec.rb +13 -0
  178. data/spec/bundler/gem_helper_spec.rb +225 -0
  179. data/spec/bundler/psyched_yaml_spec.rb +8 -0
  180. data/spec/bundler/retry_spec.rb +59 -0
  181. data/spec/bundler/settings_spec.rb +13 -0
  182. data/spec/bundler/source_spec.rb +25 -0
  183. data/spec/cache/gems_spec.rb +316 -0
  184. data/spec/cache/git_spec.rb +188 -0
  185. data/spec/cache/path_spec.rb +121 -0
  186. data/spec/cache/platform_spec.rb +53 -0
  187. data/spec/cache/svn_spec.rb +82 -0
  188. data/spec/commands/binstubs_spec.rb +246 -0
  189. data/spec/commands/check_spec.rb +278 -0
  190. data/spec/commands/clean_spec.rb +652 -0
  191. data/spec/commands/config_spec.rb +227 -0
  192. data/spec/commands/console_spec.rb +102 -0
  193. data/spec/commands/exec_spec.rb +367 -0
  194. data/spec/commands/help_spec.rb +39 -0
  195. data/spec/commands/init_spec.rb +39 -0
  196. data/spec/commands/inject_spec.rb +78 -0
  197. data/spec/commands/licenses_spec.rb +31 -0
  198. data/spec/commands/newgem_spec.rb +451 -0
  199. data/spec/commands/open_spec.rb +80 -0
  200. data/spec/commands/outdated_spec.rb +168 -0
  201. data/spec/commands/package_spec.rb +128 -0
  202. data/spec/commands/show_spec.rb +152 -0
  203. data/spec/install/binstubs_spec.rb +24 -0
  204. data/spec/install/bundler_spec.rb +146 -0
  205. data/spec/install/deploy_spec.rb +237 -0
  206. data/spec/install/gemfile/gemspec_spec.rb +170 -0
  207. data/spec/install/gemfile/git_spec.rb +967 -0
  208. data/spec/install/gemfile/path_spec.rb +480 -0
  209. data/spec/install/gemfile/svn_spec.rb +582 -0
  210. data/spec/install/gemfile_spec.rb +44 -0
  211. data/spec/install/gems/c_ext_spec.rb +48 -0
  212. data/spec/install/gems/dependency_api_spec.rb +580 -0
  213. data/spec/install/gems/env_spec.rb +107 -0
  214. data/spec/install/gems/flex_spec.rb +314 -0
  215. data/spec/install/gems/groups_spec.rb +308 -0
  216. data/spec/install/gems/mirror_spec.rb +39 -0
  217. data/spec/install/gems/platform_spec.rb +221 -0
  218. data/spec/install/gems/post_install_spec.rb +121 -0
  219. data/spec/install/gems/resolving_spec.rb +124 -0
  220. data/spec/install/gems/simple_case_spec.rb +386 -0
  221. data/spec/install/gems/standalone_spec.rb +260 -0
  222. data/spec/install/gems/sudo_spec.rb +136 -0
  223. data/spec/install/gems/win32_spec.rb +26 -0
  224. data/spec/install/gemspecs_spec.rb +50 -0
  225. data/spec/install/path_spec.rb +150 -0
  226. data/spec/install/post_bundle_message_spec.rb +142 -0
  227. data/spec/install/prereleases_spec.rb +43 -0
  228. data/spec/install/security_policy_spec.rb +77 -0
  229. data/spec/install/upgrade_spec.rb +26 -0
  230. data/spec/lock/git_spec.rb +34 -0
  231. data/spec/lock/lockfile_spec.rb +912 -0
  232. data/spec/lock/svn_spec.rb +35 -0
  233. data/spec/other/bundle_ruby_spec.rb +142 -0
  234. data/spec/other/cli_dispatch_spec.rb +21 -0
  235. data/spec/other/ext_spec.rb +60 -0
  236. data/spec/other/platform_spec.rb +1285 -0
  237. data/spec/other/ssl_cert_spec.rb +10 -0
  238. data/spec/quality_spec.rb +88 -0
  239. data/spec/realworld/dependency_api_spec.rb +60 -0
  240. data/spec/realworld/edgecases_spec.rb +177 -0
  241. data/spec/realworld/parallel_spec.rb +69 -0
  242. data/spec/resolver/basic_spec.rb +66 -0
  243. data/spec/resolver/platform_spec.rb +88 -0
  244. data/spec/runtime/executable_spec.rb +149 -0
  245. data/spec/runtime/load_spec.rb +107 -0
  246. data/spec/runtime/platform_spec.rb +90 -0
  247. data/spec/runtime/require_spec.rb +332 -0
  248. data/spec/runtime/setup_spec.rb +856 -0
  249. data/spec/runtime/with_clean_env_spec.rb +91 -0
  250. data/spec/spec_helper.rb +114 -0
  251. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
  252. data/spec/support/artifice/endpoint.rb +71 -0
  253. data/spec/support/artifice/endpoint_500.rb +37 -0
  254. data/spec/support/artifice/endpoint_api_missing.rb +16 -0
  255. data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
  256. data/spec/support/artifice/endpoint_creds_diff_host.rb +38 -0
  257. data/spec/support/artifice/endpoint_extra.rb +31 -0
  258. data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
  259. data/spec/support/artifice/endpoint_fallback.rb +17 -0
  260. data/spec/support/artifice/endpoint_host_redirect.rb +15 -0
  261. data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
  262. data/spec/support/artifice/endpoint_redirect.rb +15 -0
  263. data/spec/support/artifice/endpoint_strict_basic_authentication.rb +18 -0
  264. data/spec/support/artifice/endpoint_timeout.rb +13 -0
  265. data/spec/support/builders.rb +748 -0
  266. data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
  267. data/spec/support/fakeweb/windows.rb +23 -0
  268. data/spec/support/hax.rb +22 -0
  269. data/spec/support/helpers.rb +348 -0
  270. data/spec/support/indexes.rb +280 -0
  271. data/spec/support/less_than_proc.rb +14 -0
  272. data/spec/support/matchers.rb +77 -0
  273. data/spec/support/path.rb +81 -0
  274. data/spec/support/permissions.rb +10 -0
  275. data/spec/support/platforms.rb +94 -0
  276. data/spec/support/ruby_ext.rb +20 -0
  277. data/spec/support/rubygems_ext.rb +39 -0
  278. data/spec/support/streams.rb +13 -0
  279. data/spec/support/sudo.rb +16 -0
  280. data/spec/update/gems_spec.rb +201 -0
  281. data/spec/update/git_spec.rb +236 -0
  282. data/spec/update/source_spec.rb +63 -0
  283. data/spec/update/svn_spec.rb +100 -0
  284. metadata +486 -0
@@ -0,0 +1,227 @@
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) { bundle :install }
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
+ end
213
+
214
+ describe "very long lines" do
215
+ before(:each) { bundle :install }
216
+ let(:long_string) do
217
+ "--with-xml2-include=/usr/pkg/include/libxml2 --with-xml2-lib=/usr/pkg/lib --with-xslt-dir=/usr/pkg"
218
+ end
219
+
220
+ it "doesn't wrap values" do
221
+ bundle "config foo #{long_string}"
222
+ run "puts Bundler.settings[:foo]"
223
+ expect(out).to match(long_string)
224
+ end
225
+ end
226
+
227
+ end
@@ -0,0 +1,102 @@
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
+ it "loads up .consolerc if it exists" do
43
+ consolerc <<-C
44
+ puts "Hello!"
45
+ C
46
+ bundle "console"
47
+ expect(out).to include("Hello!")
48
+ end
49
+
50
+ it "doesn't load any other groups" do
51
+ bundle "console" do |input|
52
+ input.puts("puts ACTIVESUPPORT")
53
+ input.puts("exit")
54
+ end
55
+ expect(out).to include("NameError")
56
+ end
57
+
58
+ describe "when given a group" do
59
+ it "loads the given group" do
60
+ bundle "console test" do |input|
61
+ input.puts("puts ACTIVESUPPORT")
62
+ input.puts("exit")
63
+ end
64
+ expect(out).to include("2.3.5")
65
+ end
66
+
67
+ it "loads the default group" do
68
+ bundle "console test" do |input|
69
+ input.puts("puts RACK")
70
+ input.puts("exit")
71
+ end
72
+ expect(out).to include("0.9.1")
73
+ end
74
+
75
+ it "doesn't load other groups" do
76
+ bundle "console test" do |input|
77
+ input.puts("puts RACK_MIDDLEWARE")
78
+ input.puts("exit")
79
+ end
80
+ expect(out).to include("NameError")
81
+ end
82
+ end
83
+
84
+ it "performs an automatic bundle install" do
85
+ gemfile <<-G
86
+ source "file://#{gem_repo1}"
87
+ gem "rack"
88
+ gem "activesupport", :group => :test
89
+ gem "rack_middleware", :group => :development
90
+ gem "foo"
91
+ G
92
+
93
+ bundle "config auto_install 1"
94
+ bundle :console do |input|
95
+ input.puts("puts 'hello'")
96
+ input.puts("exit")
97
+ end
98
+ expect(out).to include("Installing foo 1.0")
99
+ expect(out).to include("hello")
100
+ should_be_installed "foo 1.0"
101
+ end
102
+ end
@@ -0,0 +1,367 @@
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
+
310
+ describe "from gems bundled via :svn" do
311
+ before(:each) do
312
+ build_svn "fizz_svn" do |s|
313
+ s.executables = "fizz_svn"
314
+ end
315
+
316
+ install_gemfile <<-G
317
+ gem "fizz_svn", :svn => "file://#{lib_path('fizz_svn-1.0')}"
318
+ G
319
+ end
320
+
321
+ it "works when unlocked" do
322
+ bundle "exec fizz_svn"
323
+ expect(out).to eq("1.0")
324
+ end
325
+
326
+ it "works when locked" do
327
+ should_be_locked
328
+ bundle "exec fizz_svn"
329
+ expect(out).to eq("1.0")
330
+ end
331
+ end
332
+
333
+ describe "from gems bundled via :svn with no gemspec" do
334
+ before(:each) do
335
+ build_svn "fizz_no_gemspec", :gemspec => false do |s|
336
+ s.executables = "fizz_no_gemspec"
337
+ end
338
+
339
+ install_gemfile <<-G
340
+ gem "fizz_no_gemspec", "1.0", :svn => "file://#{lib_path('fizz_no_gemspec-1.0')}"
341
+ G
342
+ end
343
+
344
+ it "works when unlocked" do
345
+ bundle "exec fizz_no_gemspec"
346
+ expect(out).to eq("1.0")
347
+ end
348
+
349
+ it "works when locked" do
350
+ should_be_locked
351
+ bundle "exec fizz_no_gemspec"
352
+ expect(out).to eq("1.0")
353
+ end
354
+ end
355
+
356
+ it "performs an automatic bundle install" do
357
+ gemfile <<-G
358
+ source "file://#{gem_repo1}"
359
+ gem "rack", "0.9.1"
360
+ gem "foo"
361
+ G
362
+
363
+ bundle "config auto_install 1"
364
+ bundle "exec rackup"
365
+ expect(out).to include("Installing foo 1.0")
366
+ end
367
+ end