fig 2.0.0.pre.alpha.3 → 2.0.0.pre.alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fig/application_configuration.rb +2 -1
- data/lib/fig/command/options/parser.rb +4 -2
- data/lib/fig/command/options.rb +1 -1
- data/lib/fig/command.rb +17 -8
- data/lib/fig/figrc.rb +41 -14
- data/lib/fig/protocol/file.rb +3 -1
- data/lib/fig/protocol/ftp.rb +5 -5
- data/lib/fig/repository.rb +15 -11
- data/lib/fig/spec_utils.rb +312 -0
- data/lib/fig/url_access_disallowed_error.rb +5 -0
- data/lib/fig/version.rb +1 -1
- data/spec/application_configuration_spec.rb +73 -0
- data/spec/command/clean_spec.rb +62 -0
- data/spec/command/command_line_vs_package_spec.rb +32 -0
- data/spec/command/dump_package_definition_spec.rb +104 -0
- data/spec/command/environment_variables_spec.rb +62 -0
- data/spec/command/grammar_asset_spec.rb +391 -0
- data/spec/command/grammar_command_spec.rb +88 -0
- data/spec/command/grammar_environment_variable_spec.rb +384 -0
- data/spec/command/grammar_retrieve_spec.rb +74 -0
- data/spec/command/grammar_spec.rb +87 -0
- data/spec/command/grammar_spec_helper.rb +23 -0
- data/spec/command/include_file_spec.rb +73 -0
- data/spec/command/listing_spec.rb +1574 -0
- data/spec/command/miscellaneous_spec.rb +145 -0
- data/spec/command/publish_local_and_updates_spec.rb +32 -0
- data/spec/command/publishing_retrieval_spec.rb +423 -0
- data/spec/command/publishing_spec.rb +596 -0
- data/spec/command/running_commands_spec.rb +354 -0
- data/spec/command/suppress_includes_spec.rb +65 -0
- data/spec/command/suppress_warning_include_statement_missing_version_spec.rb +134 -0
- data/spec/command/update_lock_response_spec.rb +47 -0
- data/spec/command/usage_errors_spec.rb +481 -0
- data/spec/command_options_spec.rb +184 -0
- data/spec/command_spec.rb +49 -0
- data/spec/deparser/v1_spec.rb +64 -0
- data/spec/environment_variables_spec.rb +91 -0
- data/spec/figrc_spec.rb +144 -0
- data/spec/parser_spec.rb +398 -0
- data/spec/repository_spec.rb +117 -0
- data/spec/runtime_environment_spec.rb +357 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/split_repo_url_spec.rb +190 -0
- data/spec/statement/asset_spec.rb +203 -0
- data/spec/statement/configuration_spec.rb +41 -0
- data/spec/support/formatters/seed_spitter.rb +12 -0
- data/spec/working_directory_maintainer_spec.rb +102 -0
- metadata +58 -7
@@ -0,0 +1,354 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
4
|
+
|
5
|
+
require 'fig/operating_system'
|
6
|
+
|
7
|
+
describe 'Fig' do
|
8
|
+
describe 'running commands' do
|
9
|
+
before(:each) do
|
10
|
+
clean_up_test_environment
|
11
|
+
set_up_test_environment
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'in a package config section' do
|
15
|
+
describe %q<executes the command> do
|
16
|
+
describe %q<in a published v0 package> do
|
17
|
+
it %q<when not told to --run-command-statement> do
|
18
|
+
input = <<-END
|
19
|
+
config default
|
20
|
+
command "echo foo"
|
21
|
+
end
|
22
|
+
END
|
23
|
+
fig %w<--publish foo/1.2.3>, input
|
24
|
+
|
25
|
+
out, err = fig %w<foo/1.2.3>
|
26
|
+
out.should == 'foo'
|
27
|
+
err.should == ''
|
28
|
+
end
|
29
|
+
|
30
|
+
it %q<when told to --run-command-statement> do
|
31
|
+
input = <<-END
|
32
|
+
config default
|
33
|
+
command "echo foo"
|
34
|
+
end
|
35
|
+
END
|
36
|
+
fig %w<--publish foo/1.2.3>, input
|
37
|
+
|
38
|
+
out, err = fig %w<foo/1.2.3 --run-command-statement>
|
39
|
+
out.should == 'foo'
|
40
|
+
err.should == ''
|
41
|
+
end
|
42
|
+
|
43
|
+
if Fig::OperatingSystem.unix?
|
44
|
+
# Command statements used to be split on whitespace and put back
|
45
|
+
# together with space characters.
|
46
|
+
it %q<without manipulating whitespace> do
|
47
|
+
input = <<-END
|
48
|
+
config default
|
49
|
+
command "echo 'foo bar'"
|
50
|
+
end
|
51
|
+
END
|
52
|
+
fig %w<--publish foo/1.2.3>, input
|
53
|
+
|
54
|
+
out, err = fig %w<foo/1.2.3>
|
55
|
+
out.should == 'foo bar'
|
56
|
+
err.should == ''
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe %q<in a published v1 package> do
|
62
|
+
it %q<when not told to --run-command-statement> do
|
63
|
+
input = <<-END
|
64
|
+
grammar v1
|
65
|
+
config default
|
66
|
+
command "echo foo" end
|
67
|
+
set force='publishing in v1 grammar'
|
68
|
+
end
|
69
|
+
END
|
70
|
+
fig %w<--publish foo/1.2.3>, input
|
71
|
+
|
72
|
+
out, err = fig %w<foo/1.2.3>
|
73
|
+
out.should == 'foo'
|
74
|
+
err.should == ''
|
75
|
+
end
|
76
|
+
|
77
|
+
it %q<when told to --run-command-statement> do
|
78
|
+
input = <<-END
|
79
|
+
grammar v1
|
80
|
+
config default
|
81
|
+
command "echo foo" end
|
82
|
+
set force='publishing in v1 grammar'
|
83
|
+
end
|
84
|
+
END
|
85
|
+
fig %w<--publish foo/1.2.3>, input
|
86
|
+
|
87
|
+
out, err = fig %w<foo/1.2.3 --run-command-statement>
|
88
|
+
out.should == 'foo'
|
89
|
+
err.should == ''
|
90
|
+
end
|
91
|
+
|
92
|
+
if Fig::OperatingSystem.unix?
|
93
|
+
# Command statements used to be split on whitespace and put back
|
94
|
+
# together with space characters.
|
95
|
+
it %q<without manipulating whitespace> do
|
96
|
+
input = <<-END
|
97
|
+
grammar v1
|
98
|
+
config default
|
99
|
+
command "echo 'foo bar'" end
|
100
|
+
set force='publishing in v1 grammar'
|
101
|
+
end
|
102
|
+
END
|
103
|
+
fig %w<--publish foo/1.2.3>, input
|
104
|
+
|
105
|
+
out, err = fig %w<foo/1.2.3>
|
106
|
+
out.should == 'foo bar'
|
107
|
+
err.should == ''
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
it %q<in the default config in an unpublished v0 package when told to --run-command-statement> do
|
113
|
+
input = <<-END
|
114
|
+
config default
|
115
|
+
command "echo foo"
|
116
|
+
end
|
117
|
+
END
|
118
|
+
|
119
|
+
out, err = fig %w<--run-command-statement>, input
|
120
|
+
out.should == 'foo'
|
121
|
+
err.should == ''
|
122
|
+
end
|
123
|
+
|
124
|
+
it %q<in the default config in an unpublished v1 package when told to --run-command-statement> do
|
125
|
+
input = <<-END
|
126
|
+
grammar v1
|
127
|
+
config default
|
128
|
+
command "echo foo" end
|
129
|
+
end
|
130
|
+
END
|
131
|
+
|
132
|
+
out, err = fig %w<--run-command-statement>, input
|
133
|
+
out.should == 'foo'
|
134
|
+
err.should == ''
|
135
|
+
end
|
136
|
+
|
137
|
+
it %q<in a non-default config in an unpublished v0 package when told to --run-command-statement> do
|
138
|
+
input = <<-END
|
139
|
+
config default
|
140
|
+
command "echo default"
|
141
|
+
end
|
142
|
+
|
143
|
+
config non-default
|
144
|
+
command "echo non-default"
|
145
|
+
end
|
146
|
+
END
|
147
|
+
|
148
|
+
out, err = fig %w<--run-command-statement --config non-default>, input
|
149
|
+
out.should == 'non-default'
|
150
|
+
err.should == ''
|
151
|
+
end
|
152
|
+
|
153
|
+
it %q<in a non-default config in an unpublished v1 package when told to --run-command-statement> do
|
154
|
+
input = <<-END
|
155
|
+
grammar v1
|
156
|
+
config default
|
157
|
+
command "echo default" end
|
158
|
+
end
|
159
|
+
|
160
|
+
config non-default
|
161
|
+
command "echo non-default" end
|
162
|
+
end
|
163
|
+
END
|
164
|
+
|
165
|
+
out, err = fig %w<--run-command-statement --config non-default>, input
|
166
|
+
out.should == 'non-default'
|
167
|
+
err.should == ''
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
describe %q<passes command-line arguments to the command> do
|
172
|
+
it %q<in a published v0 package> do
|
173
|
+
input = <<-END
|
174
|
+
config default
|
175
|
+
command "echo Hi"
|
176
|
+
end
|
177
|
+
END
|
178
|
+
fig %w<--publish foo/1.2.3>, input
|
179
|
+
|
180
|
+
out, err = fig %w<foo/1.2.3 --command-extra-args there>
|
181
|
+
out.should == 'Hi there'
|
182
|
+
err.should == ''
|
183
|
+
end
|
184
|
+
|
185
|
+
it %q<in a published v1 package with a single command-line component> do
|
186
|
+
input = <<-END
|
187
|
+
grammar v1
|
188
|
+
config default
|
189
|
+
command "echo Hi" end
|
190
|
+
set force='publishing in v1 grammar'
|
191
|
+
end
|
192
|
+
END
|
193
|
+
fig %w<--publish foo/1.2.3>, input
|
194
|
+
|
195
|
+
out, err = fig %w<foo/1.2.3 --command-extra-args there>
|
196
|
+
out.should == 'Hi there'
|
197
|
+
err.should == ''
|
198
|
+
end
|
199
|
+
|
200
|
+
if Fig::OperatingSystem.unix?
|
201
|
+
# "echo" does not exist outside of the command interpreter on Windows.
|
202
|
+
it %q<in a published v1 package with multiple command-line components> do
|
203
|
+
input = <<-END
|
204
|
+
grammar v1
|
205
|
+
config default
|
206
|
+
command echo Hi, won\\'t "you" 'be my' end
|
207
|
+
end
|
208
|
+
END
|
209
|
+
fig %w<--publish foo/1.2.3>, input
|
210
|
+
|
211
|
+
out, err = fig %w<foo/1.2.3 --command-extra-args neighbor?>
|
212
|
+
out.should == %q<Hi, won't you be my neighbor?>
|
213
|
+
err.should == ''
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
describe %q<in an unpublished package> do
|
218
|
+
it %q<when only given --command-extra-args with the v0 grammar> do
|
219
|
+
input = <<-END
|
220
|
+
config default
|
221
|
+
command "echo Hi"
|
222
|
+
end
|
223
|
+
END
|
224
|
+
|
225
|
+
out, err = fig %w<--command-extra-args there>, input
|
226
|
+
out.should == 'Hi there'
|
227
|
+
err.should == ''
|
228
|
+
end
|
229
|
+
|
230
|
+
if Fig::OperatingSystem.unix?
|
231
|
+
# "echo" does not exist outside of the command interpreter on Windows.
|
232
|
+
it %q<when only given --command-extra-args with the v1 grammar> do
|
233
|
+
input = <<-END
|
234
|
+
grammar v1
|
235
|
+
config default
|
236
|
+
command echo Hi end
|
237
|
+
end
|
238
|
+
END
|
239
|
+
|
240
|
+
out, err = fig %w<--command-extra-args there>, input
|
241
|
+
out.should == 'Hi there'
|
242
|
+
err.should == ''
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
it %q<when also given --run-command-statement with the v0 grammar> do
|
247
|
+
input = <<-END
|
248
|
+
config default
|
249
|
+
command "echo Hi"
|
250
|
+
end
|
251
|
+
END
|
252
|
+
|
253
|
+
out, err =
|
254
|
+
fig %w<--run-command-statement --command-extra-args there>, input
|
255
|
+
out.should == 'Hi there'
|
256
|
+
err.should == ''
|
257
|
+
end
|
258
|
+
|
259
|
+
if Fig::OperatingSystem.unix?
|
260
|
+
# Cannot figure out the quoting to get this to work on Windows.
|
261
|
+
it %q<when also given --run-command-statement with the v1 grammar> do
|
262
|
+
input = <<-END
|
263
|
+
grammar v1
|
264
|
+
config default
|
265
|
+
command "echo 'Hi" end
|
266
|
+
end
|
267
|
+
END
|
268
|
+
|
269
|
+
out, err = fig(
|
270
|
+
[%w<--run-command-statement --command-extra-args>, %q< there\\'>],
|
271
|
+
input
|
272
|
+
)
|
273
|
+
# Two spaces due to command-line concatenation and running through
|
274
|
+
# the shell.
|
275
|
+
out.should == 'Hi there'
|
276
|
+
err.should == ''
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
describe 'fails' do
|
283
|
+
it %q<if command-line arguments specified but no command statement found> do
|
284
|
+
input = <<-END
|
285
|
+
config default
|
286
|
+
end
|
287
|
+
END
|
288
|
+
fig %w<--publish foo/1.2.3>, input
|
289
|
+
|
290
|
+
out, err, exit_code = fig(
|
291
|
+
%w<foo/1.2.3 --command-extra-args yadda>,
|
292
|
+
:no_raise_on_error => true
|
293
|
+
)
|
294
|
+
out.should == ''
|
295
|
+
err.should =~ /does not contain a command/
|
296
|
+
exit_code.should_not == 0
|
297
|
+
end
|
298
|
+
|
299
|
+
it %q<if it finds multiple command statements> do
|
300
|
+
input = <<-END
|
301
|
+
config default
|
302
|
+
command "echo foo"
|
303
|
+
command "echo bar"
|
304
|
+
end
|
305
|
+
END
|
306
|
+
out, err, exit_code =
|
307
|
+
fig %w<--publish foo/1.2.3.4>, input, :no_raise_on_error => true
|
308
|
+
err.should =~
|
309
|
+
%r<Found a second "command" statement within a "config" block \(line>
|
310
|
+
exit_code.should_not == 0
|
311
|
+
end
|
312
|
+
|
313
|
+
it %q<with an unpublished package and --run-command-statement wasn't specified> do
|
314
|
+
input = <<-END
|
315
|
+
config default
|
316
|
+
command "echo foo"
|
317
|
+
end
|
318
|
+
END
|
319
|
+
|
320
|
+
out, err, exit_code = fig [], input, :no_raise_on_error => true
|
321
|
+
err.should =~ /\bnothing to do\b/i
|
322
|
+
err.should =~ /\byou have a command statement\b/i
|
323
|
+
err.should =~ /--run-command-statement\b/i
|
324
|
+
out.should == ''
|
325
|
+
exit_code.should_not == 0
|
326
|
+
end
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
if Fig::OperatingSystem.unix?
|
331
|
+
describe %q<from the command line> do
|
332
|
+
it %q<via the shell if given a single argument> do
|
333
|
+
out, err = fig ['--', 'echo foo $0 bar']
|
334
|
+
out.should =~ /\A foo [ ] .+ [ ] bar \z/x
|
335
|
+
out.should_not == 'foo $0 bar'
|
336
|
+
err.should == ''
|
337
|
+
end
|
338
|
+
|
339
|
+
it %q<without the shell if given multiple arguments> do
|
340
|
+
out, err = fig %w<-- echo foo $0 bar>
|
341
|
+
out.should == 'foo $0 bar'
|
342
|
+
err.should == ''
|
343
|
+
end
|
344
|
+
|
345
|
+
it %q<fails if no actual command specified> do
|
346
|
+
out, err, exit_code = fig ['--'], :no_raise_on_error => true
|
347
|
+
err.should =~ /no command.*specified/i
|
348
|
+
out.should == ''
|
349
|
+
exit_code.should_not == 0
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|
354
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
4
|
+
|
5
|
+
require 'fig/operating_system'
|
6
|
+
|
7
|
+
describe 'Fig' do
|
8
|
+
describe 'include processing' do
|
9
|
+
let(:publish_from_directory) { "#{FIG_SPEC_BASE_DIRECTORY}/publish-home" }
|
10
|
+
|
11
|
+
before(:each) do
|
12
|
+
clean_up_test_environment
|
13
|
+
FileUtils.mkdir_p CURRENT_DIRECTORY
|
14
|
+
|
15
|
+
FileUtils.rm_rf(publish_from_directory)
|
16
|
+
FileUtils.mkdir_p(publish_from_directory)
|
17
|
+
|
18
|
+
fig(
|
19
|
+
%w<--publish dependency/1.2.3 --append FOO=dependency>,
|
20
|
+
:current_directory => publish_from_directory
|
21
|
+
)
|
22
|
+
|
23
|
+
input = <<-END
|
24
|
+
config default
|
25
|
+
include dependency/1.2.3
|
26
|
+
include :level-one
|
27
|
+
add FOO=default
|
28
|
+
end
|
29
|
+
|
30
|
+
config level-one
|
31
|
+
include :level-two
|
32
|
+
add FOO=level-one
|
33
|
+
end
|
34
|
+
|
35
|
+
config level-two
|
36
|
+
add FOO=level-two
|
37
|
+
end
|
38
|
+
END
|
39
|
+
fig(
|
40
|
+
%w<--publish dependent/1.2.3>,
|
41
|
+
input,
|
42
|
+
:current_directory => publish_from_directory
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'happens by default' do
|
47
|
+
# Really, this is just a test of the test setup...
|
48
|
+
out, * = fig %w<dependent/1.2.3 --get FOO>
|
49
|
+
out.should ==
|
50
|
+
"default#{File::PATH_SEPARATOR}level-one#{File::PATH_SEPARATOR}level-two#{File::PATH_SEPARATOR}dependency"
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'is limited by --suppress-cross-package-includes' do
|
54
|
+
out, * =
|
55
|
+
fig %w<dependent/1.2.3 --suppress-cross-package-includes --get FOO>
|
56
|
+
out.should ==
|
57
|
+
"default#{File::PATH_SEPARATOR}level-one#{File::PATH_SEPARATOR}level-two"
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'is blocked by --suppress-all-includes' do
|
61
|
+
out, * = fig %w<dependent/1.2.3 --suppress-all-includes --get FOO>
|
62
|
+
out.should == 'default'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
4
|
+
|
5
|
+
describe 'Fig' do
|
6
|
+
describe 'suppress unversioned include statement warnings' do
|
7
|
+
before(:each) do
|
8
|
+
clean_up_test_environment
|
9
|
+
set_up_test_environment
|
10
|
+
cleanup_home_and_remote
|
11
|
+
|
12
|
+
input = <<-END
|
13
|
+
config default
|
14
|
+
end
|
15
|
+
END
|
16
|
+
|
17
|
+
out, err = fig(%w<--publish bar/1.2.3>, input)
|
18
|
+
|
19
|
+
input = <<-END
|
20
|
+
config default
|
21
|
+
include bar/1.2.3
|
22
|
+
end
|
23
|
+
|
24
|
+
config non-default
|
25
|
+
include bar
|
26
|
+
end
|
27
|
+
END
|
28
|
+
|
29
|
+
out, err = fig(%w<--publish foo/1.2.3>, input)
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'emits warnings when warnings are not suppressed' do
|
33
|
+
it 'for the package.fig' do
|
34
|
+
input = <<-END
|
35
|
+
config default
|
36
|
+
include foo
|
37
|
+
end
|
38
|
+
END
|
39
|
+
|
40
|
+
out, err = fig(%w<--list-configs>, input)
|
41
|
+
out.should == 'default'
|
42
|
+
err.should =~ /No version in the package descriptor of "foo" in an include statement \(line/
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'for depended upon packages' do
|
46
|
+
input = <<-END
|
47
|
+
config default
|
48
|
+
include foo/1.2.3
|
49
|
+
end
|
50
|
+
END
|
51
|
+
|
52
|
+
out, err = fig(%w<--list-dependencies>, input)
|
53
|
+
out.should == "bar/1.2.3\nfoo/1.2.3"
|
54
|
+
err.should =~ %r<No version in the package descriptor of "bar" in an include statement in the \.fig file for "foo/1\.2\.3:default" \(line>
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe 'emits warning for base package even when warnings are suppressed' do
|
59
|
+
it 'with --suppress-warning-include-statement-missing-version' do
|
60
|
+
input = <<-END
|
61
|
+
config default
|
62
|
+
include foo
|
63
|
+
end
|
64
|
+
END
|
65
|
+
|
66
|
+
out, err = fig(
|
67
|
+
%w<
|
68
|
+
--list-configs
|
69
|
+
--suppress-warning-include-statement-missing-version
|
70
|
+
>,
|
71
|
+
input
|
72
|
+
)
|
73
|
+
out.should == 'default'
|
74
|
+
err.should =~ /No version in the package descriptor of "foo" in an include statement \(line/
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'with figrc' do
|
78
|
+
figrc = File.join(FIG_SPEC_BASE_DIRECTORY, 'test-figrc')
|
79
|
+
File.open(figrc, 'w') do
|
80
|
+
|handle|
|
81
|
+
handle.puts %q< { "suppress warnings": ["include statement missing version"] } >
|
82
|
+
end
|
83
|
+
|
84
|
+
input = <<-END
|
85
|
+
config default
|
86
|
+
include foo
|
87
|
+
end
|
88
|
+
END
|
89
|
+
|
90
|
+
out, err = fig(%w<--list-configs>, input)
|
91
|
+
out.should == 'default'
|
92
|
+
err.should =~ /No version in the package descriptor of "foo" in an include statement \(line/
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe 'does not emit warning for depended upon packages when warnings are suppressed' do
|
97
|
+
it 'with --suppress-warning-include-statement-missing-version' do
|
98
|
+
input = <<-END
|
99
|
+
config default
|
100
|
+
include foo/1.2.3
|
101
|
+
end
|
102
|
+
END
|
103
|
+
|
104
|
+
out, err = fig(
|
105
|
+
%w<
|
106
|
+
--list-dependencies
|
107
|
+
--suppress-warning-include-statement-missing-version
|
108
|
+
>,
|
109
|
+
input
|
110
|
+
)
|
111
|
+
out.should == "bar/1.2.3\nfoo/1.2.3"
|
112
|
+
err.should_not =~ /No version in the package descriptor of "bar" in an include statement/
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'with figrc' do
|
116
|
+
figrc = File.join(FIG_SPEC_BASE_DIRECTORY, 'test-figrc')
|
117
|
+
File.open(figrc, 'w') do
|
118
|
+
|handle|
|
119
|
+
handle.puts %q< { "suppress warnings": ["include statement missing version"] } >
|
120
|
+
end
|
121
|
+
|
122
|
+
input = <<-END
|
123
|
+
config default
|
124
|
+
include foo/1.2.3
|
125
|
+
end
|
126
|
+
END
|
127
|
+
|
128
|
+
out, err = fig(%w<--list-dependencies>, input, :figrc => figrc)
|
129
|
+
out.should == "bar/1.2.3\nfoo/1.2.3"
|
130
|
+
err.should_not =~ /No version in the package descriptor of "bar" in an include statement/
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
4
|
+
|
5
|
+
require 'fig/operating_system'
|
6
|
+
require 'fig/update_lock'
|
7
|
+
|
8
|
+
describe 'Fig' do
|
9
|
+
if ! Fig::OperatingSystem.windows?
|
10
|
+
describe '--update-lock-response' do
|
11
|
+
before(:each) do
|
12
|
+
clean_up_test_environment
|
13
|
+
set_up_test_environment
|
14
|
+
|
15
|
+
# Note that this could cause RSpec to block forever if we've got a bug,
|
16
|
+
# but it's necessary in order to test.
|
17
|
+
@update_lock = Fig::UpdateLock.new(FIG_HOME, :wait)
|
18
|
+
end
|
19
|
+
|
20
|
+
after(:each) do
|
21
|
+
# Shouldn't be necessary, but let's be paranoid.
|
22
|
+
@update_lock.close
|
23
|
+
@update_lock = nil
|
24
|
+
end
|
25
|
+
|
26
|
+
it %q<doesn't wait when set to "ignore"> do
|
27
|
+
out, err = fig(
|
28
|
+
%w<--update --update-lock-response ignore --set FOO=BAR --get FOO>
|
29
|
+
)
|
30
|
+
|
31
|
+
out.should == 'BAR'
|
32
|
+
end
|
33
|
+
|
34
|
+
it %q<results in an error when set to "fail"> do
|
35
|
+
out, err, exit_code =
|
36
|
+
fig(
|
37
|
+
%w<--update --update-lock-response fail --set FOO=BAR --get FOO>,
|
38
|
+
:no_raise_on_error => true
|
39
|
+
)
|
40
|
+
|
41
|
+
err.should =~
|
42
|
+
/cannot update while another instance of Fig is updating/i
|
43
|
+
exit_code.should_not == 0
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|