rkh-bundler 1.2.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/.travis.yml +42 -0
- data/CHANGELOG.md +1105 -0
- data/ISSUES.md +67 -0
- data/LICENSE +23 -0
- data/README.md +31 -0
- data/Rakefile +208 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +31 -0
- data/bundler.gemspec +31 -0
- data/lib/bundler.rb +353 -0
- data/lib/bundler/capistrano.rb +11 -0
- data/lib/bundler/cli.rb +693 -0
- data/lib/bundler/definition.rb +568 -0
- data/lib/bundler/dep_proxy.rb +43 -0
- data/lib/bundler/dependency.rb +134 -0
- data/lib/bundler/deployment.rb +58 -0
- data/lib/bundler/dsl.rb +256 -0
- data/lib/bundler/endpoint_specification.rb +78 -0
- data/lib/bundler/environment.rb +47 -0
- data/lib/bundler/fetcher.rb +225 -0
- data/lib/bundler/gem_helper.rb +162 -0
- data/lib/bundler/gem_helpers.rb +23 -0
- data/lib/bundler/gem_installer.rb +9 -0
- data/lib/bundler/gem_tasks.rb +2 -0
- data/lib/bundler/graph.rb +148 -0
- data/lib/bundler/index.rb +187 -0
- data/lib/bundler/installer.rb +190 -0
- data/lib/bundler/lazy_specification.rb +79 -0
- data/lib/bundler/lockfile_parser.rb +127 -0
- data/lib/bundler/match_platform.rb +13 -0
- data/lib/bundler/psyched_yaml.rb +15 -0
- data/lib/bundler/remote_specification.rb +57 -0
- data/lib/bundler/resolver.rb +486 -0
- data/lib/bundler/ruby_version.rb +94 -0
- data/lib/bundler/rubygems_ext.rb +153 -0
- data/lib/bundler/rubygems_integration.rb +394 -0
- data/lib/bundler/runtime.rb +233 -0
- data/lib/bundler/settings.rb +128 -0
- data/lib/bundler/setup.rb +23 -0
- data/lib/bundler/shared_helpers.rb +71 -0
- data/lib/bundler/source.rb +869 -0
- data/lib/bundler/spec_set.rb +137 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Executable.standalone +12 -0
- data/lib/bundler/templates/Gemfile +4 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/lib/bundler/templates/newgem/LICENSE.tt +22 -0
- data/lib/bundler/templates/newgem/README.md.tt +29 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/gitignore.tt +17 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +9 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -0
- data/lib/bundler/ui.rb +88 -0
- data/lib/bundler/vendor/net/http/faster.rb +27 -0
- data/lib/bundler/vendor/net/http/persistent.rb +468 -0
- data/lib/bundler/vendor/thor.rb +358 -0
- data/lib/bundler/vendor/thor/actions.rb +314 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
- data/lib/bundler/vendor/thor/actions/create_link.rb +57 -0
- data/lib/bundler/vendor/thor/actions/directory.rb +93 -0
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +134 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +270 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +109 -0
- data/lib/bundler/vendor/thor/base.rb +576 -0
- data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +9 -0
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
- data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +100 -0
- data/lib/bundler/vendor/thor/error.rb +30 -0
- data/lib/bundler/vendor/thor/group.rb +273 -0
- data/lib/bundler/vendor/thor/invocation.rb +168 -0
- data/lib/bundler/vendor/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +67 -0
- data/lib/bundler/vendor/thor/parser/arguments.rb +161 -0
- data/lib/bundler/vendor/thor/parser/option.rb +120 -0
- data/lib/bundler/vendor/thor/parser/options.rb +172 -0
- data/lib/bundler/vendor/thor/rake_compat.rb +66 -0
- data/lib/bundler/vendor/thor/runner.rb +309 -0
- data/lib/bundler/vendor/thor/shell.rb +88 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +302 -0
- data/lib/bundler/vendor/thor/shell/color.rb +108 -0
- data/lib/bundler/vendor/thor/shell/html.rb +121 -0
- data/lib/bundler/vendor/thor/task.rb +113 -0
- data/lib/bundler/vendor/thor/util.rb +229 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/vendored_thor.rb +7 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +11 -0
- data/man/bundle-config.ronn +130 -0
- data/man/bundle-exec.ronn +111 -0
- data/man/bundle-install.ronn +335 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-update.ronn +176 -0
- data/man/bundle.ronn +83 -0
- data/man/gemfile.5.ronn +324 -0
- data/man/index.txt +6 -0
- data/spec/bundler/dsl_spec.rb +48 -0
- data/spec/bundler/gem_helper_spec.rb +174 -0
- data/spec/bundler/source_spec.rb +25 -0
- data/spec/cache/gems_spec.rb +239 -0
- data/spec/cache/git_spec.rb +124 -0
- data/spec/cache/path_spec.rb +103 -0
- data/spec/cache/platform_spec.rb +57 -0
- data/spec/install/deploy_spec.rb +211 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/dependency_api_spec.rb +402 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +313 -0
- data/spec/install/gems/groups_spec.rb +268 -0
- data/spec/install/gems/packed_spec.rb +84 -0
- data/spec/install/gems/platform_spec.rb +208 -0
- data/spec/install/gems/post_install_spec.rb +47 -0
- data/spec/install/gems/resolving_spec.rb +72 -0
- data/spec/install/gems/simple_case_spec.rb +814 -0
- data/spec/install/gems/standalone_spec.rb +260 -0
- data/spec/install/gems/sudo_spec.rb +74 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspec_spec.rb +170 -0
- data/spec/install/git_spec.rb +796 -0
- data/spec/install/invalid_spec.rb +35 -0
- data/spec/install/path_spec.rb +405 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/git_spec.rb +35 -0
- data/spec/lock/lockfile_spec.rb +809 -0
- data/spec/other/check_spec.rb +265 -0
- data/spec/other/clean_spec.rb +492 -0
- data/spec/other/config_spec.rb +138 -0
- data/spec/other/console_spec.rb +54 -0
- data/spec/other/exec_spec.rb +229 -0
- data/spec/other/ext_spec.rb +37 -0
- data/spec/other/help_spec.rb +39 -0
- data/spec/other/init_spec.rb +40 -0
- data/spec/other/newgem_spec.rb +87 -0
- data/spec/other/open_spec.rb +35 -0
- data/spec/other/outdated_spec.rb +93 -0
- data/spec/other/platform_spec.rb +881 -0
- data/spec/other/show_spec.rb +88 -0
- data/spec/quality_spec.rb +62 -0
- data/spec/realworld/edgecases_spec.rb +177 -0
- data/spec/resolver/basic_spec.rb +20 -0
- data/spec/resolver/platform_spec.rb +82 -0
- data/spec/runtime/executable_spec.rb +120 -0
- data/spec/runtime/load_spec.rb +107 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +261 -0
- data/spec/runtime/setup_spec.rb +755 -0
- data/spec/runtime/with_clean_env_spec.rb +80 -0
- data/spec/spec_helper.rb +98 -0
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint.rb +54 -0
- data/spec/support/artifice/endpoint_500.rb +37 -0
- data/spec/support/artifice/endpoint_api_missing.rb +16 -0
- data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint_extra.rb +27 -0
- data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
- data/spec/support/artifice/endpoint_fallback.rb +18 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +15 -0
- data/spec/support/builders.rb +604 -0
- data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
- data/spec/support/fakeweb/windows.rb +23 -0
- data/spec/support/helpers.rb +317 -0
- data/spec/support/indexes.rb +112 -0
- data/spec/support/matchers.rb +77 -0
- data/spec/support/path.rb +73 -0
- data/spec/support/platforms.rb +86 -0
- data/spec/support/ruby_ext.rb +20 -0
- data/spec/support/rubygems_ext.rb +37 -0
- data/spec/support/rubygems_hax/platform.rb +22 -0
- data/spec/support/sudo.rb +21 -0
- data/spec/update/gems_spec.rb +134 -0
- data/spec/update/git_spec.rb +196 -0
- data/spec/update/source_spec.rb +51 -0
- metadata +338 -0
@@ -0,0 +1,260 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle install --standalone" do
|
4
|
+
describe "with simple gems" do
|
5
|
+
before do
|
6
|
+
install_gemfile <<-G, :standalone => true
|
7
|
+
source "file://#{gem_repo1}"
|
8
|
+
gem "rails"
|
9
|
+
G
|
10
|
+
end
|
11
|
+
|
12
|
+
it "still makes the gems available to normal bundler" do
|
13
|
+
should_be_installed "actionpack 2.3.2", "rails 2.3.2"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "generates a bundle/bundler/setup.rb" do
|
17
|
+
bundled_app("bundle/bundler/setup.rb").should exist
|
18
|
+
end
|
19
|
+
|
20
|
+
it "makes the gems available without bundler" do
|
21
|
+
ruby <<-RUBY, :no_lib => true
|
22
|
+
$:.unshift File.expand_path("bundle")
|
23
|
+
require "bundler/setup"
|
24
|
+
|
25
|
+
require "actionpack"
|
26
|
+
puts ACTIONPACK
|
27
|
+
RUBY
|
28
|
+
|
29
|
+
out.should be == "2.3.2"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "works on a different system" do
|
33
|
+
FileUtils.mv(bundled_app, "#{bundled_app}2")
|
34
|
+
Dir.chdir("#{bundled_app}2")
|
35
|
+
|
36
|
+
ruby <<-RUBY, :no_lib => true
|
37
|
+
$:.unshift File.expand_path("bundle")
|
38
|
+
require "bundler/setup"
|
39
|
+
|
40
|
+
require "actionpack"
|
41
|
+
puts ACTIONPACK
|
42
|
+
RUBY
|
43
|
+
|
44
|
+
out.should be == "2.3.2"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "with a combination of gems and git repos" do
|
49
|
+
before do
|
50
|
+
build_git "devise", "1.0"
|
51
|
+
|
52
|
+
install_gemfile <<-G, :standalone => true
|
53
|
+
source "file://#{gem_repo1}"
|
54
|
+
gem "rails"
|
55
|
+
gem "devise", :git => "#{lib_path('devise-1.0')}"
|
56
|
+
G
|
57
|
+
end
|
58
|
+
|
59
|
+
it "still makes the gems available to normal bundler" do
|
60
|
+
should_be_installed "actionpack 2.3.2", "rails 2.3.2", "devise 1.0"
|
61
|
+
end
|
62
|
+
|
63
|
+
it "generates a bundle/bundler/setup.rb" do
|
64
|
+
bundled_app("bundle/bundler/setup.rb").should exist
|
65
|
+
end
|
66
|
+
|
67
|
+
it "makes the gems available without bundler" do
|
68
|
+
ruby <<-RUBY, :no_lib => true
|
69
|
+
$:.unshift File.expand_path("bundle")
|
70
|
+
require "bundler/setup"
|
71
|
+
|
72
|
+
require "devise"
|
73
|
+
require "actionpack"
|
74
|
+
puts DEVISE
|
75
|
+
puts ACTIONPACK
|
76
|
+
RUBY
|
77
|
+
|
78
|
+
out.should be == "1.0\n2.3.2"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "with groups" do
|
83
|
+
before do
|
84
|
+
build_git "devise", "1.0"
|
85
|
+
|
86
|
+
install_gemfile <<-G, :standalone => true
|
87
|
+
source "file://#{gem_repo1}"
|
88
|
+
gem "rails"
|
89
|
+
|
90
|
+
group :test do
|
91
|
+
gem "rspec"
|
92
|
+
gem "rack-test"
|
93
|
+
end
|
94
|
+
G
|
95
|
+
end
|
96
|
+
|
97
|
+
it "makes the gems available without bundler" do
|
98
|
+
ruby <<-RUBY, :no_lib => true
|
99
|
+
$:.unshift File.expand_path("bundle")
|
100
|
+
require "bundler/setup"
|
101
|
+
|
102
|
+
require "actionpack"
|
103
|
+
require "spec"
|
104
|
+
require "rack/test"
|
105
|
+
puts ACTIONPACK
|
106
|
+
puts SPEC
|
107
|
+
puts RACK_TEST
|
108
|
+
RUBY
|
109
|
+
|
110
|
+
out.should be == "2.3.2\n1.2.7\n1.0"
|
111
|
+
end
|
112
|
+
|
113
|
+
it "allows creating a standalone file with limited groups" do
|
114
|
+
bundle "install --standalone default"
|
115
|
+
|
116
|
+
load_error_ruby <<-RUBY, 'spec', :no_lib => true
|
117
|
+
$:.unshift File.expand_path("bundle")
|
118
|
+
require "bundler/setup"
|
119
|
+
|
120
|
+
require "actionpack"
|
121
|
+
puts ACTIONPACK
|
122
|
+
require "spec"
|
123
|
+
RUBY
|
124
|
+
|
125
|
+
out.should be == "2.3.2"
|
126
|
+
err.should == "ZOMG LOAD ERROR"
|
127
|
+
end
|
128
|
+
|
129
|
+
it "allows --without to limit the groups used in a standalone" do
|
130
|
+
bundle "install --standalone --without test"
|
131
|
+
|
132
|
+
load_error_ruby <<-RUBY, 'spec', :no_lib => true
|
133
|
+
$:.unshift File.expand_path("bundle")
|
134
|
+
require "bundler/setup"
|
135
|
+
|
136
|
+
require "actionpack"
|
137
|
+
puts ACTIONPACK
|
138
|
+
require "spec"
|
139
|
+
RUBY
|
140
|
+
|
141
|
+
out.should be == "2.3.2"
|
142
|
+
err.should == "ZOMG LOAD ERROR"
|
143
|
+
end
|
144
|
+
|
145
|
+
it "allows --path to change the location of the standalone bundle" do
|
146
|
+
bundle "install --standalone --path path/to/bundle"
|
147
|
+
|
148
|
+
ruby <<-RUBY, :no_lib => true, :expect_err => false
|
149
|
+
$:.unshift File.expand_path("path/to/bundle")
|
150
|
+
require "bundler/setup"
|
151
|
+
|
152
|
+
require "actionpack"
|
153
|
+
puts ACTIONPACK
|
154
|
+
RUBY
|
155
|
+
|
156
|
+
out.should == "2.3.2"
|
157
|
+
end
|
158
|
+
|
159
|
+
it "allows remembered --without to limit the groups used in a standalone" do
|
160
|
+
bundle "install --without test"
|
161
|
+
bundle "install --standalone"
|
162
|
+
|
163
|
+
load_error_ruby <<-RUBY, 'spec', :no_lib => true
|
164
|
+
$:.unshift File.expand_path("bundle")
|
165
|
+
require "bundler/setup"
|
166
|
+
|
167
|
+
require "actionpack"
|
168
|
+
puts ACTIONPACK
|
169
|
+
require "spec"
|
170
|
+
RUBY
|
171
|
+
|
172
|
+
out.should be == "2.3.2"
|
173
|
+
err.should == "ZOMG LOAD ERROR"
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
describe "with gemcutter's dependency API" do
|
178
|
+
let(:source_uri) { "http://localgemserver.test" }
|
179
|
+
|
180
|
+
describe "simple gems" do
|
181
|
+
before do
|
182
|
+
gemfile <<-G
|
183
|
+
source "#{source_uri}"
|
184
|
+
gem "rails"
|
185
|
+
G
|
186
|
+
end
|
187
|
+
|
188
|
+
it "should run without errors" do
|
189
|
+
bundle "install --standalone", :artifice => "endpoint", :exitstatus => true
|
190
|
+
|
191
|
+
@exitstatus.should be == 0
|
192
|
+
end
|
193
|
+
|
194
|
+
it "still makes the gems available to normal bundler" do
|
195
|
+
bundle "install --standalone", :artifice => "endpoint"
|
196
|
+
|
197
|
+
should_be_installed "actionpack 2.3.2", "rails 2.3.2"
|
198
|
+
end
|
199
|
+
|
200
|
+
it "generates a bundle/bundler/setup.rb" do
|
201
|
+
bundle "install --standalone", :artifice => "endpoint"
|
202
|
+
|
203
|
+
bundled_app("bundle/bundler/setup.rb").should exist
|
204
|
+
end
|
205
|
+
|
206
|
+
it "makes the gems available without bundler" do
|
207
|
+
bundle "install --standalone", :artifice => "endpoint"
|
208
|
+
|
209
|
+
ruby <<-RUBY, :no_lib => true
|
210
|
+
$:.unshift File.expand_path("bundle")
|
211
|
+
require "bundler/setup"
|
212
|
+
|
213
|
+
require "actionpack"
|
214
|
+
puts ACTIONPACK
|
215
|
+
RUBY
|
216
|
+
|
217
|
+
out.should be == "2.3.2"
|
218
|
+
end
|
219
|
+
|
220
|
+
it "works on a different system" do
|
221
|
+
bundle "install --standalone", :artifice => "endpoint"
|
222
|
+
|
223
|
+
FileUtils.mv(bundled_app, "#{bundled_app}2")
|
224
|
+
Dir.chdir("#{bundled_app}2")
|
225
|
+
|
226
|
+
ruby <<-RUBY, :no_lib => true
|
227
|
+
$:.unshift File.expand_path("bundle")
|
228
|
+
require "bundler/setup"
|
229
|
+
|
230
|
+
require "actionpack"
|
231
|
+
puts ACTIONPACK
|
232
|
+
RUBY
|
233
|
+
|
234
|
+
out.should be == "2.3.2"
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
describe "with --binstubs" do
|
240
|
+
before do
|
241
|
+
install_gemfile <<-G, :standalone => true, :binstubs => true
|
242
|
+
source "file://#{gem_repo1}"
|
243
|
+
gem "rails"
|
244
|
+
G
|
245
|
+
end
|
246
|
+
|
247
|
+
it "creates stubs that use the standalone load path" do
|
248
|
+
Dir.chdir(bundled_app) do
|
249
|
+
`bin/rails -v`.chomp.should eql "2.3.2"
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
it "creates stubs that can be executed from anywhere" do
|
254
|
+
require 'tmpdir'
|
255
|
+
Dir.chdir(Dir.tmpdir) do
|
256
|
+
`#{bundled_app}/bin/rails -v`.chomp.should eql "2.3.2"
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "when using sudo", :sudo => true do
|
4
|
+
describe "and GEM_HOME is owned by root" do
|
5
|
+
before :each do
|
6
|
+
chown_system_gems_to_root
|
7
|
+
end
|
8
|
+
|
9
|
+
it "installs" do
|
10
|
+
install_gemfile <<-G
|
11
|
+
source "file://#{gem_repo1}"
|
12
|
+
gem "rack", '1.0'
|
13
|
+
gem "thin"
|
14
|
+
G
|
15
|
+
|
16
|
+
system_gem_path("gems/rack-1.0.0").should exist
|
17
|
+
system_gem_path("gems/rack-1.0.0").stat.uid.should eq(0)
|
18
|
+
should_be_installed "rack 1.0"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "installs when BUNDLE_PATH is owned by root" do
|
22
|
+
bundle_path = tmp("owned_by_root")
|
23
|
+
FileUtils.mkdir_p bundle_path
|
24
|
+
sudo "chown -R root #{bundle_path}"
|
25
|
+
|
26
|
+
ENV['BUNDLE_PATH'] = bundle_path.to_s
|
27
|
+
install_gemfile <<-G
|
28
|
+
source "file://#{gem_repo1}"
|
29
|
+
gem "rack", '1.0'
|
30
|
+
G
|
31
|
+
|
32
|
+
bundle_path.join("gems/rack-1.0.0").should exist
|
33
|
+
bundle_path.join("gems/rack-1.0.0").stat.uid.should eq(0)
|
34
|
+
should_be_installed "rack 1.0"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "installs when BUNDLE_PATH does not exist"
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "and BUNDLE_PATH is not writable" do
|
41
|
+
it "installs" do
|
42
|
+
sudo "chmod ugo-w #{default_bundle_path}"
|
43
|
+
install_gemfile <<-G
|
44
|
+
source "file://#{gem_repo1}"
|
45
|
+
gem "rack", '1.0'
|
46
|
+
G
|
47
|
+
|
48
|
+
default_bundle_path("gems/rack-1.0.0").should exist
|
49
|
+
should_be_installed "rack 1.0"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "and BUNDLE_PATH is not writable" do
|
54
|
+
it "installs" do
|
55
|
+
begin
|
56
|
+
gem_home = tmp('sudo_gem_home')
|
57
|
+
|
58
|
+
sudo "mkdir -p #{gem_home}"
|
59
|
+
sudo "chmod ugo-w #{gem_home}"
|
60
|
+
ENV['GEM_HOME'] = gem_home.to_s
|
61
|
+
ENV['GEM_PATH'] = nil
|
62
|
+
|
63
|
+
install_gemfile <<-G
|
64
|
+
source "file://#{gem_repo1}"
|
65
|
+
gem "rack", '1.0'
|
66
|
+
G
|
67
|
+
|
68
|
+
gem_home.join('bin/rackup').should exist
|
69
|
+
should_be_installed "rack 1.0"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "bundle install with win32-generated lockfile" do
|
4
|
+
it 'should read lockfile' do
|
5
|
+
File.open(bundled_app('Gemfile.lock'), 'wb') do |f|
|
6
|
+
f << "GEM\r\n"
|
7
|
+
f << " remote: file:#{gem_repo1}/\r\n"
|
8
|
+
f << " specs:\r\n"
|
9
|
+
f << "\r\n"
|
10
|
+
f << " rack (1.0.0)\r\n"
|
11
|
+
f << "\r\n"
|
12
|
+
f << "PLATFORMS\r\n"
|
13
|
+
f << " ruby\r\n"
|
14
|
+
f << "\r\n"
|
15
|
+
f << "DEPENDENCIES\r\n"
|
16
|
+
f << " rack\r\n"
|
17
|
+
end
|
18
|
+
|
19
|
+
install_gemfile <<-G, :exitstatus => true
|
20
|
+
source "file://#{gem_repo1}"
|
21
|
+
|
22
|
+
gem "rack"
|
23
|
+
G
|
24
|
+
@exitstatus.should == 0
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,170 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle install from an existing gemspec" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
build_gem "bar", :to_system => true
|
7
|
+
build_gem "bar-dev", :to_system => true
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should install runtime and development dependencies" do
|
11
|
+
build_lib("foo", :path => tmp.join("foo")) do |s|
|
12
|
+
s.write("Gemfile", "source :rubygems\ngemspec")
|
13
|
+
s.add_dependency "bar", "=1.0.0"
|
14
|
+
s.add_development_dependency "bar-dev", '=1.0.0'
|
15
|
+
end
|
16
|
+
install_gemfile <<-G
|
17
|
+
source "file://#{gem_repo2}"
|
18
|
+
gemspec :path => '#{tmp.join("foo")}'
|
19
|
+
G
|
20
|
+
|
21
|
+
should_be_installed "bar 1.0.0"
|
22
|
+
should_be_installed "bar-dev 1.0.0", :groups => :development
|
23
|
+
end
|
24
|
+
|
25
|
+
it "that is hidden should install runtime and development dependencies" do
|
26
|
+
build_lib("foo", :path => tmp.join("foo")) do |s|
|
27
|
+
s.write("Gemfile", "source :rubygems\ngemspec")
|
28
|
+
s.add_dependency "bar", "=1.0.0"
|
29
|
+
s.add_development_dependency "bar-dev", '=1.0.0'
|
30
|
+
end
|
31
|
+
FileUtils.mv tmp.join('foo', 'foo.gemspec'), tmp.join('foo', '.gemspec')
|
32
|
+
|
33
|
+
install_gemfile <<-G
|
34
|
+
source "file://#{gem_repo2}"
|
35
|
+
gemspec :path => '#{tmp.join("foo")}'
|
36
|
+
G
|
37
|
+
|
38
|
+
should_be_installed "bar 1.0.0"
|
39
|
+
should_be_installed "bar-dev 1.0.0", :groups => :development
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should handle a list of requirements" do
|
43
|
+
build_gem "baz", "1.0", :to_system => true
|
44
|
+
build_gem "baz", "1.1", :to_system => true
|
45
|
+
|
46
|
+
build_lib("foo", :path => tmp.join("foo")) do |s|
|
47
|
+
s.write("Gemfile", "source :rubygems\ngemspec")
|
48
|
+
s.add_dependency "baz", ">= 1.0", "< 1.1"
|
49
|
+
end
|
50
|
+
install_gemfile <<-G
|
51
|
+
source "file://#{gem_repo2}"
|
52
|
+
gemspec :path => '#{tmp.join("foo")}'
|
53
|
+
G
|
54
|
+
|
55
|
+
should_be_installed "baz 1.0"
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should raise if there are no gemspecs available" do
|
59
|
+
build_lib("foo", :path => tmp.join("foo"), :gemspec => false)
|
60
|
+
|
61
|
+
error = install_gemfile(<<-G, :expect_err => true)
|
62
|
+
source "file://#{gem_repo2}"
|
63
|
+
gemspec :path => '#{tmp.join("foo")}'
|
64
|
+
G
|
65
|
+
error.should match(/There are no gemspecs at #{tmp.join('foo')}/)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should raise if there are too many gemspecs available" do
|
69
|
+
build_lib("foo", :path => tmp.join("foo")) do |s|
|
70
|
+
s.write("foo2.gemspec", "")
|
71
|
+
end
|
72
|
+
|
73
|
+
error = install_gemfile(<<-G, :expect_err => true)
|
74
|
+
source "file://#{gem_repo2}"
|
75
|
+
gemspec :path => '#{tmp.join("foo")}'
|
76
|
+
G
|
77
|
+
error.should match(/There are multiple gemspecs at #{tmp.join('foo')}/)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should pick a specific gemspec" do
|
81
|
+
build_lib("foo", :path => tmp.join("foo")) do |s|
|
82
|
+
s.write("foo2.gemspec", "")
|
83
|
+
s.add_dependency "bar", "=1.0.0"
|
84
|
+
s.add_development_dependency "bar-dev", '=1.0.0'
|
85
|
+
end
|
86
|
+
|
87
|
+
install_gemfile(<<-G, :expect_err => true)
|
88
|
+
source "file://#{gem_repo2}"
|
89
|
+
gemspec :path => '#{tmp.join("foo")}', :name => 'foo'
|
90
|
+
G
|
91
|
+
|
92
|
+
should_be_installed "bar 1.0.0"
|
93
|
+
should_be_installed "bar-dev 1.0.0", :groups => :development
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should use a specific group for development dependencies" do
|
97
|
+
build_lib("foo", :path => tmp.join("foo")) do |s|
|
98
|
+
s.write("foo2.gemspec", "")
|
99
|
+
s.add_dependency "bar", "=1.0.0"
|
100
|
+
s.add_development_dependency "bar-dev", '=1.0.0'
|
101
|
+
end
|
102
|
+
|
103
|
+
install_gemfile(<<-G, :expect_err => true)
|
104
|
+
source "file://#{gem_repo2}"
|
105
|
+
gemspec :path => '#{tmp.join("foo")}', :name => 'foo', :development_group => :dev
|
106
|
+
G
|
107
|
+
|
108
|
+
should_be_installed "bar 1.0.0"
|
109
|
+
should_not_be_installed "bar-dev 1.0.0", :groups => :development
|
110
|
+
should_be_installed "bar-dev 1.0.0", :groups => :dev
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should match a lockfile even if the gemspec defines development dependencies" do
|
114
|
+
build_lib("foo", :path => tmp.join("foo")) do |s|
|
115
|
+
s.write("Gemfile", "source 'file://#{gem_repo1}'\ngemspec")
|
116
|
+
s.add_dependency "actionpack", "=2.3.2"
|
117
|
+
s.add_development_dependency "rake", '=0.8.7'
|
118
|
+
end
|
119
|
+
|
120
|
+
Dir.chdir(tmp.join("foo")) do
|
121
|
+
bundle "install"
|
122
|
+
# This should really be able to rely on $stderr, but, it's not written
|
123
|
+
# right, so we can't. In fact, this is a bug negation test, and so it'll
|
124
|
+
# ghost pass in future, and will only catch a regression if the message
|
125
|
+
# doesn't change. Exit codes should be used correctly (they can be more
|
126
|
+
# than just 0 and 1).
|
127
|
+
output = bundle("install --deployment")
|
128
|
+
output.should_not match(/You have added to the Gemfile/)
|
129
|
+
output.should_not match(/You have deleted from the Gemfile/)
|
130
|
+
output.should_not match(/install in deployment mode after changing/)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should evaluate the gemspec in its directory" do
|
135
|
+
build_lib("foo", :path => tmp.join("foo"))
|
136
|
+
File.open(tmp.join("foo/foo.gemspec"), "w") do |s|
|
137
|
+
s.write "raise 'ahh' unless Dir.pwd == '#{tmp.join("foo")}'"
|
138
|
+
end
|
139
|
+
|
140
|
+
install_gemfile <<-G, :expect_err => true
|
141
|
+
gemspec :path => '#{tmp.join("foo")}'
|
142
|
+
G
|
143
|
+
@err.should_not match(/ahh/)
|
144
|
+
end
|
145
|
+
|
146
|
+
context "when child gemspecs conflict with a released gemspec" do
|
147
|
+
before do
|
148
|
+
# build the "parent" gem that depends on another gem in the same repo
|
149
|
+
build_lib "source_conflict", :path => bundled_app do |s|
|
150
|
+
s.add_dependency "rack_middleware"
|
151
|
+
end
|
152
|
+
|
153
|
+
# build the "child" gem that is the same version as a released gem, but
|
154
|
+
# has completely different and conflicting dependency requirements
|
155
|
+
build_lib "rack_middleware", "1.0", :path => bundled_app("rack_middleware") do |s|
|
156
|
+
s.add_dependency "rack", "1.0" # anything other than 0.9.1
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should install the child gemspec's deps" do
|
161
|
+
install_gemfile <<-G
|
162
|
+
source "file://#{gem_repo1}"
|
163
|
+
gemspec
|
164
|
+
G
|
165
|
+
|
166
|
+
should_be_installed "rack 1.0"
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|