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,35 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle lock with svn gems" do
4
+ before :each do
5
+ build_svn "foo"
6
+
7
+ install_gemfile <<-G
8
+ gem 'foo', :svn => "file://#{lib_path('foo-1.0')}"
9
+ G
10
+ end
11
+
12
+ it "doesn't break right after running lock" do
13
+ should_be_installed "foo 1.0.0"
14
+ end
15
+
16
+ it "locks a svn source to the current ref" do
17
+ update_svn "foo" do |s|
18
+ s.write "lib/foo.rb", "puts :CACHE"
19
+ end
20
+ bundle :install
21
+
22
+ run <<-RUBY
23
+ require 'foo'
24
+ RUBY
25
+
26
+ expect(out).not_to eq("CACHE")
27
+ end
28
+
29
+ it "provides correct #full_gem_path" do
30
+ run <<-RUBY
31
+ puts Bundler.rubygems.find_name('foo').first.full_gem_path
32
+ RUBY
33
+ expect(out).to eq(bundle("show foo"))
34
+ end
35
+ end
@@ -0,0 +1,142 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle_ruby" do
4
+ context "without patchlevel" do
5
+ it "returns the ruby version" do
6
+ gemfile <<-G
7
+ source "file://#{gem_repo1}"
8
+ ruby "1.9.3", :engine => 'ruby', :engine_version => '1.9.3'
9
+
10
+ gem "foo"
11
+ G
12
+
13
+ bundle_ruby
14
+
15
+ expect(out).to eq("ruby 1.9.3")
16
+ end
17
+
18
+ it "engine defaults to MRI" do
19
+ gemfile <<-G
20
+ source "file://#{gem_repo1}"
21
+ ruby "1.9.3"
22
+
23
+ gem "foo"
24
+ G
25
+
26
+ bundle_ruby
27
+
28
+ expect(out).to eq("ruby 1.9.3")
29
+ end
30
+
31
+ it "handles jruby" do
32
+ gemfile <<-G
33
+ source "file://#{gem_repo1}"
34
+ ruby "1.8.7", :engine => 'jruby', :engine_version => '1.6.5'
35
+
36
+ gem "foo"
37
+ G
38
+
39
+ bundle_ruby
40
+
41
+ expect(out).to eq("ruby 1.8.7 (jruby 1.6.5)")
42
+ end
43
+
44
+ it "handles rbx" do
45
+ gemfile <<-G
46
+ source "file://#{gem_repo1}"
47
+ ruby "1.8.7", :engine => 'rbx', :engine_version => '1.2.4'
48
+
49
+ gem "foo"
50
+ G
51
+
52
+ bundle_ruby
53
+
54
+ expect(out).to eq("ruby 1.8.7 (rbx 1.2.4)")
55
+ end
56
+
57
+ it "raises an error if engine is used but engine version is not" do
58
+ gemfile <<-G
59
+ source "file://#{gem_repo1}"
60
+ ruby "1.8.7", :engine => 'rbx'
61
+
62
+ gem "foo"
63
+ G
64
+
65
+ bundle_ruby :exitstatus => true
66
+ expect(exitstatus).not_to eq(0)
67
+
68
+ bundle_ruby
69
+ expect(out).to eq("Please define :engine_version")
70
+ end
71
+
72
+ it "raises an error if engine_version is used but engine is not" do
73
+ gemfile <<-G
74
+ source "file://#{gem_repo1}"
75
+ ruby "1.8.7", :engine_version => '1.2.4'
76
+
77
+ gem "foo"
78
+ G
79
+
80
+ bundle_ruby :exitstatus => true
81
+ expect(exitstatus).not_to eq(0)
82
+
83
+ bundle_ruby
84
+ expect(out).to eq("Please define :engine")
85
+ end
86
+
87
+ it "raises an error if engine version doesn't match ruby version for MRI" do
88
+ gemfile <<-G
89
+ source "file://#{gem_repo1}"
90
+ ruby "1.8.7", :engine => 'ruby', :engine_version => '1.2.4'
91
+
92
+ gem "foo"
93
+ G
94
+
95
+ bundle_ruby :exitstatus => true
96
+ expect(exitstatus).not_to eq(0)
97
+
98
+ bundle_ruby
99
+ expect(out).to eq("ruby_version must match the :engine_version for MRI")
100
+ end
101
+
102
+ it "should print if no ruby version is specified" do
103
+ gemfile <<-G
104
+ source "file://#{gem_repo1}"
105
+
106
+ gem "foo"
107
+ G
108
+
109
+ bundle_ruby
110
+
111
+ expect(out).to eq("No ruby version specified")
112
+ end
113
+ end
114
+
115
+ context "when using patchlevel" do
116
+ it "returns the ruby version" do
117
+ gemfile <<-G
118
+ source "file://#{gem_repo1}"
119
+ ruby "1.9.3", :patchlevel => '429', :engine => 'ruby', :engine_version => '1.9.3'
120
+
121
+ gem "foo"
122
+ G
123
+
124
+ bundle_ruby
125
+
126
+ expect(out).to eq("ruby 1.9.3p429")
127
+ end
128
+
129
+ it "handles an engine" do
130
+ gemfile <<-G
131
+ source "file://#{gem_repo1}"
132
+ ruby "1.9.3", :patchlevel => '392', :engine => 'jruby', :engine_version => '1.7.4'
133
+
134
+ gem "foo"
135
+ G
136
+
137
+ bundle_ruby
138
+
139
+ expect(out).to eq("ruby 1.9.3p392 (jruby 1.7.4)")
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,21 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle command names" do
4
+ it "work when given fully" do
5
+ bundle "install"
6
+ expect(err).to eq("")
7
+ expect(out).not_to match(/Ambiguous command/)
8
+ end
9
+
10
+ it "work when not ambiguous" do
11
+ bundle "ins"
12
+ expect(err).to eq("")
13
+ expect(out).not_to match(/Ambiguous command/)
14
+ end
15
+
16
+ it "print a friendly error when ambiguous" do
17
+ bundle "i"
18
+ expect(err).to eq("")
19
+ expect(out).to match(/Ambiguous command/)
20
+ end
21
+ end
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Gem::Specification#match_platform" do
4
+ it "does not match platforms other than the gem platform" do
5
+ darwin = gem "lol", "1.0", "platform_specific-1.0-x86-darwin-10"
6
+ expect(darwin.match_platform(pl('java'))).to eq(false)
7
+ end
8
+ end
9
+
10
+ describe "Bundler::GemHelpers#generic" do
11
+ include Bundler::GemHelpers
12
+
13
+ it "converts non-windows platforms into ruby" do
14
+ expect(generic(pl('x86-darwin-10'))).to eq(pl('ruby'))
15
+ expect(generic(pl('ruby'))).to eq(pl('ruby'))
16
+ end
17
+
18
+ it "converts java platform variants into java" do
19
+ expect(generic(pl('universal-java-17'))).to eq(pl('java'))
20
+ expect(generic(pl('java'))).to eq(pl('java'))
21
+ end
22
+
23
+ it "converts mswin platform variants into x86-mswin32" do
24
+ expect(generic(pl('mswin32'))).to eq(pl('x86-mswin32'))
25
+ expect(generic(pl('i386-mswin32'))).to eq(pl('x86-mswin32'))
26
+ expect(generic(pl('x86-mswin32'))).to eq(pl('x86-mswin32'))
27
+ end
28
+
29
+ it "converts 32-bit mingw platform variants into x86-mingw32" do
30
+ expect(generic(pl('mingw32'))).to eq(pl('x86-mingw32'))
31
+ expect(generic(pl('i386-mingw32'))).to eq(pl('x86-mingw32'))
32
+ expect(generic(pl('x86-mingw32'))).to eq(pl('x86-mingw32'))
33
+ end
34
+
35
+ it "converts 64-bit mingw platform variants into x64-mingw32" do
36
+ expect(generic(pl('x64-mingw32'))).to eq(pl('x64-mingw32'))
37
+ expect(generic(pl('x86_64-mingw32'))).to eq(pl('x64-mingw32'))
38
+ end
39
+ end
40
+
41
+ describe "Gem::SourceIndex#refresh!" do
42
+ rubygems_1_7 = Gem::Version.new(Gem::VERSION) >= Gem::Version.new("1.7.0")
43
+
44
+ before do
45
+ install_gemfile <<-G
46
+ source "file://#{gem_repo1}"
47
+ gem "rack"
48
+ G
49
+ end
50
+
51
+ it "does not explode when called", :if => rubygems_1_7 do
52
+ run "Gem.source_index.refresh!"
53
+ run "Gem::SourceIndex.new([]).refresh!"
54
+ end
55
+
56
+ it "does not explode when called", :unless => rubygems_1_7 do
57
+ run "Gem.source_index.refresh!"
58
+ run "Gem::SourceIndex.from_gems_in([]).refresh!"
59
+ end
60
+ end
@@ -0,0 +1,1285 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle platform" do
4
+ context "without flags" do
5
+ it "returns all the output" do
6
+ gemfile <<-G
7
+ source "file://#{gem_repo1}"
8
+
9
+ #{ruby_version_correct}
10
+
11
+ gem "foo"
12
+ G
13
+
14
+ bundle "platform"
15
+ expect(out).to eq(<<-G.chomp)
16
+ Your platform is: #{RUBY_PLATFORM}
17
+
18
+ Your app has gems that work on these platforms:
19
+ * ruby
20
+
21
+ Your Gemfile specifies a Ruby version requirement:
22
+ * ruby #{RUBY_VERSION}
23
+
24
+ Your current platform satisfies the Ruby version requirement.
25
+ G
26
+ end
27
+
28
+ it "returns all the output including the patchlevel" do
29
+ gemfile <<-G
30
+ source "file://#{gem_repo1}"
31
+
32
+ #{ruby_version_correct_patchlevel}
33
+
34
+ gem "foo"
35
+ G
36
+
37
+ bundle "platform"
38
+ expect(out).to eq(<<-G.chomp)
39
+ Your platform is: #{RUBY_PLATFORM}
40
+
41
+ Your app has gems that work on these platforms:
42
+ * ruby
43
+
44
+ Your Gemfile specifies a Ruby version requirement:
45
+ * ruby #{RUBY_VERSION}p#{RUBY_PATCHLEVEL}
46
+
47
+ Your current platform satisfies the Ruby version requirement.
48
+ G
49
+ end
50
+
51
+ it "doesn't print ruby version requirement if it isn't specified" do
52
+ gemfile <<-G
53
+ source "file://#{gem_repo1}"
54
+
55
+ gem "foo"
56
+ G
57
+
58
+ bundle "platform"
59
+ expect(out).to eq(<<-G.chomp)
60
+ Your platform is: #{RUBY_PLATFORM}
61
+
62
+ Your app has gems that work on these platforms:
63
+ * ruby
64
+
65
+ Your Gemfile does not specify a Ruby version requirement.
66
+ G
67
+ end
68
+
69
+ it "doesn't match the ruby version requirement" do
70
+ gemfile <<-G
71
+ source "file://#{gem_repo1}"
72
+
73
+ #{ruby_version_incorrect}
74
+
75
+ gem "foo"
76
+ G
77
+
78
+ bundle "platform"
79
+ expect(out).to eq(<<-G.chomp)
80
+ Your platform is: #{RUBY_PLATFORM}
81
+
82
+ Your app has gems that work on these platforms:
83
+ * ruby
84
+
85
+ Your Gemfile specifies a Ruby version requirement:
86
+ * ruby #{not_local_ruby_version}
87
+
88
+ Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified #{not_local_ruby_version}
89
+ G
90
+ end
91
+ end
92
+
93
+ context "--ruby" do
94
+ it "returns ruby version when explicit" do
95
+ gemfile <<-G
96
+ source "file://#{gem_repo1}"
97
+ ruby "1.9.3", :engine => 'ruby', :engine_version => '1.9.3'
98
+
99
+ gem "foo"
100
+ G
101
+
102
+ bundle "platform --ruby"
103
+
104
+ expect(out).to eq("ruby 1.9.3")
105
+ end
106
+
107
+ it "defaults to MRI" do
108
+ gemfile <<-G
109
+ source "file://#{gem_repo1}"
110
+ ruby "1.9.3"
111
+
112
+ gem "foo"
113
+ G
114
+
115
+ bundle "platform --ruby"
116
+
117
+ expect(out).to eq("ruby 1.9.3")
118
+ end
119
+
120
+ it "handles jruby" do
121
+ gemfile <<-G
122
+ source "file://#{gem_repo1}"
123
+ ruby "1.8.7", :engine => 'jruby', :engine_version => '1.6.5'
124
+
125
+ gem "foo"
126
+ G
127
+
128
+ bundle "platform --ruby"
129
+
130
+ expect(out).to eq("ruby 1.8.7 (jruby 1.6.5)")
131
+ end
132
+
133
+ it "handles rbx" do
134
+ gemfile <<-G
135
+ source "file://#{gem_repo1}"
136
+ ruby "1.8.7", :engine => 'rbx', :engine_version => '1.2.4'
137
+
138
+ gem "foo"
139
+ G
140
+
141
+ bundle "platform --ruby"
142
+
143
+ expect(out).to eq("ruby 1.8.7 (rbx 1.2.4)")
144
+ end
145
+
146
+ it "raises an error if engine is used but engine version is not" do
147
+ gemfile <<-G
148
+ source "file://#{gem_repo1}"
149
+ ruby "1.8.7", :engine => 'rbx'
150
+
151
+ gem "foo"
152
+ G
153
+
154
+ bundle "platform", :exitstatus => true
155
+
156
+ expect(exitstatus).not_to eq(0)
157
+ end
158
+
159
+ it "raises an error if engine_version is used but engine is not" do
160
+ gemfile <<-G
161
+ source "file://#{gem_repo1}"
162
+ ruby "1.8.7", :engine_version => '1.2.4'
163
+
164
+ gem "foo"
165
+ G
166
+
167
+ bundle "platform", :exitstatus => true
168
+
169
+ expect(exitstatus).not_to eq(0)
170
+ end
171
+
172
+ it "raises an error if engine version doesn't match ruby version for MRI" do
173
+ gemfile <<-G
174
+ source "file://#{gem_repo1}"
175
+ ruby "1.8.7", :engine => 'ruby', :engine_version => '1.2.4'
176
+
177
+ gem "foo"
178
+ G
179
+
180
+ bundle "platform", :exitstatus => true
181
+
182
+ expect(exitstatus).not_to eq(0)
183
+ end
184
+
185
+ it "should print if no ruby version is specified" do
186
+ gemfile <<-G
187
+ source "file://#{gem_repo1}"
188
+
189
+ gem "foo"
190
+ G
191
+
192
+ bundle "platform --ruby"
193
+ puts err
194
+
195
+ expect(out).to eq("No ruby version specified")
196
+ end
197
+ end
198
+
199
+ let(:ruby_version_correct) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{local_engine_version}\"" }
200
+ let(:ruby_version_correct_engineless) { "ruby \"#{RUBY_VERSION}\"" }
201
+ let(:ruby_version_correct_patchlevel) { "#{ruby_version_correct}, :patchlevel => '#{RUBY_PATCHLEVEL}'" }
202
+ let(:ruby_version_incorrect) { "ruby \"#{not_local_ruby_version}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{not_local_ruby_version}\"" }
203
+ let(:engine_incorrect) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{not_local_tag}\", :engine_version => \"#{RUBY_VERSION}\"" }
204
+ let(:engine_version_incorrect) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{not_local_engine_version}\"" }
205
+ let(:patchlevel_incorrect) { "#{ruby_version_correct}, :patchlevel => '#{not_local_patchlevel}'" }
206
+ let(:patchlevel_fixnum) { "#{ruby_version_correct}, :patchlevel => #{RUBY_PATCHLEVEL}1" }
207
+
208
+ def should_be_ruby_version_incorrect(opts = {:exitstatus => true})
209
+ expect(exitstatus).to eq(18) if opts[:exitstatus]
210
+ expect(out).to be_include("Your Ruby version is #{RUBY_VERSION}, but your Gemfile specified #{not_local_ruby_version}")
211
+ end
212
+
213
+ def should_be_engine_incorrect(opts = {:exitstatus => true})
214
+ expect(exitstatus).to eq(18) if opts[:exitstatus]
215
+ expect(out).to be_include("Your Ruby engine is #{local_ruby_engine}, but your Gemfile specified #{not_local_tag}")
216
+ end
217
+
218
+ def should_be_engine_version_incorrect(opts = {:exitstatus => true})
219
+ expect(exitstatus).to eq(18) if opts[:exitstatus]
220
+ expect(out).to be_include("Your #{local_ruby_engine} version is #{local_engine_version}, but your Gemfile specified #{local_ruby_engine} #{not_local_engine_version}")
221
+ end
222
+
223
+ def should_be_patchlevel_incorrect(opts = {:exitstatus => true})
224
+ expect(exitstatus).to eq(18) if opts[:exitstatus]
225
+
226
+ expect(out).to be_include("Your Ruby patchlevel is #{RUBY_PATCHLEVEL}, but your Gemfile specified #{not_local_patchlevel}")
227
+ end
228
+
229
+ def should_be_patchlevel_fixnum(opts = {:exitstatus => true})
230
+ expect(exitstatus).to eq(18) if opts[:exitstatus]
231
+
232
+ expect(out).to be_include("The Ruby patchlevel in your Gemfile must be a string")
233
+ end
234
+
235
+ context "bundle install" do
236
+ it "installs fine when the ruby version matches" do
237
+ install_gemfile <<-G
238
+ source "file://#{gem_repo1}"
239
+ gem "rack"
240
+
241
+ #{ruby_version_correct}
242
+ G
243
+
244
+ expect(bundled_app('Gemfile.lock')).to exist
245
+ end
246
+
247
+ it "installs fine with any engine" do
248
+ simulate_ruby_engine "jruby" do
249
+ install_gemfile <<-G
250
+ source "file://#{gem_repo1}"
251
+ gem "rack"
252
+
253
+ #{ruby_version_correct_engineless}
254
+ G
255
+
256
+ expect(bundled_app('Gemfile.lock')).to exist
257
+ end
258
+ end
259
+
260
+ it "installs fine when the patchlevel matches" do
261
+ install_gemfile <<-G
262
+ source "file://#{gem_repo1}"
263
+ gem "rack"
264
+
265
+ #{ruby_version_correct_patchlevel}
266
+ G
267
+
268
+ expect(bundled_app('Gemfile.lock')).to exist
269
+ end
270
+
271
+ it "doesn't install when the ruby version doesn't match" do
272
+ install_gemfile <<-G, :exitstatus => true
273
+ source "file://#{gem_repo1}"
274
+ gem "rack"
275
+
276
+ #{ruby_version_incorrect}
277
+ G
278
+
279
+ expect(bundled_app('Gemfile.lock')).not_to exist
280
+ should_be_ruby_version_incorrect
281
+ end
282
+
283
+ it "doesn't install when engine doesn't match" do
284
+ install_gemfile <<-G, :exitstatus => true
285
+ source "file://#{gem_repo1}"
286
+ gem "rack"
287
+
288
+ #{engine_incorrect}
289
+ G
290
+
291
+ expect(bundled_app('Gemfile.lock')).not_to exist
292
+ should_be_engine_incorrect
293
+ end
294
+
295
+ it "doesn't install when engine version doesn't match" do
296
+ simulate_ruby_engine "jruby" do
297
+ install_gemfile <<-G, :exitstatus => true
298
+ source "file://#{gem_repo1}"
299
+ gem "rack"
300
+
301
+ #{engine_version_incorrect}
302
+ G
303
+
304
+ expect(bundled_app('Gemfile.lock')).not_to exist
305
+ should_be_engine_version_incorrect
306
+ end
307
+ end
308
+
309
+ it "doesn't install when patchlevel doesn't match" do
310
+ install_gemfile <<-G, :exitstatus => true
311
+ source "file://#{gem_repo1}"
312
+ gem "rack"
313
+
314
+ #{patchlevel_incorrect}
315
+ G
316
+
317
+ expect(bundled_app('Gemfile.lock')).not_to exist
318
+ should_be_patchlevel_incorrect
319
+ end
320
+ end
321
+
322
+ context "bundle check" do
323
+ it "checks fine when the ruby version matches" do
324
+ install_gemfile <<-G
325
+ source "file://#{gem_repo1}"
326
+ gem "rack"
327
+ G
328
+
329
+ gemfile <<-G
330
+ source "file://#{gem_repo1}"
331
+ gem "rack"
332
+
333
+ #{ruby_version_correct}
334
+ G
335
+
336
+ bundle :check, :exitstatus => true
337
+ expect(exitstatus).to eq(0)
338
+ expect(out).to eq("The Gemfile's dependencies are satisfied")
339
+ end
340
+
341
+ it "checks fine with any engine" do
342
+ simulate_ruby_engine "jruby" do
343
+ install_gemfile <<-G
344
+ source "file://#{gem_repo1}"
345
+ gem "rack"
346
+ G
347
+
348
+ gemfile <<-G
349
+ source "file://#{gem_repo1}"
350
+ gem "rack"
351
+
352
+ #{ruby_version_correct_engineless}
353
+ G
354
+
355
+ bundle :check, :exitstatus => true
356
+ expect(exitstatus).to eq(0)
357
+ expect(out).to eq("The Gemfile's dependencies are satisfied")
358
+ end
359
+ end
360
+
361
+ it "fails when ruby version doesn't match" do
362
+ install_gemfile <<-G
363
+ source "file://#{gem_repo1}"
364
+ gem "rack"
365
+ G
366
+
367
+ gemfile <<-G
368
+ source "file://#{gem_repo1}"
369
+ gem "rack"
370
+
371
+ #{ruby_version_incorrect}
372
+ G
373
+
374
+ bundle :check, :exitstatus => true
375
+ should_be_ruby_version_incorrect
376
+ end
377
+
378
+ it "fails when engine doesn't match" do
379
+ install_gemfile <<-G
380
+ source "file://#{gem_repo1}"
381
+ gem "rack"
382
+ G
383
+
384
+ gemfile <<-G
385
+ source "file://#{gem_repo1}"
386
+ gem "rack"
387
+
388
+ #{engine_incorrect}
389
+ G
390
+
391
+ bundle :check, :exitstatus => true
392
+ should_be_engine_incorrect
393
+ end
394
+
395
+ it "fails when engine version doesn't match" do
396
+ simulate_ruby_engine "ruby" do
397
+ install_gemfile <<-G
398
+ source "file://#{gem_repo1}"
399
+ gem "rack"
400
+ G
401
+
402
+ gemfile <<-G
403
+ source "file://#{gem_repo1}"
404
+ gem "rack"
405
+
406
+ #{engine_version_incorrect}
407
+ G
408
+
409
+ bundle :check, :exitstatus => true
410
+ should_be_engine_version_incorrect
411
+ end
412
+ end
413
+
414
+ it "fails when patchlevel doesn't match" do
415
+ install_gemfile <<-G, :exitstatus => true
416
+ source "file://#{gem_repo1}"
417
+ gem "rack"
418
+ G
419
+
420
+ gemfile <<-G
421
+ source "file://#{gem_repo1}"
422
+ gem "rack"
423
+
424
+ #{patchlevel_incorrect}
425
+ G
426
+
427
+ bundle :check, :exitstatus => true
428
+ should_be_patchlevel_incorrect
429
+ end
430
+ end
431
+
432
+ context "bundle update" do
433
+ before do
434
+ build_repo2
435
+
436
+ install_gemfile <<-G
437
+ source "file://#{gem_repo2}"
438
+ gem "activesupport"
439
+ gem "rack-obama"
440
+ G
441
+ end
442
+
443
+ it "updates successfully when the ruby version matches" do
444
+ gemfile <<-G
445
+ source "file://#{gem_repo2}"
446
+ gem "activesupport"
447
+ gem "rack-obama"
448
+
449
+ #{ruby_version_correct}
450
+ G
451
+ update_repo2 do
452
+ build_gem "activesupport", "3.0"
453
+ end
454
+
455
+ bundle "update"
456
+ should_be_installed "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
457
+ end
458
+
459
+ it "updates fine with any engine" do
460
+ simulate_ruby_engine "jruby" do
461
+ gemfile <<-G
462
+ source "file://#{gem_repo2}"
463
+ gem "activesupport"
464
+ gem "rack-obama"
465
+
466
+ #{ruby_version_correct_engineless}
467
+ G
468
+ update_repo2 do
469
+ build_gem "activesupport", "3.0"
470
+ end
471
+
472
+ bundle "update"
473
+ should_be_installed "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
474
+ end
475
+ end
476
+
477
+ it "fails when ruby version doesn't match" do
478
+ gemfile <<-G
479
+ source "file://#{gem_repo2}"
480
+ gem "activesupport"
481
+ gem "rack-obama"
482
+
483
+ #{ruby_version_incorrect}
484
+ G
485
+ update_repo2 do
486
+ build_gem "activesupport", "3.0"
487
+ end
488
+
489
+ bundle :update, :exitstatus => true
490
+ should_be_ruby_version_incorrect
491
+ end
492
+
493
+ it "fails when ruby engine doesn't match" do
494
+ gemfile <<-G
495
+ source "file://#{gem_repo2}"
496
+ gem "activesupport"
497
+ gem "rack-obama"
498
+
499
+ #{engine_incorrect}
500
+ G
501
+ update_repo2 do
502
+ build_gem "activesupport", "3.0"
503
+ end
504
+
505
+ bundle :update, :exitstatus => true
506
+ should_be_engine_incorrect
507
+ end
508
+
509
+ it "fails when ruby engine version doesn't match" do
510
+ simulate_ruby_engine "jruby" do
511
+ gemfile <<-G
512
+ source "file://#{gem_repo2}"
513
+ gem "activesupport"
514
+ gem "rack-obama"
515
+
516
+ #{engine_version_incorrect}
517
+ G
518
+ update_repo2 do
519
+ build_gem "activesupport", "3.0"
520
+ end
521
+
522
+ bundle :update, :exitstatus => true
523
+ should_be_engine_version_incorrect
524
+ end
525
+ end
526
+
527
+ it "fails when patchlevel doesn't match" do
528
+ gemfile <<-G, :exitstatus => true
529
+ source "file://#{gem_repo1}"
530
+ gem "rack"
531
+
532
+ #{patchlevel_incorrect}
533
+ G
534
+ update_repo2 do
535
+ build_gem "activesupport", "3.0"
536
+ end
537
+
538
+ bundle :update, :exitstatus => true
539
+ should_be_patchlevel_incorrect
540
+ end
541
+ end
542
+
543
+ context "bundle show" do
544
+ before do
545
+ install_gemfile <<-G
546
+ source "file://#{gem_repo1}"
547
+ gem "rails"
548
+ G
549
+ end
550
+
551
+ it "prints path if ruby version is correct" do
552
+ gemfile <<-G
553
+ source "file://#{gem_repo1}"
554
+ gem "rails"
555
+
556
+ #{ruby_version_correct}
557
+ G
558
+
559
+ bundle "show rails"
560
+ expect(out).to eq(default_bundle_path('gems', 'rails-2.3.2').to_s)
561
+ end
562
+
563
+ it "prints path if ruby version is correct for any engine" do
564
+ simulate_ruby_engine "jruby" do
565
+ gemfile <<-G
566
+ source "file://#{gem_repo1}"
567
+ gem "rails"
568
+
569
+ #{ruby_version_correct_engineless}
570
+ G
571
+
572
+ bundle "show rails"
573
+ expect(out).to eq(default_bundle_path('gems', 'rails-2.3.2').to_s)
574
+ end
575
+ end
576
+
577
+ it "fails if ruby version doesn't match" do
578
+ gemfile <<-G
579
+ source "file://#{gem_repo1}"
580
+ gem "rails"
581
+
582
+ #{ruby_version_incorrect}
583
+ G
584
+
585
+ bundle "show rails", :exitstatus => true
586
+ should_be_ruby_version_incorrect
587
+ end
588
+
589
+ it "fails if engine doesn't match" do
590
+ gemfile <<-G
591
+ source "file://#{gem_repo1}"
592
+ gem "rails"
593
+
594
+ #{engine_incorrect}
595
+ G
596
+
597
+ bundle "show rails", :exitstatus => true
598
+ should_be_engine_incorrect
599
+ end
600
+
601
+ it "fails if engine version doesn't match" do
602
+ simulate_ruby_engine "jruby" do
603
+ gemfile <<-G
604
+ source "file://#{gem_repo1}"
605
+ gem "rails"
606
+
607
+ #{engine_version_incorrect}
608
+ G
609
+
610
+ bundle "show rails", :exitstatus => true
611
+ should_be_engine_version_incorrect
612
+ end
613
+ end
614
+
615
+ it "fails when patchlevel doesn't match" do
616
+ gemfile <<-G, :exitstatus => true
617
+ source "file://#{gem_repo1}"
618
+ gem "rack"
619
+
620
+ #{patchlevel_incorrect}
621
+ G
622
+ update_repo2 do
623
+ build_gem "activesupport", "3.0"
624
+ end
625
+
626
+ bundle "show rails", :exitstatus => true
627
+ should_be_patchlevel_incorrect
628
+ end
629
+ end
630
+
631
+ context "bundle cache" do
632
+ before do
633
+ gemfile <<-G
634
+ gem 'rack'
635
+ G
636
+
637
+ system_gems "rack-1.0.0"
638
+ end
639
+
640
+ it "copies the .gem file to vendor/cache when ruby version matches" do
641
+ gemfile <<-G
642
+ gem 'rack'
643
+
644
+ #{ruby_version_correct}
645
+ G
646
+
647
+ bundle :cache
648
+ expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
649
+ end
650
+
651
+ it "copies the .gem file to vendor/cache when ruby version matches for any engine" do
652
+ simulate_ruby_engine "jruby" do
653
+ gemfile <<-G
654
+ gem 'rack'
655
+
656
+ #{ruby_version_correct_engineless}
657
+ G
658
+
659
+ bundle :cache
660
+ expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
661
+ end
662
+ end
663
+
664
+ it "fails if the ruby version doesn't match" do
665
+ gemfile <<-G
666
+ gem 'rack'
667
+
668
+ #{ruby_version_incorrect}
669
+ G
670
+
671
+ bundle :cache, :exitstatus => true
672
+ should_be_ruby_version_incorrect
673
+ end
674
+
675
+ it "fails if the engine doesn't match" do
676
+ gemfile <<-G
677
+ gem 'rack'
678
+
679
+ #{engine_incorrect}
680
+ G
681
+
682
+ bundle :cache, :exitstatus => true
683
+ should_be_engine_incorrect
684
+ end
685
+
686
+ it "fails if the engine version doesn't match" do
687
+ simulate_ruby_engine "jruby" do
688
+ gemfile <<-G
689
+ gem 'rack'
690
+
691
+ #{engine_version_incorrect}
692
+ G
693
+
694
+ bundle :cache, :exitstatus => true
695
+ should_be_engine_version_incorrect
696
+ end
697
+ end
698
+
699
+ it "fails when patchlevel doesn't match" do
700
+ gemfile <<-G, :exitstatus => true
701
+ source "file://#{gem_repo1}"
702
+ gem "rack"
703
+
704
+ #{patchlevel_incorrect}
705
+ G
706
+
707
+ bundle :cache, :exitstatus => true
708
+ should_be_patchlevel_incorrect
709
+ end
710
+ end
711
+
712
+ context "bundle pack" do
713
+ before do
714
+ gemfile <<-G
715
+ gem 'rack'
716
+ G
717
+
718
+ system_gems "rack-1.0.0"
719
+ end
720
+
721
+ it "copies the .gem file to vendor/cache when ruby version matches" do
722
+ gemfile <<-G
723
+ gem 'rack'
724
+
725
+ #{ruby_version_correct}
726
+ G
727
+
728
+ bundle :pack
729
+ expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
730
+ end
731
+
732
+ it "copies the .gem file to vendor/cache when ruby version matches any engine" do
733
+ simulate_ruby_engine "jruby" do
734
+ gemfile <<-G
735
+ gem 'rack'
736
+
737
+ #{ruby_version_correct_engineless}
738
+ G
739
+
740
+ bundle :pack
741
+ expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
742
+ end
743
+ end
744
+
745
+ it "fails if the ruby version doesn't match" do
746
+ gemfile <<-G
747
+ gem 'rack'
748
+
749
+ #{ruby_version_incorrect}
750
+ G
751
+
752
+ bundle :pack, :exitstatus => true
753
+ should_be_ruby_version_incorrect
754
+ end
755
+
756
+ it "fails if the engine doesn't match" do
757
+ gemfile <<-G
758
+ gem 'rack'
759
+
760
+ #{engine_incorrect}
761
+ G
762
+
763
+ bundle :pack, :exitstatus => true
764
+ should_be_engine_incorrect
765
+ end
766
+
767
+ it "fails if the engine version doesn't match" do
768
+ simulate_ruby_engine "jruby" do
769
+ gemfile <<-G
770
+ gem 'rack'
771
+
772
+ #{engine_version_incorrect}
773
+ G
774
+
775
+ bundle :pack, :exitstatus => true
776
+ should_be_engine_version_incorrect
777
+ end
778
+ end
779
+
780
+ it "fails when patchlevel doesn't match" do
781
+ gemfile <<-G, :exitstatus => true
782
+ source "file://#{gem_repo1}"
783
+ gem "rack"
784
+
785
+ #{patchlevel_incorrect}
786
+ G
787
+
788
+ bundle :pack, :exitstatus => true
789
+ should_be_patchlevel_incorrect
790
+ end
791
+ end
792
+
793
+ context "bundle exec" do
794
+ before do
795
+ system_gems "rack-1.0.0", "rack-0.9.1"
796
+ end
797
+
798
+ it "activates the correct gem when ruby version matches" do
799
+ gemfile <<-G
800
+ gem "rack", "0.9.1"
801
+
802
+ #{ruby_version_correct}
803
+ G
804
+
805
+ bundle "exec rackup"
806
+ expect(out).to eq("0.9.1")
807
+ end
808
+
809
+ it "activates the correct gem when ruby version matches any engine" do
810
+ simulate_ruby_engine "jruby" do
811
+ gemfile <<-G
812
+ gem "rack", "0.9.1"
813
+
814
+ #{ruby_version_correct_engineless}
815
+ G
816
+
817
+ bundle "exec rackup"
818
+ expect(out).to eq("0.9.1")
819
+ end
820
+ end
821
+
822
+ it "fails when the ruby version doesn't match" do
823
+ gemfile <<-G
824
+ gem "rack", "0.9.1"
825
+
826
+ #{ruby_version_incorrect}
827
+ G
828
+
829
+ bundle "exec rackup", :exitstatus => true
830
+ should_be_ruby_version_incorrect
831
+ end
832
+
833
+ it "fails when the engine doesn't match" do
834
+ gemfile <<-G
835
+ gem "rack", "0.9.1"
836
+
837
+ #{engine_incorrect}
838
+ G
839
+
840
+ bundle "exec rackup", :exitstatus => true
841
+ should_be_engine_incorrect
842
+ end
843
+
844
+ it "fails when the engine version doesn't match" do
845
+ simulate_ruby_engine "jruby" do
846
+ gemfile <<-G
847
+ gem "rack", "0.9.1"
848
+
849
+ #{engine_version_incorrect}
850
+ G
851
+
852
+ bundle "exec rackup", :exitstatus => true
853
+ should_be_engine_version_incorrect
854
+ end
855
+ end
856
+
857
+ it "fails when patchlevel doesn't match" do
858
+ gemfile <<-G, :exitstatus => true
859
+ source "file://#{gem_repo1}"
860
+ gem "rack"
861
+
862
+ #{patchlevel_incorrect}
863
+ G
864
+
865
+ bundle "exec rackup", :exitstatus => true
866
+ should_be_patchlevel_incorrect
867
+ end
868
+ end
869
+
870
+ context "bundle console" do
871
+ before do
872
+ install_gemfile <<-G
873
+ source "file://#{gem_repo1}"
874
+ gem "rack"
875
+ gem "activesupport", :group => :test
876
+ gem "rack_middleware", :group => :development
877
+ G
878
+ end
879
+
880
+ it "starts IRB with the default group loaded when ruby version matches" do
881
+ gemfile <<-G
882
+ source "file://#{gem_repo1}"
883
+ gem "rack"
884
+ gem "activesupport", :group => :test
885
+ gem "rack_middleware", :group => :development
886
+
887
+ #{ruby_version_correct}
888
+ G
889
+
890
+ bundle "console" do |input|
891
+ input.puts("puts RACK")
892
+ input.puts("exit")
893
+ end
894
+ expect(out).to include("0.9.1")
895
+ end
896
+
897
+ it "starts IRB with the default group loaded when ruby version matches any engine" do
898
+ simulate_ruby_engine "jruby" do
899
+ gemfile <<-G
900
+ source "file://#{gem_repo1}"
901
+ gem "rack"
902
+ gem "activesupport", :group => :test
903
+ gem "rack_middleware", :group => :development
904
+
905
+ #{ruby_version_correct_engineless}
906
+ G
907
+
908
+ bundle "console" do |input|
909
+ input.puts("puts RACK")
910
+ input.puts("exit")
911
+ end
912
+ expect(out).to include("0.9.1")
913
+ end
914
+ end
915
+
916
+ it "fails when ruby version doesn't match" do
917
+ gemfile <<-G
918
+ source "file://#{gem_repo1}"
919
+ gem "rack"
920
+ gem "activesupport", :group => :test
921
+ gem "rack_middleware", :group => :development
922
+
923
+ #{ruby_version_incorrect}
924
+ G
925
+
926
+ bundle "console", :exitstatus => true
927
+ should_be_ruby_version_incorrect
928
+ end
929
+
930
+ it "fails when engine doesn't match" do
931
+ gemfile <<-G
932
+ source "file://#{gem_repo1}"
933
+ gem "rack"
934
+ gem "activesupport", :group => :test
935
+ gem "rack_middleware", :group => :development
936
+
937
+ #{engine_incorrect}
938
+ G
939
+
940
+ bundle "console", :exitstatus => true
941
+ should_be_engine_incorrect
942
+ end
943
+
944
+ it "fails when engine version doesn't match" do
945
+ simulate_ruby_engine "jruby" do
946
+ gemfile <<-G
947
+ source "file://#{gem_repo1}"
948
+ gem "rack"
949
+ gem "activesupport", :group => :test
950
+ gem "rack_middleware", :group => :development
951
+
952
+ #{engine_version_incorrect}
953
+ G
954
+
955
+ bundle "console", :exitstatus => true
956
+ should_be_engine_version_incorrect
957
+ end
958
+ end
959
+
960
+ it "fails when patchlevel doesn't match" do
961
+ gemfile <<-G, :exitstatus => true
962
+ source "file://#{gem_repo1}"
963
+ gem "rack"
964
+ gem "activesupport", :group => :test
965
+ gem "rack_middleware", :group => :development
966
+
967
+ #{patchlevel_incorrect}
968
+ G
969
+
970
+ bundle "console", :exitstatus => true
971
+ should_be_patchlevel_incorrect
972
+ end
973
+ end
974
+
975
+ context "Bundler.setup" do
976
+ before do
977
+ install_gemfile <<-G
978
+ source "file://#{gem_repo1}"
979
+ gem "yard"
980
+ gem "rack", :group => :test
981
+ G
982
+ end
983
+
984
+ it "makes a Gemfile.lock if setup succeeds" do
985
+ install_gemfile <<-G
986
+ source "file://#{gem_repo1}"
987
+ gem "yard"
988
+ gem "rack"
989
+
990
+ #{ruby_version_correct}
991
+ G
992
+
993
+ File.read(bundled_app("Gemfile.lock"))
994
+
995
+ FileUtils.rm(bundled_app("Gemfile.lock"))
996
+
997
+ run "1"
998
+ expect(bundled_app("Gemfile.lock")).to exist
999
+ end
1000
+
1001
+ it "makes a Gemfile.lock if setup succeeds for any engine" do
1002
+ simulate_ruby_engine "jruby" do
1003
+ install_gemfile <<-G
1004
+ source "file://#{gem_repo1}"
1005
+ gem "yard"
1006
+ gem "rack"
1007
+
1008
+ #{ruby_version_correct_engineless}
1009
+ G
1010
+
1011
+ File.read(bundled_app("Gemfile.lock"))
1012
+
1013
+ FileUtils.rm(bundled_app("Gemfile.lock"))
1014
+
1015
+ run "1"
1016
+ expect(bundled_app("Gemfile.lock")).to exist
1017
+ end
1018
+ end
1019
+
1020
+ it "fails when ruby version doesn't match" do
1021
+ install_gemfile <<-G
1022
+ source "file://#{gem_repo1}"
1023
+ gem "yard"
1024
+ gem "rack"
1025
+
1026
+ #{ruby_version_incorrect}
1027
+ G
1028
+
1029
+ File.read(bundled_app("Gemfile.lock"))
1030
+
1031
+ FileUtils.rm(bundled_app("Gemfile.lock"))
1032
+
1033
+ ruby <<-R
1034
+ require 'rubygems'
1035
+ require 'bundler'
1036
+
1037
+ begin
1038
+ Bundler.setup
1039
+ rescue Bundler::RubyVersionMismatch => e
1040
+ puts e.message
1041
+ end
1042
+ R
1043
+
1044
+ expect(bundled_app("Gemfile.lock")).not_to exist
1045
+ should_be_ruby_version_incorrect(:exitstatus => false)
1046
+ end
1047
+
1048
+ it "fails when engine doesn't match" do
1049
+ install_gemfile <<-G
1050
+ source "file://#{gem_repo1}"
1051
+ gem "yard"
1052
+ gem "rack"
1053
+
1054
+ #{engine_incorrect}
1055
+ G
1056
+
1057
+ File.read(bundled_app("Gemfile.lock"))
1058
+
1059
+ FileUtils.rm(bundled_app("Gemfile.lock"))
1060
+
1061
+ ruby <<-R
1062
+ require 'rubygems'
1063
+ require 'bundler'
1064
+
1065
+ begin
1066
+ Bundler.setup
1067
+ rescue Bundler::RubyVersionMismatch => e
1068
+ puts e.message
1069
+ end
1070
+ R
1071
+
1072
+ expect(bundled_app("Gemfile.lock")).not_to exist
1073
+ should_be_engine_incorrect(:exitstatus => false)
1074
+ end
1075
+
1076
+ it "fails when engine version doesn't match" do
1077
+ simulate_ruby_engine "jruby" do
1078
+ install_gemfile <<-G
1079
+ source "file://#{gem_repo1}"
1080
+ gem "yard"
1081
+ gem "rack"
1082
+
1083
+ #{engine_version_incorrect}
1084
+ G
1085
+
1086
+ File.read(bundled_app("Gemfile.lock"))
1087
+
1088
+ FileUtils.rm(bundled_app("Gemfile.lock"))
1089
+
1090
+ ruby <<-R
1091
+ require 'rubygems'
1092
+ require 'bundler'
1093
+
1094
+ begin
1095
+ Bundler.setup
1096
+ rescue Bundler::RubyVersionMismatch => e
1097
+ puts e.message
1098
+ end
1099
+ R
1100
+
1101
+ expect(bundled_app("Gemfile.lock")).not_to exist
1102
+ should_be_engine_version_incorrect(:exitstatus => false)
1103
+ end
1104
+ end
1105
+
1106
+ it "fails when patchlevel doesn't match" do
1107
+ install_gemfile <<-G
1108
+ source "file://#{gem_repo1}"
1109
+ gem "yard"
1110
+ gem "rack"
1111
+
1112
+ #{patchlevel_incorrect}
1113
+ G
1114
+
1115
+ puts File.read(bundled_app("Gemfile"))
1116
+ File.read(bundled_app("Gemfile.lock"))
1117
+
1118
+ FileUtils.rm(bundled_app("Gemfile.lock"))
1119
+
1120
+ ruby <<-R
1121
+ require 'rubygems'
1122
+ require 'bundler'
1123
+
1124
+ begin
1125
+ Bundler.setup
1126
+ rescue Bundler::RubyVersionMismatch => e
1127
+ puts e.message
1128
+ end
1129
+ R
1130
+
1131
+ expect(bundled_app("Gemfile.lock")).not_to exist
1132
+ should_be_patchlevel_incorrect(:exitstatus => false)
1133
+ end
1134
+ end
1135
+
1136
+ context "bundle outdated" do
1137
+ before do
1138
+ build_repo2 do
1139
+ build_git "foo", :path => lib_path("foo")
1140
+ end
1141
+
1142
+ install_gemfile <<-G
1143
+ source "file://#{gem_repo2}"
1144
+ gem "activesupport", "2.3.5"
1145
+ gem "foo", :git => "#{lib_path('foo')}"
1146
+ G
1147
+ end
1148
+
1149
+ it "returns list of outdated gems when the ruby version matches" do
1150
+ update_repo2 do
1151
+ build_gem "activesupport", "3.0"
1152
+ update_git "foo", :path => lib_path("foo")
1153
+ end
1154
+
1155
+ gemfile <<-G
1156
+ source "file://#{gem_repo2}"
1157
+ gem "activesupport", "2.3.5"
1158
+ gem "foo", :git => "#{lib_path('foo')}"
1159
+
1160
+ #{ruby_version_correct}
1161
+ G
1162
+
1163
+ bundle "outdated"
1164
+ expect(out).to include("activesupport (3.0 > 2.3.5)")
1165
+ expect(out).to include("foo (1.0")
1166
+ end
1167
+
1168
+ it "returns list of outdated gems when the ruby version matches for any engine" do
1169
+ simulate_ruby_engine "jruby" do
1170
+ update_repo2 do
1171
+ build_gem "activesupport", "3.0"
1172
+ update_git "foo", :path => lib_path("foo")
1173
+ end
1174
+
1175
+ gemfile <<-G
1176
+ source "file://#{gem_repo2}"
1177
+ gem "activesupport", "2.3.5"
1178
+ gem "foo", :git => "#{lib_path('foo')}"
1179
+
1180
+ #{ruby_version_correct_engineless}
1181
+ G
1182
+
1183
+ bundle "outdated"
1184
+ expect(out).to include("activesupport (3.0 > 2.3.5)")
1185
+ expect(out).to include("foo (1.0")
1186
+ end
1187
+ end
1188
+
1189
+ it "fails when the ruby version doesn't match" do
1190
+ update_repo2 do
1191
+ build_gem "activesupport", "3.0"
1192
+ update_git "foo", :path => lib_path("foo")
1193
+ end
1194
+
1195
+ gemfile <<-G
1196
+ source "file://#{gem_repo2}"
1197
+ gem "activesupport", "2.3.5"
1198
+ gem "foo", :git => "#{lib_path('foo')}"
1199
+
1200
+ #{ruby_version_incorrect}
1201
+ G
1202
+
1203
+ bundle "outdated", :exitstatus => true
1204
+ should_be_ruby_version_incorrect
1205
+ end
1206
+
1207
+ it "fails when the engine doesn't match" do
1208
+ update_repo2 do
1209
+ build_gem "activesupport", "3.0"
1210
+ update_git "foo", :path => lib_path("foo")
1211
+ end
1212
+
1213
+ gemfile <<-G
1214
+ source "file://#{gem_repo2}"
1215
+ gem "activesupport", "2.3.5"
1216
+ gem "foo", :git => "#{lib_path('foo')}"
1217
+
1218
+ #{engine_incorrect}
1219
+ G
1220
+
1221
+ bundle "outdated", :exitstatus => true
1222
+ should_be_engine_incorrect
1223
+ end
1224
+
1225
+ it "fails when the engine version doesn't match" do
1226
+ simulate_ruby_engine "jruby" do
1227
+ update_repo2 do
1228
+ build_gem "activesupport", "3.0"
1229
+ update_git "foo", :path => lib_path("foo")
1230
+ end
1231
+
1232
+ gemfile <<-G
1233
+ source "file://#{gem_repo2}"
1234
+ gem "activesupport", "2.3.5"
1235
+ gem "foo", :git => "#{lib_path('foo')}"
1236
+
1237
+ #{engine_version_incorrect}
1238
+ G
1239
+
1240
+ bundle "outdated", :exitstatus => true
1241
+ should_be_engine_version_incorrect
1242
+ end
1243
+ end
1244
+
1245
+ it "fails when the patchlevel doesn't match" do
1246
+ simulate_ruby_engine "jruby" do
1247
+ update_repo2 do
1248
+ build_gem "activesupport", "3.0"
1249
+ update_git "foo", :path => lib_path("foo")
1250
+ end
1251
+
1252
+ gemfile <<-G
1253
+ source "file://#{gem_repo2}"
1254
+ gem "activesupport", "2.3.5"
1255
+ gem "foo", :git => "#{lib_path('foo')}"
1256
+
1257
+ #{patchlevel_incorrect}
1258
+ G
1259
+
1260
+ bundle "outdated", :exitstatus => true
1261
+ should_be_patchlevel_incorrect
1262
+ end
1263
+ end
1264
+
1265
+ it "fails when the patchlevel is a fixnum" do
1266
+ simulate_ruby_engine "jruby" do
1267
+ update_repo2 do
1268
+ build_gem "activesupport", "3.0"
1269
+ update_git "foo", :path => lib_path("foo")
1270
+ end
1271
+
1272
+ gemfile <<-G
1273
+ source "file://#{gem_repo2}"
1274
+ gem "activesupport", "2.3.5"
1275
+ gem "foo", :git => "#{lib_path('foo')}"
1276
+
1277
+ #{patchlevel_fixnum}
1278
+ G
1279
+
1280
+ bundle "outdated", :exitstatus => true
1281
+ should_be_patchlevel_fixnum
1282
+ end
1283
+ end
1284
+ end
1285
+ end