bundler 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- data/.gitignore +12 -0
- data/CHANGELOG.md +28 -6
- data/ISSUES.md +1 -1
- data/README.md +7 -5
- data/Rakefile +173 -0
- data/UPGRADING.md +103 -0
- data/bundler.gemspec +28 -0
- data/lib/bundler.rb +1 -0
- data/lib/bundler/capistrano.rb +2 -31
- data/lib/bundler/cli.rb +18 -16
- data/lib/bundler/deployment.rb +37 -0
- data/lib/bundler/dsl.rb +3 -3
- data/lib/bundler/gem_helper.rb +4 -7
- data/lib/bundler/graph.rb +3 -3
- data/lib/bundler/installer.rb +1 -0
- data/lib/bundler/lockfile_parser.rb +1 -1
- data/lib/bundler/man/bundle +1 -1
- data/lib/bundler/man/bundle-config +92 -0
- data/lib/bundler/man/bundle-config.txt +72 -30
- data/lib/bundler/man/bundle-exec +1 -1
- data/lib/bundler/man/bundle-exec.txt +1 -1
- data/lib/bundler/man/bundle-install +1 -1
- data/lib/bundler/man/bundle-install.txt +1 -1
- data/lib/bundler/man/bundle-package +1 -1
- data/lib/bundler/man/bundle-package.txt +1 -1
- data/lib/bundler/man/bundle-update +1 -1
- data/lib/bundler/man/bundle-update.txt +1 -1
- data/lib/bundler/man/bundle.txt +1 -1
- data/lib/bundler/man/gemfile.5 +2 -2
- data/lib/bundler/man/gemfile.5.txt +2 -2
- data/lib/bundler/settings.rb +2 -2
- data/lib/bundler/source.rb +2 -3
- data/lib/bundler/templates/Executable +1 -1
- data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
- data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +11 -12
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/vlad.rb +9 -0
- data/man/bundle-config.ronn +90 -0
- data/man/bundle-exec.ronn +98 -0
- data/man/bundle-install.ronn +310 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-update.ronn +176 -0
- data/man/bundle.ronn +77 -0
- data/man/gemfile.5.ronn +254 -0
- data/man/index.txt +6 -0
- data/spec/cache/gems_spec.rb +205 -0
- data/spec/cache/git_spec.rb +9 -0
- data/spec/cache/path_spec.rb +27 -0
- data/spec/cache/platform_spec.rb +57 -0
- data/spec/install/deploy_spec.rb +171 -0
- data/spec/install/deprecated_spec.rb +43 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +272 -0
- data/spec/install/gems/groups_spec.rb +209 -0
- data/spec/install/gems/locked_spec.rb +48 -0
- data/spec/install/gems/packed_spec.rb +72 -0
- data/spec/install/gems/platform_spec.rb +181 -0
- data/spec/install/gems/resolving_spec.rb +72 -0
- data/spec/install/gems/simple_case_spec.rb +709 -0
- data/spec/install/gems/sudo_spec.rb +77 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspec_spec.rb +96 -0
- data/spec/install/git_spec.rb +552 -0
- data/spec/install/invalid_spec.rb +17 -0
- data/spec/install/path_spec.rb +335 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/flex_spec.rb +625 -0
- data/spec/lock/git_spec.rb +35 -0
- data/spec/other/check_spec.rb +221 -0
- data/spec/other/config_spec.rb +40 -0
- data/spec/other/console_spec.rb +102 -0
- data/spec/other/exec_spec.rb +241 -0
- data/spec/other/ext_spec.rb +16 -0
- data/spec/other/gem_helper_spec.rb +116 -0
- data/spec/other/help_spec.rb +36 -0
- data/spec/other/init_spec.rb +40 -0
- data/spec/other/newgem_spec.rb +24 -0
- data/spec/other/open_spec.rb +51 -0
- data/spec/other/show_spec.rb +99 -0
- data/spec/pack/gems_spec.rb +22 -0
- data/spec/quality_spec.rb +55 -0
- data/spec/resolver/basic_spec.rb +20 -0
- data/spec/resolver/platform_spec.rb +57 -0
- data/spec/runtime/environment_rb_spec.rb +170 -0
- data/spec/runtime/executable_spec.rb +110 -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 +412 -0
- data/spec/runtime/with_clean_env_spec.rb +15 -0
- data/spec/spec_helper.rb +81 -0
- data/spec/support/builders.rb +566 -0
- data/spec/support/helpers.rb +243 -0
- data/spec/support/indexes.rb +113 -0
- data/spec/support/matchers.rb +89 -0
- data/spec/support/path.rb +71 -0
- data/spec/support/platforms.rb +49 -0
- data/spec/support/ruby_ext.rb +19 -0
- data/spec/support/rubygems_ext.rb +30 -0
- data/spec/support/rubygems_hax/rubygems_plugin.rb +9 -0
- data/spec/support/sudo.rb +21 -0
- data/spec/update/gems_spec.rb +86 -0
- data/spec/update/git_spec.rb +159 -0
- data/spec/update/source_spec.rb +50 -0
- metadata +170 -32
- data/ROADMAP.md +0 -36
@@ -0,0 +1,77 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "when using sudo" do
|
4
|
+
before :each do
|
5
|
+
pending "set BUNDLER_SUDO_TESTS to run sudo specs" unless test_sudo?
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "and GEM_HOME is owned by root" do
|
9
|
+
before :each do
|
10
|
+
chown_system_gems_to_root
|
11
|
+
end
|
12
|
+
|
13
|
+
it "installs" do
|
14
|
+
install_gemfile <<-G
|
15
|
+
source "file://#{gem_repo1}"
|
16
|
+
gem "rack", '1.0'
|
17
|
+
G
|
18
|
+
|
19
|
+
system_gem_path("gems/rack-1.0.0").should exist
|
20
|
+
system_gem_path("gems/rack-1.0.0").stat.uid.should == 0
|
21
|
+
should_be_installed "rack 1.0"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "installs when BUNDLE_PATH is owned by root" do
|
25
|
+
bundle_path = tmp("owned_by_root")
|
26
|
+
FileUtils.mkdir_p bundle_path
|
27
|
+
sudo "chown -R root #{bundle_path}"
|
28
|
+
|
29
|
+
ENV['BUNDLE_PATH'] = bundle_path.to_s
|
30
|
+
install_gemfile <<-G
|
31
|
+
source "file://#{gem_repo1}"
|
32
|
+
gem "rack", '1.0'
|
33
|
+
G
|
34
|
+
|
35
|
+
bundle_path.join("gems/rack-1.0.0").should exist
|
36
|
+
bundle_path.join("gems/rack-1.0.0").stat.uid.should == 0
|
37
|
+
should_be_installed "rack 1.0"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "installs when BUNDLE_PATH does not exist"
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "and BUNDLE_PATH is not writable" do
|
44
|
+
it "installs" do
|
45
|
+
sudo "chmod ugo-w #{default_bundle_path}"
|
46
|
+
install_gemfile <<-G
|
47
|
+
source "file://#{gem_repo1}"
|
48
|
+
gem "rack", '1.0'
|
49
|
+
G
|
50
|
+
|
51
|
+
default_bundle_path("gems/rack-1.0.0").should exist
|
52
|
+
should_be_installed "rack 1.0"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "and BUNDLE_PATH is not writable" do
|
57
|
+
it "installs" do
|
58
|
+
begin
|
59
|
+
gem_home = tmp('sudo_gem_home')
|
60
|
+
|
61
|
+
sudo "mkdir -p #{gem_home}"
|
62
|
+
sudo "chmod ugo-w #{gem_home}"
|
63
|
+
ENV['GEM_HOME'] = gem_home.to_s
|
64
|
+
ENV['GEM_PATH'] = nil
|
65
|
+
|
66
|
+
install_gemfile <<-G
|
67
|
+
source "file://#{gem_repo1}"
|
68
|
+
gem "rack", '1.0'
|
69
|
+
G
|
70
|
+
|
71
|
+
gem_home.join('bin/rackup').should exist
|
72
|
+
should_be_installed "rack 1.0"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
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, :exit_status => true
|
20
|
+
source "file://#{gem_repo1}"
|
21
|
+
|
22
|
+
gem "rack"
|
23
|
+
G
|
24
|
+
@exitstatus.should == 0
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,96 @@
|
|
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 "should handle a list of requirements" do
|
26
|
+
build_gem "baz", "1.0", :to_system => true
|
27
|
+
build_gem "baz", "1.1", :to_system => true
|
28
|
+
|
29
|
+
build_lib("foo", :path => tmp.join("foo")) do |s|
|
30
|
+
s.write("Gemfile", "source :rubygems\ngemspec")
|
31
|
+
s.add_dependency "baz", ">= 1.0", "< 1.1"
|
32
|
+
end
|
33
|
+
install_gemfile <<-G
|
34
|
+
source "file://#{gem_repo2}"
|
35
|
+
gemspec :path => '#{tmp.join("foo")}'
|
36
|
+
G
|
37
|
+
|
38
|
+
should_be_installed "baz 1.0"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should raise if there are no gemspecs available" do
|
42
|
+
build_lib("foo", :path => tmp.join("foo"), :gemspec => false)
|
43
|
+
|
44
|
+
error = install_gemfile(<<-G, :expect_err => true)
|
45
|
+
source "file://#{gem_repo2}"
|
46
|
+
gemspec :path => '#{tmp.join("foo")}'
|
47
|
+
G
|
48
|
+
error.should match(/There are no gemspecs at #{tmp.join('foo')}/)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should raise if there are too many gemspecs available" do
|
52
|
+
build_lib("foo", :path => tmp.join("foo")) do |s|
|
53
|
+
s.write("foo2.gemspec", "")
|
54
|
+
end
|
55
|
+
|
56
|
+
error = install_gemfile(<<-G, :expect_err => true)
|
57
|
+
source "file://#{gem_repo2}"
|
58
|
+
gemspec :path => '#{tmp.join("foo")}'
|
59
|
+
G
|
60
|
+
error.should match(/There are multiple gemspecs at #{tmp.join('foo')}/)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should pick a specific gemspec" do
|
64
|
+
build_lib("foo", :path => tmp.join("foo")) do |s|
|
65
|
+
s.write("foo2.gemspec", "")
|
66
|
+
s.add_dependency "bar", "=1.0.0"
|
67
|
+
s.add_development_dependency "bar-dev", '=1.0.0'
|
68
|
+
end
|
69
|
+
|
70
|
+
install_gemfile(<<-G, :expect_err => true)
|
71
|
+
source "file://#{gem_repo2}"
|
72
|
+
gemspec :path => '#{tmp.join("foo")}', :name => 'foo'
|
73
|
+
G
|
74
|
+
|
75
|
+
should_be_installed "bar 1.0.0"
|
76
|
+
should_be_installed "bar-dev 1.0.0", :groups => :development
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should use a specific group for development dependencies" do
|
80
|
+
build_lib("foo", :path => tmp.join("foo")) do |s|
|
81
|
+
s.write("foo2.gemspec", "")
|
82
|
+
s.add_dependency "bar", "=1.0.0"
|
83
|
+
s.add_development_dependency "bar-dev", '=1.0.0'
|
84
|
+
end
|
85
|
+
|
86
|
+
install_gemfile(<<-G, :expect_err => true)
|
87
|
+
source "file://#{gem_repo2}"
|
88
|
+
gemspec :path => '#{tmp.join("foo")}', :name => 'foo', :development_group => :dev
|
89
|
+
G
|
90
|
+
|
91
|
+
should_be_installed "bar 1.0.0"
|
92
|
+
should_not_be_installed "bar-dev 1.0.0", :groups => :development
|
93
|
+
should_be_installed "bar-dev 1.0.0", :groups => :dev
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
@@ -0,0 +1,552 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle install with git sources" do
|
4
|
+
describe "when floating on master" do
|
5
|
+
before :each do
|
6
|
+
build_git "foo" do |s|
|
7
|
+
s.executables = "foobar"
|
8
|
+
end
|
9
|
+
|
10
|
+
install_gemfile <<-G
|
11
|
+
source "file://#{gem_repo1}"
|
12
|
+
git "#{lib_path('foo-1.0')}" do
|
13
|
+
gem 'foo'
|
14
|
+
end
|
15
|
+
G
|
16
|
+
end
|
17
|
+
|
18
|
+
it "fetches gems" do
|
19
|
+
should_be_installed("foo 1.0")
|
20
|
+
|
21
|
+
run <<-RUBY
|
22
|
+
require 'foo'
|
23
|
+
puts "WIN" unless defined?(FOO_PREV_REF)
|
24
|
+
RUBY
|
25
|
+
|
26
|
+
out.should == "WIN"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "caches the git repo" do
|
30
|
+
Dir["#{default_bundle_path}/cache/bundler/git/foo-1.0-*"].should have(1).item
|
31
|
+
end
|
32
|
+
|
33
|
+
it "does not update the git source implicitly" do
|
34
|
+
update_git "foo"
|
35
|
+
|
36
|
+
in_app_root2 do
|
37
|
+
install_gemfile bundled_app2("Gemfile"), <<-G
|
38
|
+
git "#{lib_path('foo-1.0')}" do
|
39
|
+
gem 'foo'
|
40
|
+
end
|
41
|
+
G
|
42
|
+
end
|
43
|
+
|
44
|
+
in_app_root do
|
45
|
+
run <<-RUBY
|
46
|
+
require 'foo'
|
47
|
+
puts "fail" if defined?(FOO_PREV_REF)
|
48
|
+
RUBY
|
49
|
+
|
50
|
+
out.should be_empty
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
it "setups executables" do
|
55
|
+
pending_jruby_shebang_fix
|
56
|
+
bundle "exec foobar"
|
57
|
+
out.should == "1.0"
|
58
|
+
end
|
59
|
+
|
60
|
+
it "complains if pinned specs don't exist in the git repo" do
|
61
|
+
build_git "foo"
|
62
|
+
|
63
|
+
install_gemfile <<-G
|
64
|
+
gem "foo", "1.1", :git => "#{lib_path('foo-1.0')}"
|
65
|
+
G
|
66
|
+
|
67
|
+
out.should include("Source contains 'foo' at: 1.0")
|
68
|
+
end
|
69
|
+
|
70
|
+
it "still works after moving the application directory" do
|
71
|
+
bundle "install vendor"
|
72
|
+
FileUtils.mv bundled_app, tmp('bundled_app.bck')
|
73
|
+
|
74
|
+
Dir.chdir tmp('bundled_app.bck')
|
75
|
+
should_be_installed "foo 1.0"
|
76
|
+
end
|
77
|
+
|
78
|
+
it "can still install after moving the application directory" do
|
79
|
+
bundle "install vendor"
|
80
|
+
FileUtils.mv bundled_app, tmp('bundled_app.bck')
|
81
|
+
|
82
|
+
update_git "foo", "1.1", :path => lib_path("foo-1.0")
|
83
|
+
|
84
|
+
Dir.chdir tmp('bundled_app.bck')
|
85
|
+
gemfile tmp('bundled_app.bck/Gemfile'), <<-G
|
86
|
+
source "file://#{gem_repo1}"
|
87
|
+
git "#{lib_path('foo-1.0')}" do
|
88
|
+
gem 'foo'
|
89
|
+
end
|
90
|
+
|
91
|
+
gem "rack", "1.0"
|
92
|
+
G
|
93
|
+
|
94
|
+
bundle "update foo"
|
95
|
+
|
96
|
+
should_be_installed "foo 1.1", "rack 1.0"
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
describe "with an empty git block" do
|
102
|
+
before do
|
103
|
+
build_git "foo"
|
104
|
+
gemfile <<-G
|
105
|
+
source "file://#{gem_repo1}"
|
106
|
+
gem "rack"
|
107
|
+
|
108
|
+
git "#{lib_path("foo-1.0")}" do
|
109
|
+
# this page left intentionally blank
|
110
|
+
end
|
111
|
+
G
|
112
|
+
end
|
113
|
+
|
114
|
+
it "does not explode" do
|
115
|
+
bundle "install"
|
116
|
+
should_be_installed "rack 1.0"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe "when specifying a revision" do
|
121
|
+
it "works" do
|
122
|
+
build_git "foo"
|
123
|
+
@revision = revision_for(lib_path("foo-1.0"))
|
124
|
+
update_git "foo"
|
125
|
+
|
126
|
+
install_gemfile <<-G
|
127
|
+
git "#{lib_path('foo-1.0')}", :ref => "#{@revision}" do
|
128
|
+
gem "foo"
|
129
|
+
end
|
130
|
+
G
|
131
|
+
|
132
|
+
run <<-RUBY
|
133
|
+
require 'foo'
|
134
|
+
puts "WIN" unless defined?(FOO_PREV_REF)
|
135
|
+
RUBY
|
136
|
+
|
137
|
+
out.should == "WIN"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe "specified inline" do
|
142
|
+
# TODO: Figure out how to write this test so that it is not flaky depending
|
143
|
+
# on the current network situation.
|
144
|
+
# it "supports private git URLs" do
|
145
|
+
# gemfile <<-G
|
146
|
+
# gem "thingy", :git => "git@notthere.fallingsnow.net:somebody/thingy.git"
|
147
|
+
# G
|
148
|
+
#
|
149
|
+
# bundle :install, :expect_err => true
|
150
|
+
#
|
151
|
+
# # p out
|
152
|
+
# # p err
|
153
|
+
# puts err unless err.empty? # This spec fails randomly every so often
|
154
|
+
# err.should include("notthere.fallingsnow.net")
|
155
|
+
# err.should include("ssh")
|
156
|
+
# end
|
157
|
+
|
158
|
+
it "installs from git even if a newer gem is available elsewhere" do
|
159
|
+
build_git "rack", "0.8"
|
160
|
+
|
161
|
+
install_gemfile <<-G
|
162
|
+
source "file://#{gem_repo1}"
|
163
|
+
gem "rack", :git => "#{lib_path('rack-0.8')}"
|
164
|
+
G
|
165
|
+
|
166
|
+
should_be_installed "rack 0.8"
|
167
|
+
end
|
168
|
+
|
169
|
+
it "installs dependencies from git even if a newer gem is available elsewhere" do
|
170
|
+
system_gems "rack-1.0.0"
|
171
|
+
|
172
|
+
build_lib "rack", "1.0", :path => lib_path('nested/bar') do |s|
|
173
|
+
s.write "lib/rack.rb", "puts 'WIN OVERRIDE'"
|
174
|
+
end
|
175
|
+
|
176
|
+
build_git "foo", :path => lib_path('nested') do |s|
|
177
|
+
s.add_dependency "rack", "= 1.0"
|
178
|
+
end
|
179
|
+
|
180
|
+
install_gemfile <<-G
|
181
|
+
source "file://#{gem_repo1}"
|
182
|
+
gem "foo", :git => "#{lib_path('nested')}"
|
183
|
+
G
|
184
|
+
|
185
|
+
run "require 'rack'"
|
186
|
+
out.should == 'WIN OVERRIDE'
|
187
|
+
end
|
188
|
+
|
189
|
+
it "correctly unlocks when changing to a git source" do
|
190
|
+
install_gemfile <<-G
|
191
|
+
source "file://#{gem_repo1}"
|
192
|
+
gem "rack", "0.9.1"
|
193
|
+
G
|
194
|
+
|
195
|
+
build_git "rack", :path => lib_path("rack")
|
196
|
+
|
197
|
+
install_gemfile <<-G
|
198
|
+
source "file://#{gem_repo1}"
|
199
|
+
gem "rack", "1.0.0", :git => "#{lib_path('rack')}"
|
200
|
+
G
|
201
|
+
|
202
|
+
should_be_installed "rack 1.0.0"
|
203
|
+
end
|
204
|
+
|
205
|
+
it "correctly unlocks when changing to a git source without versions" do
|
206
|
+
install_gemfile <<-G
|
207
|
+
source "file://#{gem_repo1}"
|
208
|
+
gem "rack"
|
209
|
+
G
|
210
|
+
|
211
|
+
build_git "rack", "1.2", :path => lib_path("rack")
|
212
|
+
|
213
|
+
install_gemfile <<-G
|
214
|
+
source "file://#{gem_repo1}"
|
215
|
+
gem "rack", :git => "#{lib_path('rack')}"
|
216
|
+
G
|
217
|
+
|
218
|
+
should_be_installed "rack 1.2"
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
describe "block syntax" do
|
223
|
+
it "pulls all gems from a git block" do
|
224
|
+
build_lib "omg", :path => lib_path('hi2u/omg')
|
225
|
+
build_lib "hi2u", :path => lib_path('hi2u')
|
226
|
+
|
227
|
+
install_gemfile <<-G
|
228
|
+
path "#{lib_path('hi2u')}" do
|
229
|
+
gem "omg"
|
230
|
+
gem "hi2u"
|
231
|
+
end
|
232
|
+
G
|
233
|
+
|
234
|
+
should_be_installed "omg 1.0", "hi2u 1.0"
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
it "uses a ref if specified" do
|
239
|
+
build_git "foo"
|
240
|
+
@revision = revision_for(lib_path("foo-1.0"))
|
241
|
+
update_git "foo"
|
242
|
+
|
243
|
+
install_gemfile <<-G
|
244
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}", :ref => "#{@revision}"
|
245
|
+
G
|
246
|
+
|
247
|
+
run <<-RUBY
|
248
|
+
require 'foo'
|
249
|
+
puts "WIN" unless defined?(FOO_PREV_REF)
|
250
|
+
RUBY
|
251
|
+
|
252
|
+
out.should == "WIN"
|
253
|
+
end
|
254
|
+
|
255
|
+
it "correctly handles cases with invalid gemspecs" do
|
256
|
+
build_git "foo" do |s|
|
257
|
+
s.summary = nil
|
258
|
+
end
|
259
|
+
|
260
|
+
install_gemfile <<-G
|
261
|
+
source "file://#{gem_repo1}"
|
262
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}"
|
263
|
+
gem "rails", "2.3.2"
|
264
|
+
G
|
265
|
+
|
266
|
+
should_be_installed "foo 1.0"
|
267
|
+
should_be_installed "rails 2.3.2"
|
268
|
+
end
|
269
|
+
|
270
|
+
it "runs the gemspec in the context of its parent directory" do
|
271
|
+
build_lib "bar", :path => lib_path("foo/bar"), :gemspec => false do |s|
|
272
|
+
s.write lib_path("foo/bar/lib/version.rb"), %{BAR_VERSION = '1.0'}
|
273
|
+
s.write "bar.gemspec", <<-G
|
274
|
+
$:.unshift Dir.pwd # For 1.9
|
275
|
+
require 'lib/version'
|
276
|
+
Gem::Specification.new do |s|
|
277
|
+
s.name = 'bar'
|
278
|
+
s.version = BAR_VERSION
|
279
|
+
s.summary = 'Bar'
|
280
|
+
s.files = Dir["lib/**/*.rb"]
|
281
|
+
end
|
282
|
+
G
|
283
|
+
end
|
284
|
+
|
285
|
+
build_git "foo", :path => lib_path("foo") do |s|
|
286
|
+
s.write "bin/foo", ""
|
287
|
+
end
|
288
|
+
|
289
|
+
install_gemfile <<-G
|
290
|
+
source "file://#{gem_repo1}"
|
291
|
+
gem "bar", :git => "#{lib_path("foo")}"
|
292
|
+
gem "rails", "2.3.2"
|
293
|
+
G
|
294
|
+
|
295
|
+
should_be_installed "bar 1.0"
|
296
|
+
should_be_installed "rails 2.3.2"
|
297
|
+
end
|
298
|
+
|
299
|
+
it "installs from git even if a rubygems gem is present" do
|
300
|
+
build_gem "foo", "1.0", :path => lib_path('fake_foo'), :to_system => true do |s|
|
301
|
+
s.write "lib/foo.rb", "raise 'FAIL'"
|
302
|
+
end
|
303
|
+
|
304
|
+
build_git "foo", "1.0"
|
305
|
+
|
306
|
+
install_gemfile <<-G
|
307
|
+
gem "foo", "1.0", :git => "#{lib_path('foo-1.0')}"
|
308
|
+
G
|
309
|
+
|
310
|
+
should_be_installed "foo 1.0"
|
311
|
+
end
|
312
|
+
|
313
|
+
it "fakes the gem out if there is no gemspec" do
|
314
|
+
build_git "foo", :gemspec => false
|
315
|
+
|
316
|
+
install_gemfile <<-G
|
317
|
+
source "file://#{gem_repo1}"
|
318
|
+
gem "foo", "1.0", :git => "#{lib_path('foo-1.0')}"
|
319
|
+
gem "rails", "2.3.2"
|
320
|
+
G
|
321
|
+
|
322
|
+
should_be_installed("foo 1.0")
|
323
|
+
should_be_installed("rails 2.3.2")
|
324
|
+
end
|
325
|
+
|
326
|
+
it "catches git errors and spits out useful output" do
|
327
|
+
gemfile <<-G
|
328
|
+
gem "foo", "1.0", :git => "omgomg"
|
329
|
+
G
|
330
|
+
|
331
|
+
bundle :install, :expect_err => true
|
332
|
+
|
333
|
+
out.should include("An error has occurred in git")
|
334
|
+
err.should include("fatal: 'omgomg'")
|
335
|
+
err.should include("fatal: The remote end hung up unexpectedly")
|
336
|
+
end
|
337
|
+
|
338
|
+
it "works when the gem path has spaces in it" do
|
339
|
+
build_git "foo", :path => lib_path('foo space-1.0')
|
340
|
+
|
341
|
+
install_gemfile <<-G
|
342
|
+
gem "foo", :git => "#{lib_path('foo space-1.0')}"
|
343
|
+
G
|
344
|
+
|
345
|
+
should_be_installed "foo 1.0"
|
346
|
+
end
|
347
|
+
|
348
|
+
it "handles repos that have been force-pushed" do
|
349
|
+
build_git "forced", "1.0"
|
350
|
+
|
351
|
+
install_gemfile <<-G
|
352
|
+
git "#{lib_path('forced-1.0')}" do
|
353
|
+
gem 'forced'
|
354
|
+
end
|
355
|
+
G
|
356
|
+
should_be_installed "forced 1.0"
|
357
|
+
|
358
|
+
update_git "forced" do |s|
|
359
|
+
s.write "lib/forced.rb", "FORCED = '1.1'"
|
360
|
+
end
|
361
|
+
|
362
|
+
bundle "update"
|
363
|
+
should_be_installed "forced 1.1"
|
364
|
+
|
365
|
+
Dir.chdir(lib_path('forced-1.0')) do
|
366
|
+
`git reset --hard HEAD^`
|
367
|
+
end
|
368
|
+
|
369
|
+
bundle "update"
|
370
|
+
should_be_installed "forced 1.0"
|
371
|
+
end
|
372
|
+
|
373
|
+
it "ignores submodules if :submodule is not passed" do
|
374
|
+
build_git "submodule", "1.0"
|
375
|
+
build_git "has_submodule", "1.0" do |s|
|
376
|
+
s.add_dependency "submodule"
|
377
|
+
end
|
378
|
+
Dir.chdir(lib_path('has_submodule-1.0')) do
|
379
|
+
`git submodule add #{lib_path('submodule-1.0')} submodule-1.0`
|
380
|
+
`git commit -m "submodulator"`
|
381
|
+
end
|
382
|
+
|
383
|
+
install_gemfile <<-G, :expect_err => true
|
384
|
+
git "#{lib_path('has_submodule-1.0')}" do
|
385
|
+
gem "has_submodule"
|
386
|
+
end
|
387
|
+
G
|
388
|
+
out.should =~ /Could not find gem 'submodule'/
|
389
|
+
|
390
|
+
should_not_be_installed "has_submodule 1.0", :expect_err => true
|
391
|
+
end
|
392
|
+
|
393
|
+
it "handles repos with submodules" do
|
394
|
+
build_git "submodule", "1.0"
|
395
|
+
build_git "has_submodule", "1.0" do |s|
|
396
|
+
s.add_dependency "submodule"
|
397
|
+
end
|
398
|
+
Dir.chdir(lib_path('has_submodule-1.0')) do
|
399
|
+
`git submodule add #{lib_path('submodule-1.0')} submodule-1.0`
|
400
|
+
`git commit -m "submodulator"`
|
401
|
+
end
|
402
|
+
|
403
|
+
install_gemfile <<-G
|
404
|
+
git "#{lib_path('has_submodule-1.0')}", :submodules => true do
|
405
|
+
gem "has_submodule"
|
406
|
+
end
|
407
|
+
G
|
408
|
+
|
409
|
+
should_be_installed "has_submodule 1.0"
|
410
|
+
end
|
411
|
+
|
412
|
+
it "handles implicit updates when modifying the source info" do
|
413
|
+
git = build_git "foo"
|
414
|
+
|
415
|
+
install_gemfile <<-G
|
416
|
+
git "#{lib_path('foo-1.0')}" do
|
417
|
+
gem "foo"
|
418
|
+
end
|
419
|
+
G
|
420
|
+
|
421
|
+
update_git "foo"
|
422
|
+
update_git "foo"
|
423
|
+
|
424
|
+
install_gemfile <<-G
|
425
|
+
git "#{lib_path('foo-1.0')}", :ref => "#{git.ref_for('HEAD^')}" do
|
426
|
+
gem "foo"
|
427
|
+
end
|
428
|
+
G
|
429
|
+
|
430
|
+
run <<-RUBY
|
431
|
+
require 'foo'
|
432
|
+
puts "WIN" if FOO_PREV_REF == '#{git.ref_for("HEAD^^")}'
|
433
|
+
RUBY
|
434
|
+
|
435
|
+
out.should == "WIN"
|
436
|
+
end
|
437
|
+
|
438
|
+
it "does not to a remote fetch if the revision is cached locally" do
|
439
|
+
build_git "foo"
|
440
|
+
|
441
|
+
install_gemfile <<-G
|
442
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}"
|
443
|
+
G
|
444
|
+
|
445
|
+
FileUtils.rm_rf(lib_path('foo-1.0'))
|
446
|
+
|
447
|
+
bundle "install"
|
448
|
+
out.should_not =~ /updating/i
|
449
|
+
end
|
450
|
+
|
451
|
+
it "doesn't blow up if bundle install is run twice in a row" do
|
452
|
+
build_git "foo"
|
453
|
+
|
454
|
+
gemfile <<-G
|
455
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}"
|
456
|
+
G
|
457
|
+
|
458
|
+
bundle "install"
|
459
|
+
bundle "install", :exit_status => true
|
460
|
+
exitstatus.should == 0
|
461
|
+
end
|
462
|
+
|
463
|
+
describe "switching sources" do
|
464
|
+
it "doesn't explode when switching Path to Git sources" do
|
465
|
+
build_gem "foo", "1.0", :to_system => true do |s|
|
466
|
+
s.write "lib/foo.rb", "raise 'fail'"
|
467
|
+
end
|
468
|
+
build_lib "foo", "1.0", :path => lib_path('bar/foo')
|
469
|
+
build_git "bar", "1.0", :path => lib_path('bar') do |s|
|
470
|
+
s.add_dependency 'foo'
|
471
|
+
end
|
472
|
+
|
473
|
+
install_gemfile <<-G
|
474
|
+
source "http://#{gem_repo1}"
|
475
|
+
gem "bar", :path => "#{lib_path('bar')}"
|
476
|
+
G
|
477
|
+
|
478
|
+
install_gemfile <<-G
|
479
|
+
source "http://#{gem_repo1}"
|
480
|
+
gem "bar", :git => "#{lib_path('bar')}"
|
481
|
+
G
|
482
|
+
|
483
|
+
should_be_installed "foo 1.0", "bar 1.0"
|
484
|
+
end
|
485
|
+
|
486
|
+
it "doesn't explode when switching Gem to Git source" do
|
487
|
+
install_gemfile <<-G
|
488
|
+
source "file://#{gem_repo1}"
|
489
|
+
gem "rack-obama"
|
490
|
+
gem "rack", "1.0.0"
|
491
|
+
G
|
492
|
+
|
493
|
+
build_git "rack", "1.0" do |s|
|
494
|
+
s.write "lib/new_file.rb", "puts 'USING GIT'"
|
495
|
+
end
|
496
|
+
|
497
|
+
install_gemfile <<-G
|
498
|
+
source "file://#{gem_repo1}"
|
499
|
+
gem "rack-obama"
|
500
|
+
gem "rack", "1.0.0", :git => "#{lib_path("rack-1.0")}"
|
501
|
+
G
|
502
|
+
|
503
|
+
run "require 'new_file'"
|
504
|
+
out.should == "USING GIT"
|
505
|
+
end
|
506
|
+
end
|
507
|
+
|
508
|
+
describe "bundle install after the remote has been updated" do
|
509
|
+
it "installs" do
|
510
|
+
build_git "valim"
|
511
|
+
|
512
|
+
install_gemfile <<-G
|
513
|
+
gem "valim", :git => "file://#{lib_path("valim-1.0")}"
|
514
|
+
G
|
515
|
+
|
516
|
+
old_revision = revision_for(lib_path("valim-1.0"))
|
517
|
+
update_git "valim"
|
518
|
+
new_revision = revision_for(lib_path("valim-1.0"))
|
519
|
+
|
520
|
+
lockfile = File.read(bundled_app("Gemfile.lock"))
|
521
|
+
File.open(bundled_app("Gemfile.lock"), "w") do |file|
|
522
|
+
file.puts lockfile.gsub(/revision: #{old_revision}/, "revision: #{new_revision}")
|
523
|
+
end
|
524
|
+
|
525
|
+
bundle "install"
|
526
|
+
|
527
|
+
run <<-R
|
528
|
+
require "valim"
|
529
|
+
puts VALIM_PREV_REF
|
530
|
+
R
|
531
|
+
|
532
|
+
out.should == old_revision
|
533
|
+
end
|
534
|
+
end
|
535
|
+
|
536
|
+
describe "bundle install --deployment with git sources" do
|
537
|
+
it "works" do
|
538
|
+
build_git "valim", :path => lib_path('valim')
|
539
|
+
|
540
|
+
install_gemfile <<-G
|
541
|
+
source "file://#{gem_repo1}"
|
542
|
+
|
543
|
+
gem "valim", "= 1.0", :git => "#{lib_path('valim')}"
|
544
|
+
G
|
545
|
+
|
546
|
+
simulate_new_machine
|
547
|
+
|
548
|
+
bundle "install --deployment", :exit_status => true
|
549
|
+
exitstatus.should == 0
|
550
|
+
end
|
551
|
+
end
|
552
|
+
end
|