bundler_package_git 1.1.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/.rvmrc +1 -0
- data/CHANGELOG.md +659 -0
- data/ISSUES.md +47 -0
- data/LICENSE +23 -0
- data/README.md +29 -0
- data/Rakefile +167 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +22 -0
- data/bundler.gemspec +30 -0
- data/lib/bundler.rb +283 -0
- data/lib/bundler/capistrano.rb +11 -0
- data/lib/bundler/cli.rb +490 -0
- data/lib/bundler/definition.rb +429 -0
- data/lib/bundler/dependency.rb +130 -0
- data/lib/bundler/deployment.rb +53 -0
- data/lib/bundler/dsl.rb +243 -0
- data/lib/bundler/environment.rb +47 -0
- data/lib/bundler/fetcher.rb +101 -0
- data/lib/bundler/gem_helper.rb +146 -0
- data/lib/bundler/graph.rb +130 -0
- data/lib/bundler/index.rb +131 -0
- data/lib/bundler/installer.rb +117 -0
- data/lib/bundler/lazy_specification.rb +71 -0
- data/lib/bundler/lockfile_parser.rb +108 -0
- data/lib/bundler/remote_specification.rb +57 -0
- data/lib/bundler/resolver.rb +470 -0
- data/lib/bundler/rubygems_ext.rb +226 -0
- data/lib/bundler/runtime.rb +201 -0
- data/lib/bundler/settings.rb +117 -0
- data/lib/bundler/setup.rb +16 -0
- data/lib/bundler/shared_helpers.rb +167 -0
- data/lib/bundler/source.rb +675 -0
- data/lib/bundler/spec_set.rb +134 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Gemfile +4 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -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 +4 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +7 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +21 -0
- data/lib/bundler/ui.rb +73 -0
- data/lib/bundler/vendor/net/http/faster.rb +27 -0
- data/lib/bundler/vendor/net/http/persistent.rb +464 -0
- data/lib/bundler/vendor/thor.rb +319 -0
- data/lib/bundler/vendor/thor/actions.rb +297 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +105 -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 +229 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +104 -0
- data/lib/bundler/vendor/thor/base.rb +556 -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/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 +174 -0
- data/lib/bundler/vendor/thor/shell.rb +88 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +275 -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 +114 -0
- data/lib/bundler/vendor/thor/util.rb +229 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +9 -0
- data/man/bundle-config.ronn +90 -0
- data/man/bundle-exec.ronn +111 -0
- data/man/bundle-install.ronn +314 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-update.ronn +176 -0
- data/man/bundle.ronn +80 -0
- data/man/gemfile.5.ronn +279 -0
- data/man/index.txt +6 -0
- data/spec/cache/gems_spec.rb +219 -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 +197 -0
- data/spec/install/deprecated_spec.rb +37 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/dependency_api_spec.rb +85 -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 +245 -0
- data/spec/install/gems/packed_spec.rb +84 -0
- data/spec/install/gems/platform_spec.rb +208 -0
- data/spec/install/gems/resolving_spec.rb +72 -0
- data/spec/install/gems/simple_case_spec.rb +715 -0
- data/spec/install/gems/standalone_spec.rb +162 -0
- data/spec/install/gems/sudo_spec.rb +73 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspec_spec.rb +108 -0
- data/spec/install/git_spec.rb +571 -0
- data/spec/install/invalid_spec.rb +17 -0
- data/spec/install/path_spec.rb +353 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/git_spec.rb +35 -0
- data/spec/lock/lockfile_spec.rb +683 -0
- data/spec/other/check_spec.rb +221 -0
- data/spec/other/clean_spec.rb +202 -0
- data/spec/other/config_spec.rb +40 -0
- data/spec/other/console_spec.rb +54 -0
- data/spec/other/exec_spec.rb +241 -0
- data/spec/other/ext_spec.rb +16 -0
- data/spec/other/gem_helper_spec.rb +128 -0
- data/spec/other/help_spec.rb +38 -0
- data/spec/other/init_spec.rb +40 -0
- data/spec/other/newgem_spec.rb +24 -0
- data/spec/other/open_spec.rb +35 -0
- data/spec/other/show_spec.rb +82 -0
- data/spec/pack/gems_spec.rb +54 -0
- data/spec/quality_spec.rb +58 -0
- data/spec/resolver/basic_spec.rb +20 -0
- data/spec/resolver/platform_spec.rb +82 -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 +231 -0
- data/spec/runtime/setup_spec.rb +688 -0
- data/spec/runtime/with_clean_env_spec.rb +15 -0
- data/spec/spec_helper.rb +85 -0
- data/spec/support/artifice/endpoint.rb +50 -0
- data/spec/support/artifice/endpoint_fallback.rb +22 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +11 -0
- data/spec/support/builders.rb +574 -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 +246 -0
- data/spec/support/indexes.rb +112 -0
- data/spec/support/matchers.rb +89 -0
- data/spec/support/path.rb +73 -0
- data/spec/support/platforms.rb +53 -0
- data/spec/support/ruby_ext.rb +20 -0
- data/spec/support/rubygems_ext.rb +35 -0
- data/spec/support/rubygems_hax/platform.rb +11 -0
- data/spec/support/sudo.rb +21 -0
- data/spec/update/gems_spec.rb +121 -0
- data/spec/update/git_spec.rb +196 -0
- data/spec/update/source_spec.rb +51 -0
- metadata +294 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle console" do
|
4
|
+
before :each do
|
5
|
+
install_gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem "rack"
|
8
|
+
gem "activesupport", :group => :test
|
9
|
+
gem "rack_middleware", :group => :development
|
10
|
+
G
|
11
|
+
end
|
12
|
+
|
13
|
+
it "starts IRB with the default group loaded" do
|
14
|
+
bundle "console" do |input|
|
15
|
+
input.puts("puts RACK")
|
16
|
+
input.puts("exit")
|
17
|
+
end
|
18
|
+
out.should include("0.9.1")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "doesn't load any other groups" do
|
22
|
+
bundle "console" do |input|
|
23
|
+
input.puts("puts ACTIVESUPPORT")
|
24
|
+
input.puts("exit")
|
25
|
+
end
|
26
|
+
out.should include("NameError")
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "when given a group" do
|
30
|
+
it "loads the given group" do
|
31
|
+
bundle "console test" do |input|
|
32
|
+
input.puts("puts ACTIVESUPPORT")
|
33
|
+
input.puts("exit")
|
34
|
+
end
|
35
|
+
out.should include("2.3.5")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "loads the default group" do
|
39
|
+
bundle "console test" do |input|
|
40
|
+
input.puts("puts RACK")
|
41
|
+
input.puts("exit")
|
42
|
+
end
|
43
|
+
out.should include("0.9.1")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "doesn't load other groups" do
|
47
|
+
bundle "console test" do |input|
|
48
|
+
input.puts("puts RACK_MIDDLEWARE")
|
49
|
+
input.puts("exit")
|
50
|
+
end
|
51
|
+
out.should include("NameError")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,241 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle exec" do
|
4
|
+
before :each do
|
5
|
+
system_gems "rack-1.0.0", "rack-0.9.1"
|
6
|
+
end
|
7
|
+
|
8
|
+
it "activates the correct gem" do
|
9
|
+
gemfile <<-G
|
10
|
+
gem "rack", "0.9.1"
|
11
|
+
G
|
12
|
+
|
13
|
+
bundle "exec rackup"
|
14
|
+
out.should == "0.9.1"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "works when the bins are in ~/.bundle" do
|
18
|
+
install_gemfile <<-G
|
19
|
+
gem "rack"
|
20
|
+
G
|
21
|
+
|
22
|
+
bundle "exec rackup"
|
23
|
+
out.should == "1.0.0"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "works when running from a random directory" do
|
27
|
+
install_gemfile <<-G
|
28
|
+
gem "rack"
|
29
|
+
G
|
30
|
+
|
31
|
+
bundle "exec 'cd #{tmp('gems')} && rackup'"
|
32
|
+
|
33
|
+
out.should == "1.0.0"
|
34
|
+
end
|
35
|
+
|
36
|
+
it "handles different versions in different bundles" do
|
37
|
+
build_repo2 do
|
38
|
+
build_gem "rack_two", "1.0.0" do |s|
|
39
|
+
s.executables = "rackup"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
install_gemfile <<-G
|
44
|
+
source "file://#{gem_repo1}"
|
45
|
+
gem "rack", "0.9.1"
|
46
|
+
G
|
47
|
+
|
48
|
+
Dir.chdir bundled_app2 do
|
49
|
+
install_gemfile bundled_app2('Gemfile'), <<-G
|
50
|
+
source "file://#{gem_repo2}"
|
51
|
+
gem "rack_two", "1.0.0"
|
52
|
+
G
|
53
|
+
end
|
54
|
+
|
55
|
+
bundle "exec rackup"
|
56
|
+
|
57
|
+
check out.should == "0.9.1"
|
58
|
+
|
59
|
+
Dir.chdir bundled_app2 do
|
60
|
+
bundle "exec rackup"
|
61
|
+
out.should == "1.0.0"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it "handles gems installed with --without" do
|
66
|
+
install_gemfile <<-G, :without => :middleware
|
67
|
+
source "file://#{gem_repo1}"
|
68
|
+
gem "rack" # rack 0.9.1 and 1.0 exist
|
69
|
+
|
70
|
+
group :middleware do
|
71
|
+
gem "rack_middleware" # rack_middleware depends on rack 0.9.1
|
72
|
+
end
|
73
|
+
G
|
74
|
+
|
75
|
+
bundle "exec rackup"
|
76
|
+
|
77
|
+
check out.should == "0.9.1"
|
78
|
+
should_not_be_installed "rack_middleware 1.0"
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should not duplicate already exec'ed RUBYOPT or PATH" do
|
82
|
+
install_gemfile <<-G
|
83
|
+
gem "rack"
|
84
|
+
G
|
85
|
+
|
86
|
+
rubyopt = "-I#{bundler_path} -rbundler/setup"
|
87
|
+
|
88
|
+
bundle "exec 'echo $RUBYOPT'"
|
89
|
+
out.should have_rubyopts(rubyopt)
|
90
|
+
|
91
|
+
bundle "exec 'echo $RUBYOPT'", :env => {"RUBYOPT" => rubyopt}
|
92
|
+
out.should have_rubyopts(rubyopt)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "errors nicely when the argument doesn't exist" do
|
96
|
+
install_gemfile <<-G
|
97
|
+
gem "rack"
|
98
|
+
G
|
99
|
+
|
100
|
+
bundle "exec foobarbaz", :exitstatus => true
|
101
|
+
check exitstatus.should == 127
|
102
|
+
out.should include("bundler: command not found: foobarbaz")
|
103
|
+
out.should include("Install missing gem binaries with `bundle install`")
|
104
|
+
end
|
105
|
+
|
106
|
+
it "errors nicely when the argument is not executable" do
|
107
|
+
install_gemfile <<-G
|
108
|
+
gem "rack"
|
109
|
+
G
|
110
|
+
|
111
|
+
bundle "exec touch foo"
|
112
|
+
bundle "exec ./foo", :exitstatus => true
|
113
|
+
check exitstatus.should == 126
|
114
|
+
out.should include("bundler: not executable: ./foo")
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "with gem binaries" do
|
118
|
+
describe "run from a random directory" do
|
119
|
+
before(:each) do
|
120
|
+
install_gemfile <<-G
|
121
|
+
gem "rack"
|
122
|
+
G
|
123
|
+
end
|
124
|
+
|
125
|
+
it "works when unlocked" do
|
126
|
+
bundle "exec 'cd #{tmp('gems')} && rackup'"
|
127
|
+
out.should == "1.0.0"
|
128
|
+
end
|
129
|
+
|
130
|
+
it "works when locked" do
|
131
|
+
bundle "lock"
|
132
|
+
should_be_locked
|
133
|
+
bundle "exec 'cd #{tmp('gems')} && rackup'"
|
134
|
+
out.should == "1.0.0"
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
describe "from gems bundled via :path" do
|
139
|
+
before(:each) do
|
140
|
+
build_lib "fizz", :path => home("fizz") do |s|
|
141
|
+
s.executables = "fizz"
|
142
|
+
end
|
143
|
+
|
144
|
+
install_gemfile <<-G
|
145
|
+
gem "fizz", :path => "#{File.expand_path(home("fizz"))}"
|
146
|
+
G
|
147
|
+
end
|
148
|
+
|
149
|
+
it "works when unlocked" do
|
150
|
+
bundle "exec fizz"
|
151
|
+
out.should == "1.0"
|
152
|
+
end
|
153
|
+
|
154
|
+
it "works when locked" do
|
155
|
+
bundle "lock"
|
156
|
+
should_be_locked
|
157
|
+
|
158
|
+
bundle "exec fizz"
|
159
|
+
out.should == "1.0"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
describe "from gems bundled via :git" do
|
164
|
+
before(:each) do
|
165
|
+
build_git "fizz_git" do |s|
|
166
|
+
s.executables = "fizz_git"
|
167
|
+
end
|
168
|
+
|
169
|
+
install_gemfile <<-G
|
170
|
+
gem "fizz_git", :git => "#{lib_path('fizz_git-1.0')}"
|
171
|
+
G
|
172
|
+
end
|
173
|
+
|
174
|
+
it "works when unlocked" do
|
175
|
+
bundle "exec fizz_git"
|
176
|
+
out.should == "1.0"
|
177
|
+
end
|
178
|
+
|
179
|
+
it "works when locked" do
|
180
|
+
bundle "lock"
|
181
|
+
should_be_locked
|
182
|
+
bundle "exec fizz_git"
|
183
|
+
out.should == "1.0"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
describe "from gems bundled via :git with no gemspec" do
|
188
|
+
before(:each) do
|
189
|
+
build_git "fizz_no_gemspec", :gemspec => false do |s|
|
190
|
+
s.executables = "fizz_no_gemspec"
|
191
|
+
end
|
192
|
+
|
193
|
+
install_gemfile <<-G
|
194
|
+
gem "fizz_no_gemspec", "1.0", :git => "#{lib_path('fizz_no_gemspec-1.0')}"
|
195
|
+
G
|
196
|
+
end
|
197
|
+
|
198
|
+
it "works when unlocked" do
|
199
|
+
bundle "exec fizz_no_gemspec"
|
200
|
+
out.should == "1.0"
|
201
|
+
end
|
202
|
+
|
203
|
+
it "works when locked" do
|
204
|
+
bundle "lock"
|
205
|
+
should_be_locked
|
206
|
+
bundle "exec fizz_no_gemspec"
|
207
|
+
out.should == "1.0"
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
|
213
|
+
describe "bundling bundler" do
|
214
|
+
before(:each) do
|
215
|
+
gemfile <<-G
|
216
|
+
source "file://#{gem_repo1}"
|
217
|
+
gem "rack"
|
218
|
+
G
|
219
|
+
|
220
|
+
bundle "install --path vendor/bundle --disable-shared-gems"
|
221
|
+
end
|
222
|
+
|
223
|
+
it "does not explode with --disable-shared-gems" do
|
224
|
+
bundle "exec bundle check", :exitstatus => true
|
225
|
+
exitstatus.should == 0
|
226
|
+
end
|
227
|
+
|
228
|
+
it "does not explode when starting with Bundler.setup" do
|
229
|
+
ruby <<-R
|
230
|
+
require "rubygems"
|
231
|
+
require "bundler"
|
232
|
+
Bundler.setup
|
233
|
+
puts `bundle check`
|
234
|
+
puts $?.exitstatus
|
235
|
+
R
|
236
|
+
|
237
|
+
out.should include("satisfied")
|
238
|
+
out.should include("\n0")
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Gem::Specification#match_platform" do
|
4
|
+
it "does not match platforms other than the gem platform" do
|
5
|
+
darwin = gem "lol", "1.0", "platform_specific-1.0-x86-darwin-10"
|
6
|
+
darwin.match_platform(pl('java')).should be_false
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "Bundler::GemHelpers#generic" do
|
11
|
+
include Bundler::GemHelpers
|
12
|
+
|
13
|
+
it "converts non-windows platforms into ruby" do
|
14
|
+
generic(pl('x86-darwin-10')).should == pl('ruby')
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require 'bundler/gem_helper'
|
3
|
+
|
4
|
+
describe "Bundler::GemHelper tasks" do
|
5
|
+
context "determining gemspec" do
|
6
|
+
it "interpolates the name when there is only one gemspec" do
|
7
|
+
bundle 'gem test'
|
8
|
+
app = bundled_app("test")
|
9
|
+
helper = Bundler::GemHelper.new(app.to_s)
|
10
|
+
helper.gemspec.name.should == 'test'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should fail when there is no gemspec" do
|
14
|
+
bundle 'gem test'
|
15
|
+
app = bundled_app("test")
|
16
|
+
FileUtils.rm(File.join(app.to_s, 'test.gemspec'))
|
17
|
+
proc { Bundler::GemHelper.new(app.to_s) }.should raise_error(/Unable to determine name/)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should fail when there are two gemspecs and the name isn't specified" do
|
21
|
+
bundle 'gem test'
|
22
|
+
app = bundled_app("test")
|
23
|
+
File.open(File.join(app.to_s, 'test2.gemspec'), 'w') {|f| f << ''}
|
24
|
+
proc { Bundler::GemHelper.new(app.to_s) }.should raise_error(/Unable to determine name/)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "gem management" do
|
29
|
+
def mock_confirm_message(message)
|
30
|
+
Bundler.ui.should_receive(:confirm).with(message)
|
31
|
+
end
|
32
|
+
|
33
|
+
def mock_build_message
|
34
|
+
mock_confirm_message "test 0.0.1 built to pkg/test-0.0.1.gem"
|
35
|
+
end
|
36
|
+
|
37
|
+
before(:each) do
|
38
|
+
bundle 'gem test'
|
39
|
+
@app = bundled_app("test")
|
40
|
+
@gemspec = File.read("#{@app.to_s}/test.gemspec")
|
41
|
+
File.open("#{@app.to_s}/test.gemspec", 'w'){|f| f << @gemspec.gsub('TODO: ', '') }
|
42
|
+
@helper = Bundler::GemHelper.new(@app.to_s)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "uses a shell UI for output" do
|
46
|
+
Bundler.ui.should be_a(Bundler::UI::Shell)
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'build' do
|
50
|
+
it "builds" do
|
51
|
+
mock_build_message
|
52
|
+
@helper.build_gem
|
53
|
+
bundled_app('test/pkg/test-0.0.1.gem').should exist
|
54
|
+
end
|
55
|
+
|
56
|
+
it "raises an appropriate error when the build fails" do
|
57
|
+
# break the gemspec by adding back the TODOs...
|
58
|
+
File.open("#{@app.to_s}/test.gemspec", 'w'){|f| f << @gemspec }
|
59
|
+
proc { @helper.build_gem }.should raise_error(/TODO/)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe 'install' do
|
64
|
+
it "installs" do
|
65
|
+
mock_build_message
|
66
|
+
mock_confirm_message "test (0.0.1) installed"
|
67
|
+
@helper.install_gem
|
68
|
+
bundled_app('test/pkg/test-0.0.1.gem').should exist
|
69
|
+
%x{gem list}.should include("test (0.0.1)")
|
70
|
+
end
|
71
|
+
|
72
|
+
it "raises an appropriate error when the install fails" do
|
73
|
+
@helper.should_receive(:build_gem) do
|
74
|
+
# write an invalid gem file, so we can simulate install failure...
|
75
|
+
FileUtils.mkdir_p(File.join(@app.to_s, 'pkg'))
|
76
|
+
path = "#{@app.to_s}/pkg/test-0.0.1.gem"
|
77
|
+
File.open(path, 'w'){|f| f << "not actually a gem"}
|
78
|
+
path
|
79
|
+
end
|
80
|
+
proc { @helper.install_gem }.should raise_error
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe 'release' do
|
85
|
+
it "shouldn't push if there are uncommitted files" do
|
86
|
+
proc { @helper.release_gem }.should raise_error(/files that need to be committed/)
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'raises an appropriate error if there is no git remote' do
|
90
|
+
Bundler.ui.stub(:confirm => nil, :error => nil) # silence messages
|
91
|
+
|
92
|
+
Dir.chdir(gem_repo1) {
|
93
|
+
`git init --bare`
|
94
|
+
}
|
95
|
+
Dir.chdir(@app) {
|
96
|
+
`git init`
|
97
|
+
`git config user.email "you@example.com"`
|
98
|
+
`git config user.name "name"`
|
99
|
+
`git commit -a -m "initial commit"`
|
100
|
+
}
|
101
|
+
|
102
|
+
proc { @helper.release_gem }.should raise_error
|
103
|
+
end
|
104
|
+
|
105
|
+
it "releases" do
|
106
|
+
mock_build_message
|
107
|
+
mock_confirm_message(/Tagged v0.0.1/)
|
108
|
+
mock_confirm_message("Pushed git commits and tags")
|
109
|
+
|
110
|
+
@helper.should_receive(:rubygem_push).with(bundled_app('test/pkg/test-0.0.1.gem').to_s)
|
111
|
+
|
112
|
+
Dir.chdir(gem_repo1) {
|
113
|
+
`git init --bare`
|
114
|
+
}
|
115
|
+
Dir.chdir(@app) {
|
116
|
+
`git init`
|
117
|
+
`git config user.email "you@example.com"`
|
118
|
+
`git config user.name "name"`
|
119
|
+
`git remote add origin file://#{gem_repo1}`
|
120
|
+
`git commit -a -m "initial commit"`
|
121
|
+
Open3.popen3("git push origin master") # use popen3 to silence output...
|
122
|
+
`git commit -a -m "another commit"`
|
123
|
+
}
|
124
|
+
@helper.release_gem
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle help" do
|
4
|
+
# Rubygems 1.4+ no longer load gem plugins so this test is no longer needed
|
5
|
+
rubygems_under_14 = Gem::Requirement.new("< 1.4").satisfied_by?(Gem::Version.new(Gem::VERSION))
|
6
|
+
it "complains if older versions of bundler are installed", :if => rubygems_under_14 do
|
7
|
+
system_gems "bundler-0.8.1"
|
8
|
+
|
9
|
+
bundle "help", :expect_err => true
|
10
|
+
err.should == "Please remove older versions of bundler. This can be done by running `gem cleanup bundler`."
|
11
|
+
end
|
12
|
+
|
13
|
+
it "uses groff when available" do
|
14
|
+
fake_groff!
|
15
|
+
|
16
|
+
bundle "help gemfile"
|
17
|
+
out.should == %|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/gemfile.5"]|
|
18
|
+
end
|
19
|
+
|
20
|
+
it "prefixes bundle commands with bundle- when finding the groff files" do
|
21
|
+
fake_groff!
|
22
|
+
|
23
|
+
bundle "help install"
|
24
|
+
out.should == %|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/bundle-install"]|
|
25
|
+
end
|
26
|
+
|
27
|
+
it "simply outputs the txt file when there is no groff on the path" do
|
28
|
+
kill_path!
|
29
|
+
|
30
|
+
bundle "help install", :expect_err => true
|
31
|
+
out.should =~ /BUNDLE-INSTALL/
|
32
|
+
end
|
33
|
+
|
34
|
+
it "still outputs the old help for commands that do not have man pages yet" do
|
35
|
+
bundle "help check"
|
36
|
+
out.should include("Check searches the local machine")
|
37
|
+
end
|
38
|
+
end
|