rkh-bundler 1.2.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. data/.gitignore +22 -0
  2. data/.travis.yml +42 -0
  3. data/CHANGELOG.md +1105 -0
  4. data/ISSUES.md +67 -0
  5. data/LICENSE +23 -0
  6. data/README.md +31 -0
  7. data/Rakefile +208 -0
  8. data/UPGRADING.md +103 -0
  9. data/bin/bundle +31 -0
  10. data/bundler.gemspec +31 -0
  11. data/lib/bundler.rb +353 -0
  12. data/lib/bundler/capistrano.rb +11 -0
  13. data/lib/bundler/cli.rb +693 -0
  14. data/lib/bundler/definition.rb +568 -0
  15. data/lib/bundler/dep_proxy.rb +43 -0
  16. data/lib/bundler/dependency.rb +134 -0
  17. data/lib/bundler/deployment.rb +58 -0
  18. data/lib/bundler/dsl.rb +256 -0
  19. data/lib/bundler/endpoint_specification.rb +78 -0
  20. data/lib/bundler/environment.rb +47 -0
  21. data/lib/bundler/fetcher.rb +225 -0
  22. data/lib/bundler/gem_helper.rb +162 -0
  23. data/lib/bundler/gem_helpers.rb +23 -0
  24. data/lib/bundler/gem_installer.rb +9 -0
  25. data/lib/bundler/gem_tasks.rb +2 -0
  26. data/lib/bundler/graph.rb +148 -0
  27. data/lib/bundler/index.rb +187 -0
  28. data/lib/bundler/installer.rb +190 -0
  29. data/lib/bundler/lazy_specification.rb +79 -0
  30. data/lib/bundler/lockfile_parser.rb +127 -0
  31. data/lib/bundler/match_platform.rb +13 -0
  32. data/lib/bundler/psyched_yaml.rb +15 -0
  33. data/lib/bundler/remote_specification.rb +57 -0
  34. data/lib/bundler/resolver.rb +486 -0
  35. data/lib/bundler/ruby_version.rb +94 -0
  36. data/lib/bundler/rubygems_ext.rb +153 -0
  37. data/lib/bundler/rubygems_integration.rb +394 -0
  38. data/lib/bundler/runtime.rb +233 -0
  39. data/lib/bundler/settings.rb +128 -0
  40. data/lib/bundler/setup.rb +23 -0
  41. data/lib/bundler/shared_helpers.rb +71 -0
  42. data/lib/bundler/source.rb +869 -0
  43. data/lib/bundler/spec_set.rb +137 -0
  44. data/lib/bundler/templates/Executable +16 -0
  45. data/lib/bundler/templates/Executable.standalone +12 -0
  46. data/lib/bundler/templates/Gemfile +4 -0
  47. data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  48. data/lib/bundler/templates/newgem/LICENSE.tt +22 -0
  49. data/lib/bundler/templates/newgem/README.md.tt +29 -0
  50. data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
  51. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  52. data/lib/bundler/templates/newgem/gitignore.tt +17 -0
  53. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +9 -0
  54. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  55. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -0
  56. data/lib/bundler/ui.rb +88 -0
  57. data/lib/bundler/vendor/net/http/faster.rb +27 -0
  58. data/lib/bundler/vendor/net/http/persistent.rb +468 -0
  59. data/lib/bundler/vendor/thor.rb +358 -0
  60. data/lib/bundler/vendor/thor/actions.rb +314 -0
  61. data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
  62. data/lib/bundler/vendor/thor/actions/create_link.rb +57 -0
  63. data/lib/bundler/vendor/thor/actions/directory.rb +93 -0
  64. data/lib/bundler/vendor/thor/actions/empty_directory.rb +134 -0
  65. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +270 -0
  66. data/lib/bundler/vendor/thor/actions/inject_into_file.rb +109 -0
  67. data/lib/bundler/vendor/thor/base.rb +576 -0
  68. data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +9 -0
  69. data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  70. data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +100 -0
  71. data/lib/bundler/vendor/thor/error.rb +30 -0
  72. data/lib/bundler/vendor/thor/group.rb +273 -0
  73. data/lib/bundler/vendor/thor/invocation.rb +168 -0
  74. data/lib/bundler/vendor/thor/parser.rb +4 -0
  75. data/lib/bundler/vendor/thor/parser/argument.rb +67 -0
  76. data/lib/bundler/vendor/thor/parser/arguments.rb +161 -0
  77. data/lib/bundler/vendor/thor/parser/option.rb +120 -0
  78. data/lib/bundler/vendor/thor/parser/options.rb +172 -0
  79. data/lib/bundler/vendor/thor/rake_compat.rb +66 -0
  80. data/lib/bundler/vendor/thor/runner.rb +309 -0
  81. data/lib/bundler/vendor/thor/shell.rb +88 -0
  82. data/lib/bundler/vendor/thor/shell/basic.rb +302 -0
  83. data/lib/bundler/vendor/thor/shell/color.rb +108 -0
  84. data/lib/bundler/vendor/thor/shell/html.rb +121 -0
  85. data/lib/bundler/vendor/thor/task.rb +113 -0
  86. data/lib/bundler/vendor/thor/util.rb +229 -0
  87. data/lib/bundler/vendor/thor/version.rb +3 -0
  88. data/lib/bundler/vendored_thor.rb +7 -0
  89. data/lib/bundler/version.rb +6 -0
  90. data/lib/bundler/vlad.rb +11 -0
  91. data/man/bundle-config.ronn +130 -0
  92. data/man/bundle-exec.ronn +111 -0
  93. data/man/bundle-install.ronn +335 -0
  94. data/man/bundle-package.ronn +59 -0
  95. data/man/bundle-update.ronn +176 -0
  96. data/man/bundle.ronn +83 -0
  97. data/man/gemfile.5.ronn +324 -0
  98. data/man/index.txt +6 -0
  99. data/spec/bundler/dsl_spec.rb +48 -0
  100. data/spec/bundler/gem_helper_spec.rb +174 -0
  101. data/spec/bundler/source_spec.rb +25 -0
  102. data/spec/cache/gems_spec.rb +239 -0
  103. data/spec/cache/git_spec.rb +124 -0
  104. data/spec/cache/path_spec.rb +103 -0
  105. data/spec/cache/platform_spec.rb +57 -0
  106. data/spec/install/deploy_spec.rb +211 -0
  107. data/spec/install/gems/c_ext_spec.rb +48 -0
  108. data/spec/install/gems/dependency_api_spec.rb +402 -0
  109. data/spec/install/gems/env_spec.rb +107 -0
  110. data/spec/install/gems/flex_spec.rb +313 -0
  111. data/spec/install/gems/groups_spec.rb +268 -0
  112. data/spec/install/gems/packed_spec.rb +84 -0
  113. data/spec/install/gems/platform_spec.rb +208 -0
  114. data/spec/install/gems/post_install_spec.rb +47 -0
  115. data/spec/install/gems/resolving_spec.rb +72 -0
  116. data/spec/install/gems/simple_case_spec.rb +814 -0
  117. data/spec/install/gems/standalone_spec.rb +260 -0
  118. data/spec/install/gems/sudo_spec.rb +74 -0
  119. data/spec/install/gems/win32_spec.rb +26 -0
  120. data/spec/install/gemspec_spec.rb +170 -0
  121. data/spec/install/git_spec.rb +796 -0
  122. data/spec/install/invalid_spec.rb +35 -0
  123. data/spec/install/path_spec.rb +405 -0
  124. data/spec/install/upgrade_spec.rb +26 -0
  125. data/spec/lock/git_spec.rb +35 -0
  126. data/spec/lock/lockfile_spec.rb +809 -0
  127. data/spec/other/check_spec.rb +265 -0
  128. data/spec/other/clean_spec.rb +492 -0
  129. data/spec/other/config_spec.rb +138 -0
  130. data/spec/other/console_spec.rb +54 -0
  131. data/spec/other/exec_spec.rb +229 -0
  132. data/spec/other/ext_spec.rb +37 -0
  133. data/spec/other/help_spec.rb +39 -0
  134. data/spec/other/init_spec.rb +40 -0
  135. data/spec/other/newgem_spec.rb +87 -0
  136. data/spec/other/open_spec.rb +35 -0
  137. data/spec/other/outdated_spec.rb +93 -0
  138. data/spec/other/platform_spec.rb +881 -0
  139. data/spec/other/show_spec.rb +88 -0
  140. data/spec/quality_spec.rb +62 -0
  141. data/spec/realworld/edgecases_spec.rb +177 -0
  142. data/spec/resolver/basic_spec.rb +20 -0
  143. data/spec/resolver/platform_spec.rb +82 -0
  144. data/spec/runtime/executable_spec.rb +120 -0
  145. data/spec/runtime/load_spec.rb +107 -0
  146. data/spec/runtime/platform_spec.rb +90 -0
  147. data/spec/runtime/require_spec.rb +261 -0
  148. data/spec/runtime/setup_spec.rb +755 -0
  149. data/spec/runtime/with_clean_env_spec.rb +80 -0
  150. data/spec/spec_helper.rb +98 -0
  151. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
  152. data/spec/support/artifice/endpoint.rb +54 -0
  153. data/spec/support/artifice/endpoint_500.rb +37 -0
  154. data/spec/support/artifice/endpoint_api_missing.rb +16 -0
  155. data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
  156. data/spec/support/artifice/endpoint_extra.rb +27 -0
  157. data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
  158. data/spec/support/artifice/endpoint_fallback.rb +18 -0
  159. data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
  160. data/spec/support/artifice/endpoint_redirect.rb +15 -0
  161. data/spec/support/builders.rb +604 -0
  162. data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
  163. data/spec/support/fakeweb/windows.rb +23 -0
  164. data/spec/support/helpers.rb +317 -0
  165. data/spec/support/indexes.rb +112 -0
  166. data/spec/support/matchers.rb +77 -0
  167. data/spec/support/path.rb +73 -0
  168. data/spec/support/platforms.rb +86 -0
  169. data/spec/support/ruby_ext.rb +20 -0
  170. data/spec/support/rubygems_ext.rb +37 -0
  171. data/spec/support/rubygems_hax/platform.rb +22 -0
  172. data/spec/support/sudo.rb +21 -0
  173. data/spec/update/gems_spec.rb +134 -0
  174. data/spec/update/git_spec.rb +196 -0
  175. data/spec/update/source_spec.rb +51 -0
  176. metadata +338 -0
@@ -0,0 +1,84 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install with gem sources" do
4
+ describe "when cached and locked" do
5
+ it "does not hit the remote at all" do
6
+ build_repo2
7
+ install_gemfile <<-G
8
+ source "file://#{gem_repo2}"
9
+ gem "rack"
10
+ G
11
+
12
+ bundle :pack
13
+ simulate_new_machine
14
+ FileUtils.rm_rf gem_repo2
15
+
16
+ bundle "install --local"
17
+ should_be_installed "rack 1.0.0"
18
+ end
19
+
20
+ it "does not hit the remote at all" do
21
+ build_repo2
22
+ install_gemfile <<-G
23
+ source "file://#{gem_repo2}"
24
+ gem "rack"
25
+ G
26
+
27
+ bundle :pack
28
+ simulate_new_machine
29
+ FileUtils.rm_rf gem_repo2
30
+
31
+ bundle "install --deployment"
32
+ should_be_installed "rack 1.0.0"
33
+ end
34
+
35
+ it "does not reinstall already-installed gems" do
36
+ install_gemfile <<-G
37
+ source "file://#{gem_repo1}"
38
+ gem "rack"
39
+ G
40
+ bundle :pack
41
+
42
+ build_gem "rack", "1.0.0", :path => bundled_app('vendor/cache') do |s|
43
+ s.write "lib/rack.rb", "raise 'omg'"
44
+ end
45
+
46
+ bundle :install
47
+ err.should be_empty
48
+ should_be_installed "rack 1.0"
49
+ end
50
+
51
+ it "ignores cached gems for the wrong platform" do
52
+ simulate_platform "java" do
53
+ install_gemfile <<-G
54
+ source "file://#{gem_repo1}"
55
+ gem "platform_specific"
56
+ G
57
+ bundle :pack
58
+ end
59
+
60
+ simulate_new_machine
61
+
62
+ simulate_platform "ruby" do
63
+ install_gemfile <<-G
64
+ source "file://#{gem_repo1}"
65
+ gem "platform_specific"
66
+ G
67
+ run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
68
+ out.should == "1.0.0 RUBY"
69
+ end
70
+ end
71
+
72
+ it "does not update the cache if --no-cache is passed" do
73
+ gemfile <<-G
74
+ source "file://#{gem_repo1}"
75
+ gem "rack"
76
+ G
77
+ bundled_app("vendor/cache").mkpath
78
+ bundled_app("vendor/cache").children.should be_empty
79
+
80
+ bundle "install --no-cache"
81
+ bundled_app("vendor/cache").children.should be_empty
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,208 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install across platforms" do
4
+ it "maintains the same lockfile if all gems are compatible across platforms" do
5
+ lockfile <<-G
6
+ GEM
7
+ remote: file:#{gem_repo1}/
8
+ specs:
9
+ rack (0.9.1)
10
+
11
+ PLATFORMS
12
+ #{not_local}
13
+
14
+ DEPENDENCIES
15
+ rack
16
+ G
17
+
18
+ install_gemfile <<-G
19
+ source "file://#{gem_repo1}"
20
+
21
+ gem "rack"
22
+ G
23
+
24
+ should_be_installed "rack 0.9.1"
25
+ end
26
+
27
+ it "pulls in the correct platform specific gem" do
28
+ lockfile <<-G
29
+ GEM
30
+ remote: file:#{gem_repo1}
31
+ specs:
32
+ platform_specific (1.0)
33
+ platform_specific (1.0-java)
34
+ platform_specific (1.0-x86-mswin32)
35
+
36
+ PLATFORMS
37
+ ruby
38
+
39
+ DEPENDENCIES
40
+ platform_specific
41
+ G
42
+
43
+ simulate_platform "java"
44
+ install_gemfile <<-G
45
+ source "file://#{gem_repo1}"
46
+
47
+ gem "platform_specific"
48
+ G
49
+
50
+ should_be_installed "platform_specific 1.0 JAVA"
51
+ end
52
+
53
+ it "works with gems that have different dependencies" do
54
+ simulate_platform "java"
55
+ install_gemfile <<-G
56
+ source "file://#{gem_repo1}"
57
+
58
+ gem "nokogiri"
59
+ G
60
+
61
+ should_be_installed "nokogiri 1.4.2 JAVA", "weakling 0.0.3"
62
+
63
+ simulate_new_machine
64
+
65
+ simulate_platform "ruby"
66
+ install_gemfile <<-G
67
+ source "file://#{gem_repo1}"
68
+
69
+ gem "nokogiri"
70
+ G
71
+
72
+ should_be_installed "nokogiri 1.4.2"
73
+ should_not_be_installed "weakling"
74
+ end
75
+
76
+ it "works the other way with gems that have different dependencies" do
77
+ simulate_platform "ruby"
78
+ install_gemfile <<-G
79
+ source "file://#{gem_repo1}"
80
+
81
+ gem "nokogiri"
82
+ G
83
+
84
+ simulate_platform "java"
85
+ bundle "install"
86
+
87
+ should_be_installed "nokogiri 1.4.2 JAVA", "weakling 0.0.3"
88
+ end
89
+
90
+ it "fetches gems again after changing the version of Ruby" do
91
+ gemfile <<-G
92
+ source "file://#{gem_repo1}"
93
+
94
+ gem "rack", "1.0.0"
95
+ G
96
+
97
+ bundle "install --path vendor/bundle"
98
+
99
+ vendored_gems("gems/rack-1.0.0").should exist
100
+ end
101
+
102
+ it "works after switching Rubies" do
103
+ gemfile <<-G
104
+ source "file://#{gem_repo1}"
105
+
106
+ gem "rack", "1.0.0"
107
+ G
108
+
109
+ bundle "install --path vendor/bundle"
110
+
111
+ new_version = Gem::ConfigMap[:ruby_version] == "1.8" ? "1.9.1" : "1.8"
112
+ FileUtils.mv(vendored_gems, bundled_app("vendor/bundle/#{Gem.ruby_engine}/#{new_version}"))
113
+
114
+ bundle "install --path ./vendor/bundle"
115
+ vendored_gems("gems/rack-1.0.0").should exist
116
+ end
117
+ end
118
+
119
+ describe "bundle install with platform conditionals" do
120
+ it "installs gems tagged w/ the current platforms" do
121
+ install_gemfile <<-G
122
+ source "file://#{gem_repo1}"
123
+
124
+ platforms :#{local_tag} do
125
+ gem "nokogiri"
126
+ end
127
+ G
128
+
129
+ should_be_installed "nokogiri 1.4.2"
130
+ end
131
+
132
+ it "does not install gems tagged w/ another platforms" do
133
+ install_gemfile <<-G
134
+ source "file://#{gem_repo1}"
135
+ gem "rack"
136
+ platforms :#{not_local_tag} do
137
+ gem "nokogiri"
138
+ end
139
+ G
140
+
141
+ should_be_installed "rack 1.0"
142
+ should_not_be_installed "nokogiri 1.4.2"
143
+ end
144
+
145
+ it "installs gems tagged w/ the current platforms inline" do
146
+ install_gemfile <<-G
147
+ source "file://#{gem_repo1}"
148
+ gem "nokogiri", :platforms => :#{local_tag}
149
+ G
150
+ should_be_installed "nokogiri 1.4.2"
151
+ end
152
+
153
+ it "does not install gems tagged w/ another platforms inline" do
154
+ install_gemfile <<-G
155
+ source "file://#{gem_repo1}"
156
+ gem "rack"
157
+ gem "nokogiri", :platforms => :#{not_local_tag}
158
+ G
159
+ should_be_installed "rack 1.0"
160
+ should_not_be_installed "nokogiri 1.4.2"
161
+ end
162
+
163
+ it "installs gems tagged w/ the current platform inline" do
164
+ install_gemfile <<-G
165
+ source "file://#{gem_repo1}"
166
+ gem "nokogiri", :platform => :#{local_tag}
167
+ G
168
+ should_be_installed "nokogiri 1.4.2"
169
+ end
170
+
171
+ it "doesn't install gems tagged w/ another platform inline" do
172
+ install_gemfile <<-G
173
+ source "file://#{gem_repo1}"
174
+ gem "nokogiri", :platform => :#{not_local_tag}
175
+ G
176
+ should_not_be_installed "nokogiri 1.4.2"
177
+ end
178
+
179
+ it "does not blow up on sources with all platform-excluded specs" do
180
+ build_git "foo"
181
+
182
+ install_gemfile <<-G
183
+ platform :#{not_local_tag} do
184
+ gem "foo", :git => "#{lib_path('foo-1.0')}"
185
+ end
186
+ G
187
+
188
+ bundle :show, :exitstatus => true
189
+ exitstatus.should == 0
190
+ end
191
+
192
+ end
193
+
194
+ describe "when a gem has an architecture in its platform" do
195
+ it "still installs correctly" do
196
+ simulate_platform mswin
197
+
198
+ gemfile <<-G
199
+ # Try to install gem with nil arch
200
+ source "http://localgemserver.test/"
201
+ gem "rcov"
202
+ G
203
+
204
+ bundle :install, :fakeweb => "windows"
205
+ should_be_installed "rcov 1.0.0"
206
+ end
207
+ end
208
+
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'bundle install with gem sources' do
4
+ describe 'when gems include post install messages' do
5
+ it "should display the post-install messages after installing" do
6
+ gemfile <<-G
7
+ source "file://#{gem_repo1}"
8
+ gem 'rack'
9
+ gem 'thin'
10
+ gem 'rack-obama'
11
+ G
12
+
13
+ bundle :install
14
+ out.should include("Post-install message from rack:")
15
+ out.should include("Rack's post install message")
16
+ out.should include("Post-install message from thin:")
17
+ out.should include("Thin's post install message")
18
+ out.should include("Post-install message from rack-obama:")
19
+ out.should include("Rack-obama's post install message")
20
+ end
21
+ end
22
+
23
+ describe 'when gems do not include post install messages' do
24
+ it "should not display any post-install messages" do
25
+ gemfile <<-G
26
+ source "file://#{gem_repo1}"
27
+ gem "activesupport"
28
+ G
29
+
30
+ bundle :install
31
+ out.should_not include("Post-install message")
32
+ end
33
+ end
34
+
35
+ describe "when a dependecy includes a post install message" do
36
+ it "should display the post install message" do
37
+ gemfile <<-G
38
+ source "file://#{gem_repo1}"
39
+ gem 'rack_middleware'
40
+ G
41
+
42
+ bundle :install
43
+ out.should include("Post-install message from rack:")
44
+ out.should include("Rack's post install message")
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,72 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install with gem sources" do
4
+ describe "install time dependencies" do
5
+ it "installs gems with implicit rake dependencies" do
6
+ install_gemfile <<-G
7
+ source "file://#{gem_repo1}"
8
+ gem "with_implicit_rake_dep"
9
+ gem "another_implicit_rake_dep"
10
+ gem "rake"
11
+ G
12
+
13
+ run <<-R
14
+ require 'implicit_rake_dep'
15
+ require 'another_implicit_rake_dep'
16
+ puts IMPLICIT_RAKE_DEP
17
+ puts ANOTHER_IMPLICIT_RAKE_DEP
18
+ R
19
+ out.should == "YES\nYES"
20
+ end
21
+
22
+ it "installs gems with a dependency with no type" do
23
+ build_repo2
24
+
25
+ path = "#{gem_repo2}/#{Gem::MARSHAL_SPEC_DIR}/actionpack-2.3.2.gemspec.rz"
26
+ spec = Marshal.load(Gem.inflate(File.read(path)))
27
+ spec.dependencies.each do |d|
28
+ d.instance_variable_set(:@type, :fail)
29
+ end
30
+ File.open(path, 'w') do |f|
31
+ f.write Gem.deflate(Marshal.dump(spec))
32
+ end
33
+
34
+ install_gemfile <<-G
35
+ source "file://#{gem_repo2}"
36
+ gem "actionpack", "2.3.2"
37
+ G
38
+
39
+ should_be_installed "actionpack 2.3.2", "activesupport 2.3.2"
40
+ end
41
+
42
+ describe "with crazy rubygem plugin stuff" do
43
+ it "installs plugins" do
44
+ install_gemfile <<-G
45
+ source "file://#{gem_repo1}"
46
+ gem "net_b"
47
+ G
48
+
49
+ should_be_installed "net_b 1.0"
50
+ end
51
+
52
+ it "installs plugins depended on by other plugins" do
53
+ install_gemfile <<-G
54
+ source "file://#{gem_repo1}"
55
+ gem "net_a"
56
+ G
57
+
58
+ should_be_installed "net_a 1.0", "net_b 1.0"
59
+ end
60
+
61
+ it "installs multiple levels of dependencies" do
62
+ install_gemfile <<-G
63
+ source "file://#{gem_repo1}"
64
+ gem "net_c"
65
+ gem "net_e"
66
+ G
67
+
68
+ should_be_installed "net_a 1.0", "net_b 1.0", "net_c 1.0", "net_d 1.0", "net_e 1.0"
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,814 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install with gem sources" do
4
+ describe "the simple case" do
5
+ it "prints output and returns if no dependencies are specified" do
6
+ gemfile <<-G
7
+ source "file://#{gem_repo1}"
8
+ G
9
+
10
+ bundle :install
11
+ out.should =~ /no dependencies/
12
+ end
13
+
14
+ it "does not make a lockfile if the install fails" do
15
+ install_gemfile <<-G, :expect_err => true
16
+ raise StandardError, "FAIL"
17
+ G
18
+
19
+ err.should =~ /FAIL \(StandardError\)/
20
+ bundled_app("Gemfile.lock").should_not exist
21
+ end
22
+
23
+ it "creates a Gemfile.lock" do
24
+ install_gemfile <<-G
25
+ source "file://#{gem_repo1}"
26
+ gem "rack"
27
+ G
28
+
29
+ bundled_app('Gemfile.lock').should exist
30
+ end
31
+
32
+ it "creates lock files based on the Gemfile name" do
33
+ gemfile bundled_app('OmgFile'), <<-G
34
+ source "file://#{gem_repo1}"
35
+ gem "rack", "1.0"
36
+ G
37
+
38
+ bundle 'install --gemfile OmgFile'
39
+
40
+ bundled_app("OmgFile.lock").should exist
41
+ end
42
+
43
+ it "doesn't delete the lockfile if one already exists" do
44
+ install_gemfile <<-G
45
+ source "file://#{gem_repo1}"
46
+ gem 'rack'
47
+ G
48
+
49
+ lockfile = File.read(bundled_app("Gemfile.lock"))
50
+
51
+ install_gemfile <<-G, :expect_err => true
52
+ raise StandardError, "FAIL"
53
+ G
54
+
55
+ File.read(bundled_app("Gemfile.lock")).should == lockfile
56
+ end
57
+
58
+ it "does not touch the lockfile if nothing changed" do
59
+ install_gemfile <<-G
60
+ source "file://#{gem_repo1}"
61
+ gem "rack"
62
+ G
63
+
64
+ lambda { run '1' }.should_not change { File.mtime(bundled_app('Gemfile.lock')) }
65
+ end
66
+
67
+ it "fetches gems" do
68
+ install_gemfile <<-G
69
+ source "file://#{gem_repo1}"
70
+ gem 'rack'
71
+ G
72
+
73
+ default_bundle_path("gems/rack-1.0.0").should exist
74
+ should_be_installed("rack 1.0.0")
75
+ end
76
+
77
+ it "fetches gems when multiple versions are specified" do
78
+ install_gemfile <<-G
79
+ source "file://#{gem_repo1}"
80
+ gem 'rack', "> 0.9", "< 1.0"
81
+ G
82
+
83
+ default_bundle_path("gems/rack-0.9.1").should exist
84
+ should_be_installed("rack 0.9.1")
85
+ end
86
+
87
+ it "fetches gems when multiple versions are specified take 2" do
88
+ install_gemfile <<-G
89
+ source "file://#{gem_repo1}"
90
+ gem 'rack', "< 1.0", "> 0.9"
91
+ G
92
+
93
+ default_bundle_path("gems/rack-0.9.1").should exist
94
+ should_be_installed("rack 0.9.1")
95
+ end
96
+
97
+ it "raises an appropriate error when gems are specified using symbols" do
98
+ status = install_gemfile(<<-G, :exitstatus => true)
99
+ source "file://#{gem_repo1}"
100
+ gem :rack
101
+ G
102
+ status.should == 4
103
+ end
104
+
105
+ it "pulls in dependencies" do
106
+ install_gemfile <<-G
107
+ source "file://#{gem_repo1}"
108
+ gem "rails"
109
+ G
110
+
111
+ should_be_installed "actionpack 2.3.2", "rails 2.3.2"
112
+ end
113
+
114
+ it "does the right version" do
115
+ install_gemfile <<-G
116
+ source "file://#{gem_repo1}"
117
+ gem "rack", "0.9.1"
118
+ G
119
+
120
+ should_be_installed "rack 0.9.1"
121
+ end
122
+
123
+ it "does not install the development dependency" do
124
+ install_gemfile <<-G
125
+ source "file://#{gem_repo1}"
126
+ gem "with_development_dependency"
127
+ G
128
+
129
+ should_be_installed "with_development_dependency 1.0.0"
130
+ should_not_be_installed "activesupport 2.3.5"
131
+ end
132
+
133
+ it "resolves correctly" do
134
+ install_gemfile <<-G
135
+ source "file://#{gem_repo1}"
136
+ gem "activemerchant"
137
+ gem "rails"
138
+ G
139
+
140
+ should_be_installed "activemerchant 1.0", "activesupport 2.3.2", "actionpack 2.3.2"
141
+ end
142
+
143
+ it "activates gem correctly according to the resolved gems" do
144
+ install_gemfile <<-G
145
+ source "file://#{gem_repo1}"
146
+ gem "activesupport", "2.3.5"
147
+ G
148
+
149
+ install_gemfile <<-G
150
+ source "file://#{gem_repo1}"
151
+ gem "activemerchant"
152
+ gem "rails"
153
+ G
154
+
155
+ should_be_installed "activemerchant 1.0", "activesupport 2.3.2", "actionpack 2.3.2"
156
+ end
157
+
158
+ it "does not reinstall any gem that is already available locally" do
159
+ system_gems "activesupport-2.3.2"
160
+
161
+ build_repo2 do
162
+ build_gem "activesupport", "2.3.2" do |s|
163
+ s.write "lib/activesupport.rb", "ACTIVESUPPORT = 'fail'"
164
+ end
165
+ end
166
+
167
+ install_gemfile <<-G
168
+ source "file://#{gem_repo2}"
169
+ gem "activerecord", "2.3.2"
170
+ G
171
+
172
+ should_be_installed "activesupport 2.3.2"
173
+ end
174
+
175
+ it "works when the gemfile specifies gems that only exist in the system" do
176
+ build_gem "foo", :to_system => true
177
+ install_gemfile <<-G
178
+ source "file://#{gem_repo1}"
179
+ gem "rack"
180
+ gem "foo"
181
+ G
182
+
183
+ should_be_installed "rack 1.0.0", "foo 1.0.0"
184
+ end
185
+
186
+ it "prioritizes local gems over remote gems" do
187
+ build_gem 'rack', '1.0.0', :to_system => true do |s|
188
+ s.add_dependency "activesupport", "2.3.5"
189
+ end
190
+
191
+ install_gemfile <<-G
192
+ source "file://#{gem_repo1}"
193
+ gem "rack"
194
+ G
195
+
196
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
197
+ end
198
+
199
+ describe "with a gem that installs multiple platforms" do
200
+ it "installs gems for the local platform as first choice" do
201
+ install_gemfile <<-G
202
+ source "file://#{gem_repo1}"
203
+ gem "platform_specific"
204
+ G
205
+
206
+ run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
207
+ out.should == "1.0.0 #{Gem::Platform.local}"
208
+ end
209
+
210
+ it "falls back on plain ruby" do
211
+ simulate_platform "foo-bar-baz"
212
+ install_gemfile <<-G
213
+ source "file://#{gem_repo1}"
214
+ gem "platform_specific"
215
+ G
216
+
217
+ run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
218
+ out.should == "1.0.0 RUBY"
219
+ end
220
+
221
+ it "installs gems for java" do
222
+ simulate_platform "java"
223
+ install_gemfile <<-G
224
+ source "file://#{gem_repo1}"
225
+ gem "platform_specific"
226
+ G
227
+
228
+ run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
229
+ out.should == "1.0.0 JAVA"
230
+ end
231
+
232
+ it "installs gems for windows" do
233
+ simulate_platform mswin
234
+
235
+ install_gemfile <<-G
236
+ source "file://#{gem_repo1}"
237
+ gem "platform_specific"
238
+ G
239
+
240
+ run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
241
+ out.should == "1.0.0 MSWIN"
242
+ end
243
+ end
244
+
245
+ describe "doing bundle install foo" do
246
+ before do
247
+ gemfile <<-G
248
+ source "file://#{gem_repo1}"
249
+ gem "rack"
250
+ G
251
+ end
252
+
253
+ it "works" do
254
+ bundle "install --path vendor"
255
+ should_be_installed "rack 1.0"
256
+ end
257
+
258
+ it "allows running bundle install --system without deleting foo" do
259
+ bundle "install --path vendor"
260
+ bundle "install --system"
261
+ FileUtils.rm_rf(bundled_app("vendor"))
262
+ should_be_installed "rack 1.0"
263
+ end
264
+
265
+ it "allows running bundle install --system after deleting foo" do
266
+ bundle "install --path vendor"
267
+ FileUtils.rm_rf(bundled_app("vendor"))
268
+ bundle "install --system"
269
+ should_be_installed "rack 1.0"
270
+ end
271
+ end
272
+
273
+ it "finds gems in multiple sources" do
274
+ build_repo2
275
+ update_repo2
276
+
277
+ install_gemfile <<-G
278
+ source "file://#{gem_repo1}"
279
+ source "file://#{gem_repo2}"
280
+
281
+ gem "activesupport", "1.2.3"
282
+ gem "rack", "1.2"
283
+ G
284
+
285
+ should_be_installed "rack 1.2", "activesupport 1.2.3"
286
+ end
287
+
288
+ it "gives a useful error if no sources are set" do
289
+ install_gemfile <<-G
290
+ gem "rack"
291
+ G
292
+
293
+ bundle :install, :expect_err => true
294
+ out.should =~ /Your Gemfile has no remote sources/i
295
+ end
296
+
297
+ it "creates a Gemfile.lock on a blank Gemfile" do
298
+ install_gemfile <<-G
299
+ G
300
+
301
+ File.exists?(bundled_app("Gemfile.lock")).should be_true
302
+ end
303
+
304
+ it "gracefully handles error when rubygems server is unavailable" do
305
+ install_gemfile <<-G
306
+ source "file://#{gem_repo1}"
307
+ source "http://localhost:9384"
308
+
309
+ gem 'foo'
310
+ G
311
+
312
+ bundle :install
313
+ out.should include("Could not reach http://localhost:9384/")
314
+ out.should_not include("file://")
315
+ end
316
+
317
+ it "doesn't blow up when the local .bundle/config is empty" do
318
+ FileUtils.mkdir_p(bundled_app(".bundle"))
319
+ FileUtils.touch(bundled_app(".bundle/config"))
320
+
321
+ install_gemfile(<<-G, :exitstatus => true)
322
+ source "file://#{gem_repo1}"
323
+
324
+ gem 'foo'
325
+ G
326
+ exitstatus.should == 0
327
+ end
328
+
329
+ it "doesn't blow up when the global .bundle/config is empty" do
330
+ FileUtils.mkdir_p("#{Bundler.rubygems.user_home}/.bundle")
331
+ FileUtils.touch("#{Bundler.rubygems.user_home}/.bundle/config")
332
+
333
+ install_gemfile(<<-G, :exitstatus => true)
334
+ source "file://#{gem_repo1}"
335
+
336
+ gem 'foo'
337
+ G
338
+ exitstatus.should == 0
339
+ end
340
+ end
341
+
342
+ describe "when Bundler root contains regex chars" do
343
+ before do
344
+ root_dir = tmp("foo[]bar")
345
+
346
+ FileUtils.mkdir_p(root_dir)
347
+ in_app_root_custom(root_dir)
348
+ end
349
+
350
+ it "doesn't blow up" do
351
+ build_lib "foo"
352
+ gemfile = <<-G
353
+ gem 'foo', :path => "#{lib_path('foo-1.0')}"
354
+ G
355
+ File.open('Gemfile', 'w') do |file|
356
+ file.puts gemfile
357
+ end
358
+
359
+ bundle :install, :exitstatus => true
360
+
361
+ exitstatus.should == 0
362
+ end
363
+ end
364
+
365
+ describe "when prerelease gems are available" do
366
+ it "finds prereleases" do
367
+ install_gemfile <<-G
368
+ source "file://#{gem_repo1}"
369
+ gem "not_released"
370
+ G
371
+ should_be_installed "not_released 1.0.pre"
372
+ end
373
+
374
+ it "uses regular releases if available" do
375
+ install_gemfile <<-G
376
+ source "file://#{gem_repo1}"
377
+ gem "has_prerelease"
378
+ G
379
+ should_be_installed "has_prerelease 1.0"
380
+ end
381
+
382
+ it "uses prereleases if requested" do
383
+ install_gemfile <<-G
384
+ source "file://#{gem_repo1}"
385
+ gem "has_prerelease", "1.1.pre"
386
+ G
387
+ should_be_installed "has_prerelease 1.1.pre"
388
+ end
389
+ end
390
+
391
+ describe "when prerelease gems are not available" do
392
+ it "still works" do
393
+ build_repo3
394
+ install_gemfile <<-G
395
+ source "file://#{gem_repo3}"
396
+ gem "rack"
397
+ G
398
+
399
+ should_be_installed "rack 1.0"
400
+ end
401
+ end
402
+
403
+ describe "when BUNDLE_PATH or the global path config is set" do
404
+ before :each do
405
+ build_lib "rack", "1.0.0", :to_system => true do |s|
406
+ s.write "lib/rack.rb", "raise 'FAIL'"
407
+ end
408
+
409
+ gemfile <<-G
410
+ source "file://#{gem_repo1}"
411
+ gem "rack"
412
+ G
413
+ end
414
+
415
+ def set_bundle_path(type, location)
416
+ if type == :env
417
+ ENV["BUNDLE_PATH"] = location
418
+ elsif type == :global
419
+ bundle "config path #{location}", "no-color" => nil
420
+ end
421
+ end
422
+
423
+ [:env, :global].each do |type|
424
+ it "installs gems to a path if one is specified" do
425
+ set_bundle_path(type, bundled_app("vendor2").to_s)
426
+ bundle "install --path vendor/bundle"
427
+
428
+ vendored_gems("gems/rack-1.0.0").should be_directory
429
+ bundled_app("vendor2").should_not be_directory
430
+ should_be_installed "rack 1.0.0"
431
+ end
432
+
433
+ it "installs gems to BUNDLE_PATH with #{type}" do
434
+ set_bundle_path(type, bundled_app("vendor").to_s)
435
+
436
+ bundle :install
437
+
438
+ bundled_app('vendor/gems/rack-1.0.0').should be_directory
439
+ should_be_installed "rack 1.0.0"
440
+ end
441
+
442
+ it "installs gems to BUNDLE_PATH relative to root when relative" do
443
+ set_bundle_path(type, "vendor")
444
+
445
+ FileUtils.mkdir_p bundled_app('lol')
446
+ Dir.chdir(bundled_app('lol')) do
447
+ bundle :install
448
+ end
449
+
450
+ bundled_app('vendor/gems/rack-1.0.0').should be_directory
451
+ should_be_installed "rack 1.0.0"
452
+ end
453
+ end
454
+
455
+ it "installs gems to BUNDLE_PATH from .bundle/config" do
456
+ config "BUNDLE_PATH" => bundled_app("vendor/bundle").to_s
457
+
458
+ bundle :install
459
+
460
+ vendored_gems('gems/rack-1.0.0').should be_directory
461
+ should_be_installed "rack 1.0.0"
462
+ end
463
+
464
+ it "sets BUNDLE_PATH as the first argument to bundle install" do
465
+ bundle "install --path ./vendor/bundle"
466
+
467
+ vendored_gems('gems/rack-1.0.0').should be_directory
468
+ should_be_installed "rack 1.0.0"
469
+ end
470
+
471
+ it "disables system gems when passing a path to install" do
472
+ # This is so that vendored gems can be distributed to others
473
+ build_gem "rack", "1.1.0", :to_system => true
474
+ bundle "install --path ./vendor/bundle"
475
+
476
+ vendored_gems('gems/rack-1.0.0').should be_directory
477
+ should_be_installed "rack 1.0.0"
478
+ end
479
+ end
480
+
481
+ describe "when passing in a Gemfile via --gemfile" do
482
+ it "finds the gemfile" do
483
+ gemfile bundled_app("NotGemfile"), <<-G
484
+ source "file://#{gem_repo1}"
485
+ gem 'rack'
486
+ G
487
+
488
+ bundle :install, :gemfile => bundled_app("NotGemfile")
489
+
490
+ ENV['BUNDLE_GEMFILE'] = "NotGemfile"
491
+ should_be_installed "rack 1.0.0"
492
+ end
493
+ end
494
+
495
+ describe "when requesting a quiet install via --quiet" do
496
+ it "should be quiet if there are no warnings" do
497
+ gemfile <<-G
498
+ source "file://#{gem_repo1}"
499
+ gem 'rack'
500
+ G
501
+
502
+ bundle :install, :quiet => true
503
+ out.should == ""
504
+ end
505
+
506
+ it "should still display warnings" do
507
+ gemfile <<-G
508
+ gem 'rack'
509
+ G
510
+
511
+ bundle :install, :quiet => true
512
+ out.should =~ /Your Gemfile has no remote sources/
513
+ end
514
+ end
515
+
516
+ describe "when disabling system gems" do
517
+ before :each do
518
+ build_gem "rack", "1.0.0", :to_system => true do |s|
519
+ s.write "lib/rack.rb", "puts 'FAIL'"
520
+ end
521
+
522
+ gemfile <<-G
523
+ source "file://#{gem_repo1}"
524
+ gem "rack"
525
+ G
526
+ end
527
+
528
+ it "behaves like bundle install vendor/bundle with --deployment" do
529
+ bundle "install"
530
+ bundle "install --deployment"
531
+ out.should include("It was installed into ./vendor/bundle")
532
+ should_be_installed "rack 1.0.0"
533
+ bundled_app("vendor/bundle").should exist
534
+ end
535
+
536
+ it "does not use available system gems with bundle --path vendor/bundle" do
537
+ bundle "install --path vendor/bundle"
538
+ should_be_installed "rack 1.0.0"
539
+ end
540
+
541
+ it "handles paths with regex characters in them" do
542
+ dir = bundled_app("bun++dle")
543
+ dir.mkpath
544
+
545
+ Dir.chdir(dir) do
546
+ bundle "install --path vendor/bundle"
547
+ out.should include("installed into ./vendor/bundle")
548
+ end
549
+
550
+ dir.rmtree
551
+ end
552
+
553
+ it "prints a warning to let the user know what has happened with bundle --path vendor/bundle" do
554
+ bundle "install --path vendor/bundle"
555
+ out.should include("It was installed into ./vendor")
556
+ end
557
+
558
+ it "disallows --path vendor/bundle --system" do
559
+ bundle "install --path vendor/bundle --system"
560
+ out.should include("Please choose.")
561
+ end
562
+
563
+ it "remembers to disable system gems after the first time with bundle --path vendor/bundle" do
564
+ bundle "install --path vendor/bundle"
565
+ FileUtils.rm_rf bundled_app('vendor')
566
+ bundle "install"
567
+
568
+ vendored_gems('gems/rack-1.0.0').should be_directory
569
+ should_be_installed "rack 1.0.0"
570
+ end
571
+ end
572
+
573
+ describe "when loading only the default group" do
574
+ it "should not load all groups" do
575
+ install_gemfile <<-G
576
+ source "file://#{gem_repo1}"
577
+ gem "rack"
578
+ gem "activesupport", :groups => :development
579
+ G
580
+
581
+ ruby <<-R
582
+ require "bundler"
583
+ Bundler.setup :default
584
+ Bundler.require :default
585
+ puts RACK
586
+ begin
587
+ require "activesupport"
588
+ rescue LoadError
589
+ puts "no activesupport"
590
+ end
591
+ R
592
+
593
+ out.should include("1.0")
594
+ out.should include("no activesupport")
595
+ end
596
+ end
597
+
598
+ describe "when a gem has a YAML gemspec" do
599
+ before :each do
600
+ build_repo2 do
601
+ build_gem "yaml_spec", :gemspec => :yaml
602
+ end
603
+ end
604
+
605
+ it "still installs correctly" do
606
+ gemfile <<-G
607
+ source "file://#{gem_repo2}"
608
+ gem "yaml_spec"
609
+ G
610
+ bundle :install
611
+ err.should be_empty
612
+ end
613
+
614
+ it "still installs correctly when using path" do
615
+ build_lib 'yaml_spec', :gemspec => :yaml
616
+
617
+ install_gemfile <<-G
618
+ gem 'yaml_spec', :path => "#{lib_path('yaml_spec-1.0')}"
619
+ G
620
+ err.should == ""
621
+ end
622
+ end
623
+
624
+ describe "bundler dependencies" do
625
+ before(:each) do
626
+ build_repo2 do
627
+ build_gem "rails", "3.0" do |s|
628
+ s.add_dependency "bundler", ">= 0.9.0.pre"
629
+ end
630
+ build_gem "bundler", "0.9.1"
631
+ build_gem "bundler", Bundler::VERSION
632
+ end
633
+ end
634
+
635
+ it "are forced to the current bundler version" do
636
+ install_gemfile <<-G
637
+ source "file://#{gem_repo2}"
638
+ gem "rails", "3.0"
639
+ G
640
+
641
+ should_be_installed "bundler #{Bundler::VERSION}"
642
+ end
643
+
644
+ it "are not added if not already present" do
645
+ install_gemfile <<-G
646
+ source "file://#{gem_repo1}"
647
+ gem "rack"
648
+ G
649
+ should_not_be_installed "bundler #{Bundler::VERSION}"
650
+ end
651
+
652
+ it "causes a conflict if explicitly requesting a different version" do
653
+ install_gemfile <<-G
654
+ source "file://#{gem_repo2}"
655
+ gem "rails", "3.0"
656
+ gem "bundler", "0.9.2"
657
+ G
658
+
659
+ nice_error = <<-E.strip.gsub(/^ {8}/, '')
660
+ Fetching source index from file:#{gem_repo2}/
661
+ Bundler could not find compatible versions for gem "bundler":
662
+ In Gemfile:
663
+ bundler (= 0.9.2) ruby
664
+
665
+ Current Bundler version:
666
+ bundler (#{Bundler::VERSION})
667
+ E
668
+ out.should include(nice_error)
669
+ end
670
+
671
+ it "works for gems with multiple versions in its dependencies" do
672
+ install_gemfile <<-G
673
+ source "file://#{gem_repo2}"
674
+
675
+ gem "multiple_versioned_deps"
676
+ G
677
+
678
+
679
+ install_gemfile <<-G
680
+ source "file://#{gem_repo2}"
681
+
682
+ gem "multiple_versioned_deps"
683
+ gem "rack"
684
+ G
685
+
686
+ should_be_installed "multiple_versioned_deps 1.0.0"
687
+ end
688
+
689
+ it "includes bundler in the bundle when it's a child dependency" do
690
+ install_gemfile <<-G
691
+ source "file://#{gem_repo2}"
692
+ gem "rails", "3.0"
693
+ G
694
+
695
+ run "begin; gem 'bundler'; puts 'WIN'; rescue Gem::LoadError; puts 'FAIL'; end"
696
+ out.should == "WIN"
697
+ end
698
+
699
+ it "allows gem 'bundler' when Bundler is not in the Gemfile or its dependencies" do
700
+ install_gemfile <<-G
701
+ source "file://#{gem_repo2}"
702
+ gem "rack"
703
+ G
704
+
705
+ run "begin; gem 'bundler'; puts 'WIN'; rescue Gem::LoadError => e; puts e.backtrace; end"
706
+ out.should == "WIN"
707
+ end
708
+
709
+ it "causes a conflict if child dependencies conflict" do
710
+ install_gemfile <<-G
711
+ source "file://#{gem_repo2}"
712
+ gem "activemerchant"
713
+ gem "rails_fail"
714
+ G
715
+
716
+ nice_error = <<-E.strip.gsub(/^ {8}/, '')
717
+ Fetching source index from file:#{gem_repo2}/
718
+ Bundler could not find compatible versions for gem "activesupport":
719
+ In Gemfile:
720
+ activemerchant (>= 0) ruby depends on
721
+ activesupport (>= 2.0.0) ruby
722
+
723
+ rails_fail (>= 0) ruby depends on
724
+ activesupport (1.2.3)
725
+ E
726
+ out.should == nice_error
727
+ end
728
+
729
+ it "causes a conflict if a child dependency conflicts with the Gemfile" do
730
+ install_gemfile <<-G
731
+ source "file://#{gem_repo2}"
732
+ gem "rails_fail"
733
+ gem "activesupport", "2.3.5"
734
+ G
735
+
736
+ nice_error = <<-E.strip.gsub(/^ {8}/, '')
737
+ Fetching source index from file:#{gem_repo2}/
738
+ Bundler could not find compatible versions for gem "activesupport":
739
+ In Gemfile:
740
+ rails_fail (>= 0) ruby depends on
741
+ activesupport (= 1.2.3) ruby
742
+
743
+ activesupport (2.3.5)
744
+ E
745
+ out.should == nice_error
746
+ end
747
+
748
+ it "can install dependencies even if " do
749
+ install_gemfile <<-G
750
+ source "file://#{gem_repo2}"
751
+ gem "rails", "3.0"
752
+ G
753
+
754
+ simulate_bundler_version "10.0.0"
755
+ #simulate_new_machine
756
+
757
+ bundle "check"
758
+ out.should == "The Gemfile's dependencies are satisfied"
759
+ end
760
+ end
761
+
762
+ describe "when locked and installed with --without" do
763
+ before(:each) do
764
+ build_repo2
765
+ system_gems "rack-0.9.1" do
766
+ install_gemfile <<-G, :without => :rack
767
+ source "file://#{gem_repo2}"
768
+ gem "rack"
769
+
770
+ group :rack do
771
+ gem "rack_middleware"
772
+ end
773
+ G
774
+ end
775
+ end
776
+
777
+ it "uses the correct versions even if --without was used on the original" do
778
+ should_be_installed "rack 0.9.1"
779
+ should_not_be_installed "rack_middleware 1.0"
780
+ simulate_new_machine
781
+
782
+ bundle :install
783
+
784
+ should_be_installed "rack 0.9.1"
785
+ should_be_installed "rack_middleware 1.0"
786
+ end
787
+
788
+ it "does not hit the remote a second time" do
789
+ FileUtils.rm_rf gem_repo2
790
+ bundle "install --without rack"
791
+ err.should be_empty
792
+ end
793
+ end
794
+
795
+ describe "when system_bindir is set" do
796
+ # On OS X, Gem.bindir defaults to /usr/bin, so system_bindir is useful if
797
+ # you want to avoid sudo installs for system gems with OS X's default ruby
798
+ it "overrides Gem.bindir" do
799
+ Pathname.new("/usr/bin").should_not be_writable
800
+ gemfile <<-G
801
+ require 'rubygems'
802
+ def Gem.bindir; "/usr/bin"; end
803
+ source "file://#{gem_repo1}"
804
+ gem "rack"
805
+ G
806
+
807
+ config "BUNDLE_SYSTEM_BINDIR" => system_gem_path('altbin').to_s
808
+ bundle :install
809
+ should_be_installed "rack 1.0.0"
810
+ system_gem_path("altbin/rackup").should exist
811
+ end
812
+ end
813
+
814
+ end