fig 2.0.0.pre.alpha.4 → 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/spec_utils.rb +312 -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 +42 -5
@@ -0,0 +1,1574 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
4
|
+
|
5
|
+
require 'English'
|
6
|
+
|
7
|
+
require 'fig/command/package_loader'
|
8
|
+
|
9
|
+
def set_up_local_and_remote_repository
|
10
|
+
cleanup_home_and_remote
|
11
|
+
|
12
|
+
input = <<-END_INPUT
|
13
|
+
config default
|
14
|
+
set FOO=BAR
|
15
|
+
end
|
16
|
+
|
17
|
+
config nondefault
|
18
|
+
set FOO=BAZ
|
19
|
+
end
|
20
|
+
END_INPUT
|
21
|
+
fig(%w<--publish prerequisite/1.2.3>, input)
|
22
|
+
|
23
|
+
input = <<-END_INPUT
|
24
|
+
config default
|
25
|
+
include prerequisite/1.2.3
|
26
|
+
set FOO=BAR
|
27
|
+
end
|
28
|
+
|
29
|
+
config nondefault
|
30
|
+
include prerequisite/1.2.3
|
31
|
+
set FOO=BAZ
|
32
|
+
end
|
33
|
+
END_INPUT
|
34
|
+
|
35
|
+
fig(%w<--publish remote-only/1.2.3>, input)
|
36
|
+
fig(%w<--clean remote-only/1.2.3>)
|
37
|
+
fig(%w<--publish both/1.2.3>, input)
|
38
|
+
fig(%w<--publish-local local-only/1.2.3>, input)
|
39
|
+
|
40
|
+
return
|
41
|
+
end
|
42
|
+
|
43
|
+
def set_up_local_and_remote_repository_with_depends_on_everything
|
44
|
+
set_up_local_and_remote_repository
|
45
|
+
|
46
|
+
input = <<-END_INPUT
|
47
|
+
config default
|
48
|
+
include :everything
|
49
|
+
end
|
50
|
+
|
51
|
+
config everything
|
52
|
+
include prerequisite/1.2.3
|
53
|
+
include local-only/1.2.3
|
54
|
+
include remote-only/1.2.3
|
55
|
+
include both/1.2.3
|
56
|
+
end
|
57
|
+
END_INPUT
|
58
|
+
|
59
|
+
fig(%w<--publish depends-on-everything/1.2.3>, input)
|
60
|
+
|
61
|
+
input = <<-END_INPUT
|
62
|
+
config default
|
63
|
+
end
|
64
|
+
|
65
|
+
config indirectly-everything
|
66
|
+
include depends-on-everything/1.2.3:everything
|
67
|
+
end
|
68
|
+
END_INPUT
|
69
|
+
|
70
|
+
fig(%w<--publish depends-on-depends-on-everything/1.2.3>, input)
|
71
|
+
fig(
|
72
|
+
%w<
|
73
|
+
--update-if-missing
|
74
|
+
--include depends-on-depends-on-everything/1.2.3:indirectly-everything
|
75
|
+
>,
|
76
|
+
input
|
77
|
+
)
|
78
|
+
|
79
|
+
return
|
80
|
+
end
|
81
|
+
|
82
|
+
def set_up_multiple_config_repository
|
83
|
+
cleanup_home_and_remote
|
84
|
+
|
85
|
+
# Note: make sure that configs within each package are NOT in sorted order.
|
86
|
+
# Part of the output testing is ordering.
|
87
|
+
|
88
|
+
input = <<-END_INPUT
|
89
|
+
config default
|
90
|
+
end
|
91
|
+
END_INPUT
|
92
|
+
fig(%w<--publish no-dependencies/1.2.3>, input)
|
93
|
+
|
94
|
+
# Configs in "--publish"es below are required because there is no "default"
|
95
|
+
# config in the packages.
|
96
|
+
|
97
|
+
input = <<-END_INPUT
|
98
|
+
config windows
|
99
|
+
set OS=Windows
|
100
|
+
end
|
101
|
+
|
102
|
+
config ubuntu
|
103
|
+
set OS=Linux
|
104
|
+
end
|
105
|
+
|
106
|
+
config redhat
|
107
|
+
set OS=Linux
|
108
|
+
end
|
109
|
+
|
110
|
+
config unreferenced
|
111
|
+
include this-should-not-show-up-in-any-output/45
|
112
|
+
end
|
113
|
+
END_INPUT
|
114
|
+
fig(%w<--publish operatingsystem/1.2.3:windows>, input)
|
115
|
+
|
116
|
+
# Ensure we have a case where two different configs' dependencies conflict.
|
117
|
+
fig(%w<--publish operatingsystem/3.4.5:redhat>, input)
|
118
|
+
|
119
|
+
input = <<-END_INPUT
|
120
|
+
config oracle
|
121
|
+
include operatingsystem/1.2.3:redhat
|
122
|
+
end
|
123
|
+
|
124
|
+
config postgresql
|
125
|
+
include operatingsystem/3.4.5:ubuntu
|
126
|
+
end
|
127
|
+
|
128
|
+
config sqlserver
|
129
|
+
include operatingsystem/1.2.3:windows
|
130
|
+
end
|
131
|
+
|
132
|
+
config unreferenced
|
133
|
+
include this-should-not-show-up-in-any-output/942.29024.2939.209.1
|
134
|
+
end
|
135
|
+
|
136
|
+
config mysql
|
137
|
+
include operatingsystem/1.2.3:ubuntu
|
138
|
+
end
|
139
|
+
END_INPUT
|
140
|
+
fig(%w<--publish database/1.2.3:oracle>, input)
|
141
|
+
|
142
|
+
input = <<-END_INPUT
|
143
|
+
config apache
|
144
|
+
include operatingsystem/1.2.3:redhat
|
145
|
+
end
|
146
|
+
|
147
|
+
config iis
|
148
|
+
include operatingsystem/1.2.3:windows
|
149
|
+
end
|
150
|
+
|
151
|
+
config unreferenced
|
152
|
+
include this-should-not-show-up-in-any-output/23.123.63.23
|
153
|
+
end
|
154
|
+
|
155
|
+
config lighttpd
|
156
|
+
include operatingsystem/3.4.5:ubuntu
|
157
|
+
end
|
158
|
+
END_INPUT
|
159
|
+
fig(%w<--publish web/1.2.3:apache>, input)
|
160
|
+
|
161
|
+
input = <<-END_INPUT
|
162
|
+
config accounting
|
163
|
+
include database/1.2.3:oracle
|
164
|
+
include web/1.2.3:apache
|
165
|
+
end
|
166
|
+
|
167
|
+
config facilities
|
168
|
+
include web/1.2.3:lighttpd
|
169
|
+
include database/1.2.3:mysql
|
170
|
+
end
|
171
|
+
|
172
|
+
config marketing
|
173
|
+
include database/1.2.3:postgresql
|
174
|
+
include web/1.2.3:lighttpd
|
175
|
+
end
|
176
|
+
|
177
|
+
config legal
|
178
|
+
include web/1.2.3:iis
|
179
|
+
include database/1.2.3:sqlserver
|
180
|
+
end
|
181
|
+
END_INPUT
|
182
|
+
fig(%w<--publish departments/1.2.3:accounting>, input)
|
183
|
+
|
184
|
+
return
|
185
|
+
end
|
186
|
+
|
187
|
+
def create_package_dot_fig(package_name, config = nil)
|
188
|
+
config = config ? config = ':' + config : ''
|
189
|
+
|
190
|
+
File.open "#{CURRENT_DIRECTORY}/#{Fig::Command::PackageLoader::DEFAULT_PACKAGE_FILE}", 'w' do
|
191
|
+
|handle|
|
192
|
+
handle.print <<-END
|
193
|
+
config default
|
194
|
+
include #{package_name}/1.2.3#{config}
|
195
|
+
end
|
196
|
+
END
|
197
|
+
end
|
198
|
+
|
199
|
+
return
|
200
|
+
end
|
201
|
+
|
202
|
+
def create_package_dot_fig_with_single_dependency()
|
203
|
+
create_package_dot_fig('prerequisite')
|
204
|
+
end
|
205
|
+
|
206
|
+
def create_package_dot_fig_with_all_dependencies()
|
207
|
+
create_package_dot_fig(
|
208
|
+
'depends-on-everything', Fig::Package::DEFAULT_CONFIG
|
209
|
+
)
|
210
|
+
end
|
211
|
+
|
212
|
+
def set_up_list_variables_packages
|
213
|
+
cleanup_home_and_remote
|
214
|
+
|
215
|
+
input_a = <<-END_INPUT
|
216
|
+
config default
|
217
|
+
set A_BOTH_CONFIGS=default
|
218
|
+
set A_DEFAULT=BAR
|
219
|
+
set D_OVERRIDES_A=A
|
220
|
+
set B_OVERRIDES_A_AND_C=A
|
221
|
+
append A_PATH_DEFAULT=BAR
|
222
|
+
append D_PATH_PREPENDS_A=A
|
223
|
+
append B_PATH_PREPENDS_A_AND_C=A
|
224
|
+
set A_SET_GETS_PREPENDED_WITH_B_AND_C=A
|
225
|
+
|
226
|
+
# Note includes are not in alphabetical order in order to check that
|
227
|
+
# sorting does or does not happen.
|
228
|
+
include C/1.2.3
|
229
|
+
include B/1.2.3
|
230
|
+
|
231
|
+
set A_OVERRIDES_C_PREPENDING_B=A
|
232
|
+
|
233
|
+
set A_OVERRIDES_B_AND_C=A
|
234
|
+
set A_OVERRIDES_D=A
|
235
|
+
append A_PATH_PREPENDS_B_AND_C=A
|
236
|
+
append A_PATH_PREPENDS_D=A
|
237
|
+
end
|
238
|
+
|
239
|
+
config nondefault
|
240
|
+
set A_BOTH_CONFIGS=nondefault
|
241
|
+
set A_NONDEFAULT=BAZ
|
242
|
+
|
243
|
+
include C/4.5.6:nondefault
|
244
|
+
end
|
245
|
+
END_INPUT
|
246
|
+
|
247
|
+
input_b = <<-END_INPUT
|
248
|
+
config default
|
249
|
+
set B_DEFAULT=BAR
|
250
|
+
set B_OVERRIDES_C=B
|
251
|
+
set B_OVERRIDES_A_AND_C=B
|
252
|
+
set A_OVERRIDES_B_AND_C=B
|
253
|
+
append B_PATH_PREPENDS_A_AND_C=B
|
254
|
+
append A_PATH_PREPENDS_B_AND_C=B
|
255
|
+
append A_SET_GETS_PREPENDED_WITH_B_AND_C=B
|
256
|
+
append A_OVERRIDES_C_PREPENDING_B=B
|
257
|
+
|
258
|
+
# Note lack of version. That this works depends upon another include of
|
259
|
+
# D to be encountered during parse to include the version.
|
260
|
+
include D
|
261
|
+
end
|
262
|
+
|
263
|
+
config nondefault
|
264
|
+
set B_NONDEFAULT=BAZ
|
265
|
+
end
|
266
|
+
|
267
|
+
config should_not_show_up_in_output
|
268
|
+
set SHOULD_NOT_SHOW_UP_IN_OUTPUT_FROM_B=should_not_show_up
|
269
|
+
end
|
270
|
+
END_INPUT
|
271
|
+
|
272
|
+
input_c123 = <<-END_INPUT
|
273
|
+
config default
|
274
|
+
set C_DEFAULT=BAR
|
275
|
+
set B_OVERRIDES_C=C
|
276
|
+
set B_OVERRIDES_A_AND_C=C
|
277
|
+
set A_OVERRIDES_B_AND_C=C
|
278
|
+
append B_PATH_PREPENDS_A_AND_C=C
|
279
|
+
append A_PATH_PREPENDS_B_AND_C=C
|
280
|
+
append A_SET_GETS_PREPENDED_WITH_B_AND_C=C
|
281
|
+
append A_OVERRIDES_C_PREPENDING_B=C
|
282
|
+
|
283
|
+
include D/1.2.3
|
284
|
+
end
|
285
|
+
|
286
|
+
config nondefault
|
287
|
+
set C_NONDEFAULT=BAZ
|
288
|
+
end
|
289
|
+
|
290
|
+
config should_not_show_up_in_output
|
291
|
+
set SHOULD_NOT_SHOW_UP_IN_OUTPUT_FROM_C=should_not_show_up
|
292
|
+
end
|
293
|
+
END_INPUT
|
294
|
+
|
295
|
+
input_c456 = <<-END_INPUT
|
296
|
+
config default
|
297
|
+
set C_DEFAULT=BAR
|
298
|
+
set C_OVERRIDES_B=C
|
299
|
+
set C_OVERRIDES_A_AND_B=C
|
300
|
+
set A_OVERRIDES_B_AND_C=C
|
301
|
+
append A_PATH_PREPENDS_B_AND_C=C
|
302
|
+
append A_SET_GETS_PREPENDED_WITH_B_AND_C=C
|
303
|
+
append A_OVERRIDES_C_PREPENDING_B=C
|
304
|
+
|
305
|
+
include D/1.2.3
|
306
|
+
end
|
307
|
+
|
308
|
+
config nondefault
|
309
|
+
set C_ONLY_IN_C456=C
|
310
|
+
end
|
311
|
+
|
312
|
+
config should_not_show_up_in_output
|
313
|
+
set SHOULD_NOT_SHOW_UP_IN_OUTPUT_FROM_C=should_not_show_up
|
314
|
+
end
|
315
|
+
END_INPUT
|
316
|
+
|
317
|
+
input_d = <<-END_INPUT
|
318
|
+
config default
|
319
|
+
set D_DEFAULT=BAR
|
320
|
+
set A_OVERRIDES_D=D
|
321
|
+
set D_OVERRIDES_A=D
|
322
|
+
append D_PATH_PREPENDS_A=D
|
323
|
+
append A_PATH_PREPENDS_D=D
|
324
|
+
|
325
|
+
include :addon_a
|
326
|
+
include :addon_b
|
327
|
+
include :addon_c
|
328
|
+
end
|
329
|
+
|
330
|
+
config addon_a
|
331
|
+
set ADDON_A=ding
|
332
|
+
end
|
333
|
+
|
334
|
+
config addon_b
|
335
|
+
set ADDON_B=dong
|
336
|
+
|
337
|
+
include E/1.2.3
|
338
|
+
end
|
339
|
+
|
340
|
+
config addon_c
|
341
|
+
set ADDON_C=dang
|
342
|
+
end
|
343
|
+
|
344
|
+
config nondefault
|
345
|
+
set D_NONDEFAULT=BAZ
|
346
|
+
end
|
347
|
+
|
348
|
+
config should_not_show_up_in_output
|
349
|
+
set SHOULD_NOT_SHOW_UP_IN_OUTPUT_FROM_D=should_not_show_up
|
350
|
+
end
|
351
|
+
END_INPUT
|
352
|
+
|
353
|
+
input_e = <<-END_INPUT
|
354
|
+
config default
|
355
|
+
end
|
356
|
+
END_INPUT
|
357
|
+
|
358
|
+
fig(%w<--publish E/1.2.3>, input_e)
|
359
|
+
fig(%w<--publish D/1.2.3>, input_d)
|
360
|
+
fig(%w<--publish C/1.2.3>, input_c123)
|
361
|
+
fig(%w<--publish C/4.5.6>, input_c456)
|
362
|
+
|
363
|
+
# Use non-default config to avoid issue with "include D" without a version.
|
364
|
+
fig(%w<--publish B/1.2.3:nondefault>, input_b)
|
365
|
+
|
366
|
+
fig(%w<--publish A/1.2.3>, input_a)
|
367
|
+
end
|
368
|
+
|
369
|
+
def set_up_packages_with_overrides
|
370
|
+
cleanup_home_and_remote
|
371
|
+
|
372
|
+
input_a = <<-END_INPUT
|
373
|
+
config default
|
374
|
+
include B/1.2.3 override C/4.5.6 override D/4.5.6
|
375
|
+
end
|
376
|
+
END_INPUT
|
377
|
+
|
378
|
+
input_b = <<-END_INPUT
|
379
|
+
config default
|
380
|
+
include C/1.2.3
|
381
|
+
include D/1.2.3
|
382
|
+
end
|
383
|
+
END_INPUT
|
384
|
+
|
385
|
+
input_c123 = <<-END_INPUT
|
386
|
+
config default
|
387
|
+
set C=1.2.3
|
388
|
+
|
389
|
+
include D/1.2.3
|
390
|
+
end
|
391
|
+
END_INPUT
|
392
|
+
|
393
|
+
input_c456 = <<-END_INPUT
|
394
|
+
config default
|
395
|
+
set C=4.5.6
|
396
|
+
|
397
|
+
include D/1.2.3
|
398
|
+
end
|
399
|
+
END_INPUT
|
400
|
+
|
401
|
+
input_d = <<-END_INPUT
|
402
|
+
config default
|
403
|
+
end
|
404
|
+
END_INPUT
|
405
|
+
|
406
|
+
fig(%w<--publish D/1.2.3>, input_d)
|
407
|
+
fig(%w<--publish D/4.5.6>, input_d)
|
408
|
+
fig(%w<--publish C/1.2.3>, input_c123)
|
409
|
+
fig(%w<--publish C/4.5.6>, input_c456)
|
410
|
+
fig(%w<--publish B/1.2.3>, input_b)
|
411
|
+
fig(%w<--publish A/1.2.3>, input_a)
|
412
|
+
end
|
413
|
+
|
414
|
+
def remove_any_package_dot_fig
|
415
|
+
FileUtils.rm_rf "#{CURRENT_DIRECTORY}/#{Fig::Command::PackageLoader::DEFAULT_PACKAGE_FILE}"
|
416
|
+
|
417
|
+
return
|
418
|
+
end
|
419
|
+
|
420
|
+
def test_list_configs(package_name)
|
421
|
+
set_up_local_and_remote_repository
|
422
|
+
|
423
|
+
out, err = fig(['--list-configs', "#{package_name}/1.2.3"])
|
424
|
+
out.should == "default\nnondefault"
|
425
|
+
err.should == ''
|
426
|
+
|
427
|
+
return
|
428
|
+
end
|
429
|
+
|
430
|
+
# Allow for indenting in expected output given in heredocs.
|
431
|
+
def clean_expected(expected)
|
432
|
+
cleaned = expected.chomp
|
433
|
+
|
434
|
+
indent_count = cleaned.scan(/ ^ [ ]+ /x).collect(&:length).min
|
435
|
+
cleaned.gsub!(/ ^ [ ]{#{indent_count}} /x, '')
|
436
|
+
|
437
|
+
return cleaned
|
438
|
+
end
|
439
|
+
|
440
|
+
describe 'Fig' do
|
441
|
+
describe '--list-local' do
|
442
|
+
before(:each) do
|
443
|
+
clean_up_test_environment
|
444
|
+
set_up_test_environment
|
445
|
+
end
|
446
|
+
|
447
|
+
it %q<prints nothing with an empty repository> do
|
448
|
+
out, err = fig(%w<--list-local>)
|
449
|
+
out.should == ''
|
450
|
+
err.should == ''
|
451
|
+
end
|
452
|
+
|
453
|
+
it %q<prints only local packages> do
|
454
|
+
set_up_local_and_remote_repository
|
455
|
+
|
456
|
+
out, err = fig(%w<--list-local>)
|
457
|
+
out.should == "both/1.2.3\nlocal-only/1.2.3\nprerequisite/1.2.3"
|
458
|
+
err.should == ''
|
459
|
+
end
|
460
|
+
|
461
|
+
it 'should complain if with a package descriptor' do
|
462
|
+
out, err, exit_code = fig(%w<--list-local foo>, :no_raise_on_error => true)
|
463
|
+
out.should be_empty
|
464
|
+
err.should_not be_empty
|
465
|
+
exit_code.should_not == 0
|
466
|
+
end
|
467
|
+
|
468
|
+
it %q<should complain if local repository isn't in the expected format version> do
|
469
|
+
set_local_repository_format_to_future_version()
|
470
|
+
|
471
|
+
out, err, exit_code = fig(%w<--list-local>, :no_raise_on_error => true)
|
472
|
+
err.should =~
|
473
|
+
/Local repository is in version \d+ format. This version of fig can only deal with repositories in version \d+ format\./
|
474
|
+
exit_code.should_not == 0
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
describe '--list-remote' do
|
479
|
+
before(:each) do
|
480
|
+
clean_up_test_environment
|
481
|
+
set_up_test_environment
|
482
|
+
end
|
483
|
+
|
484
|
+
it %q<prints nothing with an empty repository> do
|
485
|
+
out, err = fig(%w<--list-remote>)
|
486
|
+
out.should == ''
|
487
|
+
err.should == ''
|
488
|
+
end
|
489
|
+
|
490
|
+
it %q<prints only remote packages> do
|
491
|
+
set_up_local_and_remote_repository
|
492
|
+
|
493
|
+
out, err = fig(%w<--list-remote>)
|
494
|
+
out.should == "both/1.2.3\nprerequisite/1.2.3\nremote-only/1.2.3"
|
495
|
+
err.should == ''
|
496
|
+
end
|
497
|
+
|
498
|
+
it 'should complain if with a package descriptor' do
|
499
|
+
out, err, exit_code =
|
500
|
+
fig(%w<--list-remote foo>, :no_raise_on_error => true)
|
501
|
+
err.should_not be_empty
|
502
|
+
exit_code.should_not == 0
|
503
|
+
end
|
504
|
+
|
505
|
+
it %q<should complain if remote repository isn't in the expected format version> do
|
506
|
+
set_remote_repository_format_to_future_version()
|
507
|
+
|
508
|
+
out, err, exit_code = fig(%w<--list-remote>, :no_raise_on_error => true)
|
509
|
+
err.should =~
|
510
|
+
/Remote repository is in version \d+ format. This version of fig can only deal with repositories in version \d+ format\./
|
511
|
+
exit_code.should_not == 0
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|
515
|
+
describe '--list-configs' do
|
516
|
+
before(:each) do
|
517
|
+
clean_up_test_environment
|
518
|
+
set_up_test_environment
|
519
|
+
end
|
520
|
+
|
521
|
+
it %q<prints all the configurations for local-only> do
|
522
|
+
test_list_configs('local-only')
|
523
|
+
end
|
524
|
+
|
525
|
+
it %q<prints all the configurations for both> do
|
526
|
+
test_list_configs('both')
|
527
|
+
end
|
528
|
+
|
529
|
+
it %q<prints all the configurations for remote-only> do
|
530
|
+
set_up_local_and_remote_repository
|
531
|
+
|
532
|
+
out, err, exit_code =
|
533
|
+
fig(%w<--list-configs remote-only/1.2.3>, :no_raise_on_error => true)
|
534
|
+
exit_code.should_not == 0
|
535
|
+
err.should =~ /Fig file not found for package/
|
536
|
+
end
|
537
|
+
end
|
538
|
+
|
539
|
+
describe '--list-dependencies' do
|
540
|
+
before(:each) do
|
541
|
+
clean_up_test_environment
|
542
|
+
set_up_test_environment
|
543
|
+
cleanup_home_and_remote
|
544
|
+
end
|
545
|
+
|
546
|
+
describe 'no --list-tree' do
|
547
|
+
describe 'no --list-all-configs' do
|
548
|
+
it %q<lists nothing when there are no dependencies without a package.fig (and output is not a tty)> do
|
549
|
+
set_up_local_and_remote_repository_with_depends_on_everything
|
550
|
+
remove_any_package_dot_fig
|
551
|
+
|
552
|
+
out, err = fig(%w<--list-dependencies prerequisite/1.2.3>)
|
553
|
+
out.should == ''
|
554
|
+
err.should == ''
|
555
|
+
end
|
556
|
+
|
557
|
+
it %q<lists only the single dependency and not all in the repository with a package.fig> do
|
558
|
+
set_up_local_and_remote_repository_with_depends_on_everything
|
559
|
+
create_package_dot_fig_with_single_dependency
|
560
|
+
|
561
|
+
out, err = fig(%w<--list-dependencies>)
|
562
|
+
out.should == 'prerequisite/1.2.3'
|
563
|
+
err.should == ''
|
564
|
+
end
|
565
|
+
|
566
|
+
it %q<lists almost all packages in the repository without a package.fig> do
|
567
|
+
set_up_local_and_remote_repository_with_depends_on_everything
|
568
|
+
remove_any_package_dot_fig
|
569
|
+
|
570
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
571
|
+
both/1.2.3
|
572
|
+
depends-on-everything/1.2.3
|
573
|
+
local-only/1.2.3
|
574
|
+
prerequisite/1.2.3
|
575
|
+
remote-only/1.2.3
|
576
|
+
END_EXPECTED_OUTPUT
|
577
|
+
|
578
|
+
out, err = fig(
|
579
|
+
%w<
|
580
|
+
--list-dependencies
|
581
|
+
depends-on-depends-on-everything/1.2.3:indirectly-everything
|
582
|
+
>
|
583
|
+
)
|
584
|
+
out.should == expected
|
585
|
+
err.should == ''
|
586
|
+
end
|
587
|
+
|
588
|
+
it %q<lists all packages in the repository with a package.fig> do
|
589
|
+
set_up_local_and_remote_repository_with_depends_on_everything
|
590
|
+
create_package_dot_fig_with_all_dependencies
|
591
|
+
|
592
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
593
|
+
both/1.2.3
|
594
|
+
depends-on-everything/1.2.3
|
595
|
+
local-only/1.2.3
|
596
|
+
prerequisite/1.2.3
|
597
|
+
remote-only/1.2.3
|
598
|
+
END_EXPECTED_OUTPUT
|
599
|
+
|
600
|
+
out, err = fig(%w<--list-dependencies>)
|
601
|
+
out.should == expected
|
602
|
+
err.should == ''
|
603
|
+
end
|
604
|
+
end
|
605
|
+
|
606
|
+
describe 'with --list-all-configs' do
|
607
|
+
it %q<lists only the single configuration when there are no dependencies without a package.fig> do
|
608
|
+
set_up_multiple_config_repository
|
609
|
+
remove_any_package_dot_fig
|
610
|
+
|
611
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
612
|
+
no-dependencies/1.2.3
|
613
|
+
END_EXPECTED_OUTPUT
|
614
|
+
|
615
|
+
out, err = fig(
|
616
|
+
%w<--list-dependencies --list-all-configs no-dependencies/1.2.3>
|
617
|
+
)
|
618
|
+
out.should == expected
|
619
|
+
err.should == ''
|
620
|
+
end
|
621
|
+
|
622
|
+
it %q<lists only the single dependency and not all in the repository with a package.fig> do
|
623
|
+
set_up_multiple_config_repository
|
624
|
+
create_package_dot_fig('no-dependencies')
|
625
|
+
|
626
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
627
|
+
no-dependencies/1.2.3
|
628
|
+
END_EXPECTED_OUTPUT
|
629
|
+
|
630
|
+
out, err = fig(%w<--list-dependencies --list-all-configs>)
|
631
|
+
out.should == expected
|
632
|
+
err.should == ''
|
633
|
+
end
|
634
|
+
|
635
|
+
it %q<lists all recursive configuration dependencies without a package.fig> do
|
636
|
+
set_up_multiple_config_repository
|
637
|
+
remove_any_package_dot_fig
|
638
|
+
|
639
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
640
|
+
database/1.2.3:mysql
|
641
|
+
database/1.2.3:oracle
|
642
|
+
database/1.2.3:postgresql
|
643
|
+
database/1.2.3:sqlserver
|
644
|
+
departments/1.2.3:accounting
|
645
|
+
departments/1.2.3:facilities
|
646
|
+
departments/1.2.3:legal
|
647
|
+
departments/1.2.3:marketing
|
648
|
+
operatingsystem/1.2.3:redhat
|
649
|
+
operatingsystem/1.2.3:ubuntu
|
650
|
+
operatingsystem/1.2.3:windows
|
651
|
+
operatingsystem/3.4.5:ubuntu
|
652
|
+
web/1.2.3:apache
|
653
|
+
web/1.2.3:iis
|
654
|
+
web/1.2.3:lighttpd
|
655
|
+
END_EXPECTED_OUTPUT
|
656
|
+
|
657
|
+
out, err = fig(
|
658
|
+
%w<--list-dependencies --list-all-configs departments/1.2.3:legal>
|
659
|
+
)
|
660
|
+
out.should == expected
|
661
|
+
err.should == ''
|
662
|
+
end
|
663
|
+
|
664
|
+
it %q<lists all packages in the repository with a package.fig> do
|
665
|
+
set_up_local_and_remote_repository_with_depends_on_everything
|
666
|
+
create_package_dot_fig_with_all_dependencies
|
667
|
+
|
668
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
669
|
+
both/1.2.3
|
670
|
+
depends-on-everything/1.2.3
|
671
|
+
depends-on-everything/1.2.3:everything
|
672
|
+
local-only/1.2.3
|
673
|
+
prerequisite/1.2.3
|
674
|
+
remote-only/1.2.3
|
675
|
+
END_EXPECTED_OUTPUT
|
676
|
+
|
677
|
+
out, err = fig(%w<--list-dependencies --list-all-configs>)
|
678
|
+
out.should == expected
|
679
|
+
err.should == ''
|
680
|
+
end
|
681
|
+
end
|
682
|
+
end
|
683
|
+
|
684
|
+
describe 'with --list-tree' do
|
685
|
+
describe 'no --list-all-configs' do
|
686
|
+
it %q<lists the package when there are no dependencies without a package.fig (and output is not a tty)> do
|
687
|
+
set_up_local_and_remote_repository_with_depends_on_everything
|
688
|
+
remove_any_package_dot_fig
|
689
|
+
|
690
|
+
out, err =
|
691
|
+
fig(%w<--list-dependencies --list-tree prerequisite/1.2.3>)
|
692
|
+
out.should == 'prerequisite/1.2.3'
|
693
|
+
err.should == ''
|
694
|
+
end
|
695
|
+
|
696
|
+
it %q<lists only the package and the dependency and not all in the repository with a package.fig> do
|
697
|
+
set_up_local_and_remote_repository_with_depends_on_everything
|
698
|
+
create_package_dot_fig_with_single_dependency
|
699
|
+
|
700
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
701
|
+
[package.fig]
|
702
|
+
prerequisite/1.2.3
|
703
|
+
END_EXPECTED_OUTPUT
|
704
|
+
|
705
|
+
out, err = fig(%w<--list-dependencies --list-tree>)
|
706
|
+
out.should == expected
|
707
|
+
err.should == ''
|
708
|
+
end
|
709
|
+
|
710
|
+
it %q<lists almost all packages in the repository without a package.fig> do
|
711
|
+
set_up_local_and_remote_repository_with_depends_on_everything
|
712
|
+
remove_any_package_dot_fig
|
713
|
+
|
714
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
715
|
+
depends-on-depends-on-everything/1.2.3:indirectly-everything
|
716
|
+
depends-on-everything/1.2.3:everything
|
717
|
+
prerequisite/1.2.3
|
718
|
+
local-only/1.2.3
|
719
|
+
prerequisite/1.2.3
|
720
|
+
remote-only/1.2.3
|
721
|
+
prerequisite/1.2.3
|
722
|
+
both/1.2.3
|
723
|
+
prerequisite/1.2.3
|
724
|
+
END_EXPECTED_OUTPUT
|
725
|
+
|
726
|
+
out, err = fig(
|
727
|
+
%w<
|
728
|
+
--list-dependencies
|
729
|
+
--list-tree depends-on-depends-on-everything/1.2.3:indirectly-everything
|
730
|
+
>
|
731
|
+
)
|
732
|
+
out.should == expected
|
733
|
+
err.should == ''
|
734
|
+
end
|
735
|
+
|
736
|
+
it %q<lists all packages in the repository with a package.fig> do
|
737
|
+
set_up_local_and_remote_repository_with_depends_on_everything
|
738
|
+
create_package_dot_fig_with_all_dependencies
|
739
|
+
|
740
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
741
|
+
[package.fig]
|
742
|
+
depends-on-everything/1.2.3
|
743
|
+
depends-on-everything/1.2.3:everything
|
744
|
+
prerequisite/1.2.3
|
745
|
+
local-only/1.2.3
|
746
|
+
prerequisite/1.2.3
|
747
|
+
remote-only/1.2.3
|
748
|
+
prerequisite/1.2.3
|
749
|
+
both/1.2.3
|
750
|
+
prerequisite/1.2.3
|
751
|
+
END_EXPECTED_OUTPUT
|
752
|
+
|
753
|
+
out, err = fig(%w<--list-dependencies --list-tree>)
|
754
|
+
out.should == expected
|
755
|
+
err.should == ''
|
756
|
+
end
|
757
|
+
end
|
758
|
+
|
759
|
+
describe 'with --list-all-configs' do
|
760
|
+
it %q<lists only the single configuration when there are no dependencies without a package.fig> do
|
761
|
+
set_up_multiple_config_repository
|
762
|
+
remove_any_package_dot_fig
|
763
|
+
|
764
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
765
|
+
no-dependencies/1.2.3
|
766
|
+
END_EXPECTED_OUTPUT
|
767
|
+
|
768
|
+
out, err = fig(
|
769
|
+
%w<
|
770
|
+
--list-dependencies --list-tree --list-all-configs
|
771
|
+
no-dependencies/1.2.3
|
772
|
+
>
|
773
|
+
)
|
774
|
+
out.should == expected
|
775
|
+
err.should == ''
|
776
|
+
end
|
777
|
+
|
778
|
+
it %q<lists only the package and the dependency and not all in the repository with a package.fig> do
|
779
|
+
set_up_multiple_config_repository
|
780
|
+
create_package_dot_fig('no-dependencies')
|
781
|
+
|
782
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
783
|
+
[package.fig]
|
784
|
+
no-dependencies/1.2.3
|
785
|
+
END_EXPECTED_OUTPUT
|
786
|
+
|
787
|
+
out, err =
|
788
|
+
fig(%w<--list-dependencies --list-tree --list-all-configs>)
|
789
|
+
out.should == expected
|
790
|
+
err.should == ''
|
791
|
+
end
|
792
|
+
|
793
|
+
it %q<lists almost all packages in the repository without a package.fig> do
|
794
|
+
set_up_multiple_config_repository
|
795
|
+
remove_any_package_dot_fig
|
796
|
+
|
797
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
798
|
+
departments/1.2.3:accounting
|
799
|
+
database/1.2.3:oracle
|
800
|
+
operatingsystem/1.2.3:redhat
|
801
|
+
web/1.2.3:apache
|
802
|
+
operatingsystem/1.2.3:redhat
|
803
|
+
departments/1.2.3:facilities
|
804
|
+
web/1.2.3:lighttpd
|
805
|
+
operatingsystem/3.4.5:ubuntu
|
806
|
+
database/1.2.3:mysql
|
807
|
+
operatingsystem/1.2.3:ubuntu
|
808
|
+
departments/1.2.3:marketing
|
809
|
+
database/1.2.3:postgresql
|
810
|
+
operatingsystem/3.4.5:ubuntu
|
811
|
+
web/1.2.3:lighttpd
|
812
|
+
operatingsystem/3.4.5:ubuntu
|
813
|
+
departments/1.2.3:legal
|
814
|
+
web/1.2.3:iis
|
815
|
+
operatingsystem/1.2.3:windows
|
816
|
+
database/1.2.3:sqlserver
|
817
|
+
operatingsystem/1.2.3:windows
|
818
|
+
END_EXPECTED_OUTPUT
|
819
|
+
|
820
|
+
out, err = fig(
|
821
|
+
%w<
|
822
|
+
--list-dependencies --list-tree --list-all-configs
|
823
|
+
departments/1.2.3
|
824
|
+
>
|
825
|
+
)
|
826
|
+
out.should == expected
|
827
|
+
err.should == ''
|
828
|
+
end
|
829
|
+
|
830
|
+
it %q<lists only the configs in a package.fig and not all configs in dependencies> do
|
831
|
+
set_up_multiple_config_repository
|
832
|
+
|
833
|
+
File.open "#{CURRENT_DIRECTORY}/#{Fig::Command::PackageLoader::DEFAULT_PACKAGE_FILE}", 'w' do
|
834
|
+
|handle|
|
835
|
+
handle.print <<-END
|
836
|
+
config machineA
|
837
|
+
include departments/1.2.3:marketing
|
838
|
+
include departments/1.2.3:legal
|
839
|
+
end
|
840
|
+
|
841
|
+
config machineB
|
842
|
+
include departments/1.2.3:facilities
|
843
|
+
end
|
844
|
+
END
|
845
|
+
end
|
846
|
+
|
847
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
848
|
+
[package.fig]:machineA
|
849
|
+
departments/1.2.3:marketing
|
850
|
+
database/1.2.3:postgresql
|
851
|
+
operatingsystem/3.4.5:ubuntu
|
852
|
+
web/1.2.3:lighttpd
|
853
|
+
operatingsystem/3.4.5:ubuntu
|
854
|
+
departments/1.2.3:legal
|
855
|
+
web/1.2.3:iis
|
856
|
+
operatingsystem/1.2.3:windows
|
857
|
+
database/1.2.3:sqlserver
|
858
|
+
operatingsystem/1.2.3:windows
|
859
|
+
[package.fig]:machineB
|
860
|
+
departments/1.2.3:facilities
|
861
|
+
web/1.2.3:lighttpd
|
862
|
+
operatingsystem/3.4.5:ubuntu
|
863
|
+
database/1.2.3:mysql
|
864
|
+
operatingsystem/1.2.3:ubuntu
|
865
|
+
END_EXPECTED_OUTPUT
|
866
|
+
|
867
|
+
out, err =
|
868
|
+
fig(%w<--list-dependencies --list-tree --list-all-configs>)
|
869
|
+
out.should == expected
|
870
|
+
err.should == ''
|
871
|
+
end
|
872
|
+
|
873
|
+
it %q<handles the case where a specific config may pick up a different dependency version depending upon the order in which it was reached.> do
|
874
|
+
input_downstream = <<-END_INPUT
|
875
|
+
# This path should work because there's a version of upstream
|
876
|
+
# specified.
|
877
|
+
config default
|
878
|
+
include :include-upstream override upstream/standard
|
879
|
+
end
|
880
|
+
|
881
|
+
# This path should fail because there's no version of upstream
|
882
|
+
# specified despite the fact that the walk of this file will end up
|
883
|
+
# with the default config being hit before this one.
|
884
|
+
config nondefault
|
885
|
+
include :include-upstream
|
886
|
+
end
|
887
|
+
|
888
|
+
config include-upstream
|
889
|
+
include upstream
|
890
|
+
end
|
891
|
+
END_INPUT
|
892
|
+
|
893
|
+
input_upstream = <<-END_INPUT
|
894
|
+
config default
|
895
|
+
end
|
896
|
+
END_INPUT
|
897
|
+
|
898
|
+
fig(%w<--publish upstream/standard>, input_upstream)
|
899
|
+
fig(%w<--publish upstream/non-standard>, input_upstream)
|
900
|
+
|
901
|
+
fig(%w<--publish downstream/whatever>, input_downstream)
|
902
|
+
|
903
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
904
|
+
downstream/whatever
|
905
|
+
downstream/whatever:include-upstream
|
906
|
+
upstream/standard
|
907
|
+
downstream/whatever:nondefault
|
908
|
+
downstream/whatever:include-upstream
|
909
|
+
END_EXPECTED_OUTPUT
|
910
|
+
|
911
|
+
out, err, exit_code = fig(
|
912
|
+
%w<
|
913
|
+
--list-dependencies --list-tree --list-all-configs
|
914
|
+
downstream/whatever
|
915
|
+
>,
|
916
|
+
:no_raise_on_error => true
|
917
|
+
)
|
918
|
+
out.should == expected
|
919
|
+
err.should =~ /Cannot retrieve "upstream" without a version/
|
920
|
+
exit_code.should_not == 0
|
921
|
+
end
|
922
|
+
end
|
923
|
+
end
|
924
|
+
|
925
|
+
it %q<handles "include ... override ..."> do
|
926
|
+
set_up_packages_with_overrides
|
927
|
+
remove_any_package_dot_fig
|
928
|
+
|
929
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
930
|
+
B/1.2.3
|
931
|
+
C/4.5.6
|
932
|
+
D/4.5.6
|
933
|
+
END_EXPECTED_OUTPUT
|
934
|
+
|
935
|
+
out, err = fig(%w<--list-dependencies A/1.2.3>)
|
936
|
+
out.should == expected
|
937
|
+
err.should == ''
|
938
|
+
end
|
939
|
+
|
940
|
+
it %q<handles --config> do
|
941
|
+
input_prerequisite = <<-END_INPUT
|
942
|
+
config default
|
943
|
+
end
|
944
|
+
END_INPUT
|
945
|
+
|
946
|
+
fig(%w<--publish prerequisite/1.2.3>, input_prerequisite)
|
947
|
+
|
948
|
+
File.open "#{CURRENT_DIRECTORY}/#{Fig::Command::PackageLoader::DEFAULT_PACKAGE_FILE}", 'w' do
|
949
|
+
|handle|
|
950
|
+
handle.print <<-END
|
951
|
+
config default
|
952
|
+
# No version, which would cause load to fail if it is hit first.
|
953
|
+
include prerequisite
|
954
|
+
end
|
955
|
+
|
956
|
+
config nondefault
|
957
|
+
include prerequisite/1.2.3
|
958
|
+
include :default
|
959
|
+
end
|
960
|
+
END
|
961
|
+
end
|
962
|
+
|
963
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
964
|
+
prerequisite/1.2.3
|
965
|
+
END_EXPECTED_OUTPUT
|
966
|
+
|
967
|
+
out, err = fig(%w<--list-dependencies --config nondefault>)
|
968
|
+
out.should == expected
|
969
|
+
err.should =~ /No version in the package descriptor of "prerequisite" in an include statement/
|
970
|
+
end
|
971
|
+
|
972
|
+
it %q<should complain if local repository isn't in the expected format version> do
|
973
|
+
set_up_packages_with_overrides
|
974
|
+
remove_any_package_dot_fig
|
975
|
+
set_local_repository_format_to_future_version
|
976
|
+
|
977
|
+
out, err, exit_code =
|
978
|
+
fig(%w<--list-dependencies A/1.2.3>, :no_raise_on_error => true)
|
979
|
+
exit_code.should_not == 0
|
980
|
+
err.should =~
|
981
|
+
/Local repository is in version \d+ format. This version of fig can only deal with repositories in version \d+ format\./
|
982
|
+
end
|
983
|
+
end
|
984
|
+
|
985
|
+
describe '--list-variables' do
|
986
|
+
describe 'no --list-tree' do
|
987
|
+
describe 'no --list-all-configs' do
|
988
|
+
before(:each) do
|
989
|
+
clean_up_test_environment
|
990
|
+
set_up_test_environment
|
991
|
+
end
|
992
|
+
|
993
|
+
it %q<lists no dependency variables when none should exist without a package.fig> do
|
994
|
+
set_up_list_variables_packages
|
995
|
+
out, err = fig(%w<--list-variables E/1.2.3>)
|
996
|
+
out.should == ''
|
997
|
+
err.should == ''
|
998
|
+
end
|
999
|
+
|
1000
|
+
it %q<lists no dependency variables when none should exist with a package.fig> do
|
1001
|
+
set_up_list_variables_packages
|
1002
|
+
create_package_dot_fig('E')
|
1003
|
+
out, err = fig(%w<--list-variables>)
|
1004
|
+
out.should == ''
|
1005
|
+
err.should == ''
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
it %q<lists all dependency variables without a package.fig> do
|
1009
|
+
set_up_list_variables_packages
|
1010
|
+
|
1011
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
1012
|
+
ADDON_A=ding
|
1013
|
+
ADDON_B=dong
|
1014
|
+
ADDON_C=dang
|
1015
|
+
A_BOTH_CONFIGS=default
|
1016
|
+
A_DEFAULT=BAR
|
1017
|
+
A_OVERRIDES_B_AND_C=A
|
1018
|
+
A_OVERRIDES_C_PREPENDING_B=A
|
1019
|
+
A_OVERRIDES_D=A
|
1020
|
+
A_PATH_DEFAULT=BAR
|
1021
|
+
A_PATH_PREPENDS_B_AND_C=A:B:C
|
1022
|
+
A_PATH_PREPENDS_D=A:D
|
1023
|
+
A_SET_GETS_PREPENDED_WITH_B_AND_C=B:C:A
|
1024
|
+
B_DEFAULT=BAR
|
1025
|
+
B_OVERRIDES_A_AND_C=B
|
1026
|
+
B_OVERRIDES_C=B
|
1027
|
+
B_PATH_PREPENDS_A_AND_C=B:C:A
|
1028
|
+
C_DEFAULT=BAR
|
1029
|
+
D_DEFAULT=BAR
|
1030
|
+
D_OVERRIDES_A=D
|
1031
|
+
D_PATH_PREPENDS_A=D:A
|
1032
|
+
END_EXPECTED_OUTPUT
|
1033
|
+
|
1034
|
+
expected.gsub!(/:/,File::PATH_SEPARATOR)
|
1035
|
+
|
1036
|
+
out, err = fig(%w<--list-variables A/1.2.3>)
|
1037
|
+
out.should == expected
|
1038
|
+
err.should =~
|
1039
|
+
%r<No version in the package descriptor of "D" in an include statement in the \.fig file for "B/1\.2\.3" \(line>
|
1040
|
+
end
|
1041
|
+
|
1042
|
+
it %q<lists all dependency variables with a package.fig> do
|
1043
|
+
set_up_list_variables_packages
|
1044
|
+
create_package_dot_fig('A')
|
1045
|
+
|
1046
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
1047
|
+
ADDON_A=ding
|
1048
|
+
ADDON_B=dong
|
1049
|
+
ADDON_C=dang
|
1050
|
+
A_BOTH_CONFIGS=default
|
1051
|
+
A_DEFAULT=BAR
|
1052
|
+
A_OVERRIDES_B_AND_C=A
|
1053
|
+
A_OVERRIDES_C_PREPENDING_B=A
|
1054
|
+
A_OVERRIDES_D=A
|
1055
|
+
A_PATH_DEFAULT=BAR
|
1056
|
+
A_PATH_PREPENDS_B_AND_C=A:B:C
|
1057
|
+
A_PATH_PREPENDS_D=A:D
|
1058
|
+
A_SET_GETS_PREPENDED_WITH_B_AND_C=B:C:A
|
1059
|
+
B_DEFAULT=BAR
|
1060
|
+
B_OVERRIDES_A_AND_C=B
|
1061
|
+
B_OVERRIDES_C=B
|
1062
|
+
B_PATH_PREPENDS_A_AND_C=B:C:A
|
1063
|
+
C_DEFAULT=BAR
|
1064
|
+
D_DEFAULT=BAR
|
1065
|
+
D_OVERRIDES_A=D
|
1066
|
+
D_PATH_PREPENDS_A=D:A
|
1067
|
+
END_EXPECTED_OUTPUT
|
1068
|
+
|
1069
|
+
expected.gsub!(/:/,File::PATH_SEPARATOR)
|
1070
|
+
|
1071
|
+
out, err = fig(%w<--list-variables>)
|
1072
|
+
|
1073
|
+
out.should == expected
|
1074
|
+
err.should =~
|
1075
|
+
%r<No version in the package descriptor of "D" in an include statement in the \.fig file for "B/1\.2\.3" \(line>
|
1076
|
+
end
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
describe 'with --list-all-configs' do
|
1080
|
+
before(:each) do
|
1081
|
+
clean_up_test_environment
|
1082
|
+
set_up_test_environment
|
1083
|
+
end
|
1084
|
+
|
1085
|
+
it %q<lists no dependency variables when none should exist without a package.fig> do
|
1086
|
+
set_up_list_variables_packages
|
1087
|
+
out, err = fig(%w<--list-variables --list-all-configs E/1.2.3>)
|
1088
|
+
out.should == ''
|
1089
|
+
err.should == ''
|
1090
|
+
end
|
1091
|
+
|
1092
|
+
it %q<lists no dependency variables when none should exist with a package.fig> do
|
1093
|
+
set_up_list_variables_packages
|
1094
|
+
create_package_dot_fig('E')
|
1095
|
+
out, err = fig(%w<--list-variables --list-all-configs>)
|
1096
|
+
out.should == ''
|
1097
|
+
err.should == ''
|
1098
|
+
end
|
1099
|
+
|
1100
|
+
it %q<lists all dependency variables without a package.fig> do
|
1101
|
+
set_up_list_variables_packages
|
1102
|
+
|
1103
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
1104
|
+
ADDON_A
|
1105
|
+
ADDON_B
|
1106
|
+
ADDON_C
|
1107
|
+
A_BOTH_CONFIGS
|
1108
|
+
A_DEFAULT
|
1109
|
+
A_NONDEFAULT
|
1110
|
+
A_OVERRIDES_B_AND_C
|
1111
|
+
A_OVERRIDES_C_PREPENDING_B
|
1112
|
+
A_OVERRIDES_D
|
1113
|
+
A_PATH_DEFAULT
|
1114
|
+
A_PATH_PREPENDS_B_AND_C
|
1115
|
+
A_PATH_PREPENDS_D
|
1116
|
+
A_SET_GETS_PREPENDED_WITH_B_AND_C
|
1117
|
+
B_DEFAULT
|
1118
|
+
B_OVERRIDES_A_AND_C
|
1119
|
+
B_OVERRIDES_C
|
1120
|
+
B_PATH_PREPENDS_A_AND_C
|
1121
|
+
C_DEFAULT
|
1122
|
+
C_ONLY_IN_C456
|
1123
|
+
D_DEFAULT
|
1124
|
+
D_OVERRIDES_A
|
1125
|
+
D_PATH_PREPENDS_A
|
1126
|
+
END_EXPECTED_OUTPUT
|
1127
|
+
|
1128
|
+
expected.gsub!(/:/,File::PATH_SEPARATOR)
|
1129
|
+
|
1130
|
+
out, err = fig(%w<--list-variables --list-all-configs A/1.2.3>)
|
1131
|
+
out.should == expected
|
1132
|
+
err.should =~
|
1133
|
+
%r<No version in the package descriptor of "D" in an include statement in the \.fig file for "B/1\.2\.3:default" \(line>
|
1134
|
+
end
|
1135
|
+
|
1136
|
+
it %q<lists all dependency variables with a package.fig> do
|
1137
|
+
set_up_list_variables_packages
|
1138
|
+
create_package_dot_fig('A')
|
1139
|
+
|
1140
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
1141
|
+
ADDON_A
|
1142
|
+
ADDON_B
|
1143
|
+
ADDON_C
|
1144
|
+
A_BOTH_CONFIGS
|
1145
|
+
A_DEFAULT
|
1146
|
+
A_OVERRIDES_B_AND_C
|
1147
|
+
A_OVERRIDES_C_PREPENDING_B
|
1148
|
+
A_OVERRIDES_D
|
1149
|
+
A_PATH_DEFAULT
|
1150
|
+
A_PATH_PREPENDS_B_AND_C
|
1151
|
+
A_PATH_PREPENDS_D
|
1152
|
+
A_SET_GETS_PREPENDED_WITH_B_AND_C
|
1153
|
+
B_DEFAULT
|
1154
|
+
B_OVERRIDES_A_AND_C
|
1155
|
+
B_OVERRIDES_C
|
1156
|
+
B_PATH_PREPENDS_A_AND_C
|
1157
|
+
C_DEFAULT
|
1158
|
+
D_DEFAULT
|
1159
|
+
D_OVERRIDES_A
|
1160
|
+
D_PATH_PREPENDS_A
|
1161
|
+
END_EXPECTED_OUTPUT
|
1162
|
+
|
1163
|
+
expected.gsub!(/:/,File::PATH_SEPARATOR)
|
1164
|
+
|
1165
|
+
out, err = fig(%w<--list-variables --list-all-configs>)
|
1166
|
+
out.should == expected
|
1167
|
+
err.should =~
|
1168
|
+
%r<No version in the package descriptor of "D" in an include statement in the \.fig file for "B/1\.2\.3:default" \(line>
|
1169
|
+
end
|
1170
|
+
end
|
1171
|
+
end
|
1172
|
+
|
1173
|
+
describe 'with --list-tree' do
|
1174
|
+
describe 'no --list-all-configs' do
|
1175
|
+
before(:each) do
|
1176
|
+
clean_up_test_environment
|
1177
|
+
set_up_test_environment
|
1178
|
+
end
|
1179
|
+
|
1180
|
+
it %q<lists no dependency variables when none should exist without a package.fig> do
|
1181
|
+
set_up_list_variables_packages
|
1182
|
+
|
1183
|
+
out, err = fig(%w<--list-variables --list-tree E/1.2.3>)
|
1184
|
+
out.should == 'E/1.2.3'
|
1185
|
+
err.should == ''
|
1186
|
+
end
|
1187
|
+
|
1188
|
+
it %q<lists no dependency variables when none should exist with a package.fig> do
|
1189
|
+
set_up_list_variables_packages
|
1190
|
+
create_package_dot_fig('E')
|
1191
|
+
|
1192
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
1193
|
+
[package.fig]
|
1194
|
+
'---E/1.2.3
|
1195
|
+
END_EXPECTED_OUTPUT
|
1196
|
+
|
1197
|
+
out, err = fig(%w<--list-variables --list-tree>)
|
1198
|
+
out.should == expected
|
1199
|
+
err.should == ''
|
1200
|
+
end
|
1201
|
+
|
1202
|
+
it %q<lists all dependency variables without a package.fig> do
|
1203
|
+
set_up_list_variables_packages
|
1204
|
+
|
1205
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
1206
|
+
A/1.2.3
|
1207
|
+
| A_BOTH_CONFIGS = default
|
1208
|
+
| A_DEFAULT = BAR
|
1209
|
+
| D_OVERRIDES_A = A
|
1210
|
+
| B_OVERRIDES_A_AND_C = A
|
1211
|
+
| A_PATH_DEFAULT = BAR:$A_PATH_DEFAULT
|
1212
|
+
| D_PATH_PREPENDS_A = A:$D_PATH_PREPENDS_A
|
1213
|
+
| B_PATH_PREPENDS_A_AND_C = A:$B_PATH_PREPENDS_A_AND_C
|
1214
|
+
| A_SET_GETS_PREPENDED_WITH_B_AND_C = A
|
1215
|
+
| A_OVERRIDES_C_PREPENDING_B = A
|
1216
|
+
| A_OVERRIDES_B_AND_C = A
|
1217
|
+
| A_OVERRIDES_D = A
|
1218
|
+
| A_PATH_PREPENDS_B_AND_C = A:$A_PATH_PREPENDS_B_AND_C
|
1219
|
+
| A_PATH_PREPENDS_D = A:$A_PATH_PREPENDS_D
|
1220
|
+
'---C/1.2.3
|
1221
|
+
| | C_DEFAULT = BAR
|
1222
|
+
| | B_OVERRIDES_C = C
|
1223
|
+
| | B_OVERRIDES_A_AND_C = C
|
1224
|
+
| | A_OVERRIDES_B_AND_C = C
|
1225
|
+
| | B_PATH_PREPENDS_A_AND_C = C:$B_PATH_PREPENDS_A_AND_C
|
1226
|
+
| | A_PATH_PREPENDS_B_AND_C = C:$A_PATH_PREPENDS_B_AND_C
|
1227
|
+
| | A_SET_GETS_PREPENDED_WITH_B_AND_C = C:$A_SET_GETS_PREPENDED_WITH_B_AND_C
|
1228
|
+
| | A_OVERRIDES_C_PREPENDING_B = C:$A_OVERRIDES_C_PREPENDING_B
|
1229
|
+
| '---D/1.2.3
|
1230
|
+
| | D_DEFAULT = BAR
|
1231
|
+
| | A_OVERRIDES_D = D
|
1232
|
+
| | D_OVERRIDES_A = D
|
1233
|
+
| | D_PATH_PREPENDS_A = D:$D_PATH_PREPENDS_A
|
1234
|
+
| | A_PATH_PREPENDS_D = D:$A_PATH_PREPENDS_D
|
1235
|
+
| '---D/1.2.3:addon_a
|
1236
|
+
| | ADDON_A = ding
|
1237
|
+
| '---D/1.2.3:addon_b
|
1238
|
+
| | | ADDON_B = dong
|
1239
|
+
| | '---E/1.2.3
|
1240
|
+
| '---D/1.2.3:addon_c
|
1241
|
+
| ADDON_C = dang
|
1242
|
+
'---B/1.2.3
|
1243
|
+
| B_DEFAULT = BAR
|
1244
|
+
| B_OVERRIDES_C = B
|
1245
|
+
| B_OVERRIDES_A_AND_C = B
|
1246
|
+
| A_OVERRIDES_B_AND_C = B
|
1247
|
+
| B_PATH_PREPENDS_A_AND_C = B:$B_PATH_PREPENDS_A_AND_C
|
1248
|
+
| A_PATH_PREPENDS_B_AND_C = B:$A_PATH_PREPENDS_B_AND_C
|
1249
|
+
| A_SET_GETS_PREPENDED_WITH_B_AND_C = B:$A_SET_GETS_PREPENDED_WITH_B_AND_C
|
1250
|
+
| A_OVERRIDES_C_PREPENDING_B = B:$A_OVERRIDES_C_PREPENDING_B
|
1251
|
+
'---D/1.2.3
|
1252
|
+
| D_DEFAULT = BAR
|
1253
|
+
| A_OVERRIDES_D = D
|
1254
|
+
| D_OVERRIDES_A = D
|
1255
|
+
| D_PATH_PREPENDS_A = D:$D_PATH_PREPENDS_A
|
1256
|
+
| A_PATH_PREPENDS_D = D:$A_PATH_PREPENDS_D
|
1257
|
+
'---D/1.2.3:addon_a
|
1258
|
+
| ADDON_A = ding
|
1259
|
+
'---D/1.2.3:addon_b
|
1260
|
+
| | ADDON_B = dong
|
1261
|
+
| '---E/1.2.3
|
1262
|
+
'---D/1.2.3:addon_c
|
1263
|
+
ADDON_C = dang
|
1264
|
+
END_EXPECTED_OUTPUT
|
1265
|
+
|
1266
|
+
out, err = fig(%w<--list-variables A/1.2.3 --list-tree>)
|
1267
|
+
out.should == expected
|
1268
|
+
err.should =~
|
1269
|
+
%r<No version in the package descriptor of "D" in an include statement in the \.fig file for "B/1\.2\.3:default" \(line>
|
1270
|
+
end
|
1271
|
+
|
1272
|
+
it %q<lists all dependency variables with a package.fig> do
|
1273
|
+
set_up_list_variables_packages
|
1274
|
+
create_package_dot_fig('A')
|
1275
|
+
|
1276
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
1277
|
+
[package.fig]
|
1278
|
+
'---A/1.2.3
|
1279
|
+
| A_BOTH_CONFIGS = default
|
1280
|
+
| A_DEFAULT = BAR
|
1281
|
+
| D_OVERRIDES_A = A
|
1282
|
+
| B_OVERRIDES_A_AND_C = A
|
1283
|
+
| A_PATH_DEFAULT = BAR:$A_PATH_DEFAULT
|
1284
|
+
| D_PATH_PREPENDS_A = A:$D_PATH_PREPENDS_A
|
1285
|
+
| B_PATH_PREPENDS_A_AND_C = A:$B_PATH_PREPENDS_A_AND_C
|
1286
|
+
| A_SET_GETS_PREPENDED_WITH_B_AND_C = A
|
1287
|
+
| A_OVERRIDES_C_PREPENDING_B = A
|
1288
|
+
| A_OVERRIDES_B_AND_C = A
|
1289
|
+
| A_OVERRIDES_D = A
|
1290
|
+
| A_PATH_PREPENDS_B_AND_C = A:$A_PATH_PREPENDS_B_AND_C
|
1291
|
+
| A_PATH_PREPENDS_D = A:$A_PATH_PREPENDS_D
|
1292
|
+
'---C/1.2.3
|
1293
|
+
| | C_DEFAULT = BAR
|
1294
|
+
| | B_OVERRIDES_C = C
|
1295
|
+
| | B_OVERRIDES_A_AND_C = C
|
1296
|
+
| | A_OVERRIDES_B_AND_C = C
|
1297
|
+
| | B_PATH_PREPENDS_A_AND_C = C:$B_PATH_PREPENDS_A_AND_C
|
1298
|
+
| | A_PATH_PREPENDS_B_AND_C = C:$A_PATH_PREPENDS_B_AND_C
|
1299
|
+
| | A_SET_GETS_PREPENDED_WITH_B_AND_C = C:$A_SET_GETS_PREPENDED_WITH_B_AND_C
|
1300
|
+
| | A_OVERRIDES_C_PREPENDING_B = C:$A_OVERRIDES_C_PREPENDING_B
|
1301
|
+
| '---D/1.2.3
|
1302
|
+
| | D_DEFAULT = BAR
|
1303
|
+
| | A_OVERRIDES_D = D
|
1304
|
+
| | D_OVERRIDES_A = D
|
1305
|
+
| | D_PATH_PREPENDS_A = D:$D_PATH_PREPENDS_A
|
1306
|
+
| | A_PATH_PREPENDS_D = D:$A_PATH_PREPENDS_D
|
1307
|
+
| '---D/1.2.3:addon_a
|
1308
|
+
| | ADDON_A = ding
|
1309
|
+
| '---D/1.2.3:addon_b
|
1310
|
+
| | | ADDON_B = dong
|
1311
|
+
| | '---E/1.2.3
|
1312
|
+
| '---D/1.2.3:addon_c
|
1313
|
+
| ADDON_C = dang
|
1314
|
+
'---B/1.2.3
|
1315
|
+
| B_DEFAULT = BAR
|
1316
|
+
| B_OVERRIDES_C = B
|
1317
|
+
| B_OVERRIDES_A_AND_C = B
|
1318
|
+
| A_OVERRIDES_B_AND_C = B
|
1319
|
+
| B_PATH_PREPENDS_A_AND_C = B:$B_PATH_PREPENDS_A_AND_C
|
1320
|
+
| A_PATH_PREPENDS_B_AND_C = B:$A_PATH_PREPENDS_B_AND_C
|
1321
|
+
| A_SET_GETS_PREPENDED_WITH_B_AND_C = B:$A_SET_GETS_PREPENDED_WITH_B_AND_C
|
1322
|
+
| A_OVERRIDES_C_PREPENDING_B = B:$A_OVERRIDES_C_PREPENDING_B
|
1323
|
+
'---D/1.2.3
|
1324
|
+
| D_DEFAULT = BAR
|
1325
|
+
| A_OVERRIDES_D = D
|
1326
|
+
| D_OVERRIDES_A = D
|
1327
|
+
| D_PATH_PREPENDS_A = D:$D_PATH_PREPENDS_A
|
1328
|
+
| A_PATH_PREPENDS_D = D:$A_PATH_PREPENDS_D
|
1329
|
+
'---D/1.2.3:addon_a
|
1330
|
+
| ADDON_A = ding
|
1331
|
+
'---D/1.2.3:addon_b
|
1332
|
+
| | ADDON_B = dong
|
1333
|
+
| '---E/1.2.3
|
1334
|
+
'---D/1.2.3:addon_c
|
1335
|
+
ADDON_C = dang
|
1336
|
+
END_EXPECTED_OUTPUT
|
1337
|
+
|
1338
|
+
out, err = fig(%w<--list-variables --list-tree>)
|
1339
|
+
|
1340
|
+
out.should == expected
|
1341
|
+
err.should =~
|
1342
|
+
%r<No version in the package descriptor of "D" in an include statement in the \.fig file for "B/1\.2\.3:default" \(line>
|
1343
|
+
end
|
1344
|
+
end
|
1345
|
+
|
1346
|
+
describe 'with --list-all-configs' do
|
1347
|
+
before(:each) do
|
1348
|
+
clean_up_test_environment
|
1349
|
+
set_up_test_environment
|
1350
|
+
end
|
1351
|
+
|
1352
|
+
it %q<lists no dependency variables when none should exist without a package.fig> do
|
1353
|
+
set_up_list_variables_packages
|
1354
|
+
|
1355
|
+
out, err =
|
1356
|
+
fig(%w<--list-variables --list-all-configs --list-tree E/1.2.3>)
|
1357
|
+
out.should == 'E/1.2.3'
|
1358
|
+
err.should == ''
|
1359
|
+
end
|
1360
|
+
|
1361
|
+
it %q<lists no dependency variables when none should exist with a package.fig> do
|
1362
|
+
set_up_list_variables_packages
|
1363
|
+
create_package_dot_fig('E')
|
1364
|
+
|
1365
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
1366
|
+
[package.fig]
|
1367
|
+
'---E/1.2.3
|
1368
|
+
END_EXPECTED_OUTPUT
|
1369
|
+
|
1370
|
+
out, err = fig(%w<--list-variables --list-all-configs --list-tree>)
|
1371
|
+
out.should == expected
|
1372
|
+
err.should == ''
|
1373
|
+
end
|
1374
|
+
|
1375
|
+
it %q<lists all dependency variables without a package.fig> do
|
1376
|
+
set_up_list_variables_packages
|
1377
|
+
|
1378
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
1379
|
+
A/1.2.3
|
1380
|
+
| A_BOTH_CONFIGS = default
|
1381
|
+
| A_DEFAULT = BAR
|
1382
|
+
| D_OVERRIDES_A = A
|
1383
|
+
| B_OVERRIDES_A_AND_C = A
|
1384
|
+
| A_PATH_DEFAULT = BAR:$A_PATH_DEFAULT
|
1385
|
+
| D_PATH_PREPENDS_A = A:$D_PATH_PREPENDS_A
|
1386
|
+
| B_PATH_PREPENDS_A_AND_C = A:$B_PATH_PREPENDS_A_AND_C
|
1387
|
+
| A_SET_GETS_PREPENDED_WITH_B_AND_C = A
|
1388
|
+
| A_OVERRIDES_C_PREPENDING_B = A
|
1389
|
+
| A_OVERRIDES_B_AND_C = A
|
1390
|
+
| A_OVERRIDES_D = A
|
1391
|
+
| A_PATH_PREPENDS_B_AND_C = A:$A_PATH_PREPENDS_B_AND_C
|
1392
|
+
| A_PATH_PREPENDS_D = A:$A_PATH_PREPENDS_D
|
1393
|
+
'---C/1.2.3
|
1394
|
+
| | C_DEFAULT = BAR
|
1395
|
+
| | B_OVERRIDES_C = C
|
1396
|
+
| | B_OVERRIDES_A_AND_C = C
|
1397
|
+
| | A_OVERRIDES_B_AND_C = C
|
1398
|
+
| | B_PATH_PREPENDS_A_AND_C = C:$B_PATH_PREPENDS_A_AND_C
|
1399
|
+
| | A_PATH_PREPENDS_B_AND_C = C:$A_PATH_PREPENDS_B_AND_C
|
1400
|
+
| | A_SET_GETS_PREPENDED_WITH_B_AND_C = C:$A_SET_GETS_PREPENDED_WITH_B_AND_C
|
1401
|
+
| | A_OVERRIDES_C_PREPENDING_B = C:$A_OVERRIDES_C_PREPENDING_B
|
1402
|
+
| '---D/1.2.3
|
1403
|
+
| | D_DEFAULT = BAR
|
1404
|
+
| | A_OVERRIDES_D = D
|
1405
|
+
| | D_OVERRIDES_A = D
|
1406
|
+
| | D_PATH_PREPENDS_A = D:$D_PATH_PREPENDS_A
|
1407
|
+
| | A_PATH_PREPENDS_D = D:$A_PATH_PREPENDS_D
|
1408
|
+
| '---D/1.2.3:addon_a
|
1409
|
+
| | ADDON_A = ding
|
1410
|
+
| '---D/1.2.3:addon_b
|
1411
|
+
| | | ADDON_B = dong
|
1412
|
+
| | '---E/1.2.3
|
1413
|
+
| '---D/1.2.3:addon_c
|
1414
|
+
| ADDON_C = dang
|
1415
|
+
'---B/1.2.3
|
1416
|
+
| B_DEFAULT = BAR
|
1417
|
+
| B_OVERRIDES_C = B
|
1418
|
+
| B_OVERRIDES_A_AND_C = B
|
1419
|
+
| A_OVERRIDES_B_AND_C = B
|
1420
|
+
| B_PATH_PREPENDS_A_AND_C = B:$B_PATH_PREPENDS_A_AND_C
|
1421
|
+
| A_PATH_PREPENDS_B_AND_C = B:$A_PATH_PREPENDS_B_AND_C
|
1422
|
+
| A_SET_GETS_PREPENDED_WITH_B_AND_C = B:$A_SET_GETS_PREPENDED_WITH_B_AND_C
|
1423
|
+
| A_OVERRIDES_C_PREPENDING_B = B:$A_OVERRIDES_C_PREPENDING_B
|
1424
|
+
'---D/1.2.3
|
1425
|
+
| D_DEFAULT = BAR
|
1426
|
+
| A_OVERRIDES_D = D
|
1427
|
+
| D_OVERRIDES_A = D
|
1428
|
+
| D_PATH_PREPENDS_A = D:$D_PATH_PREPENDS_A
|
1429
|
+
| A_PATH_PREPENDS_D = D:$A_PATH_PREPENDS_D
|
1430
|
+
'---D/1.2.3:addon_a
|
1431
|
+
| ADDON_A = ding
|
1432
|
+
'---D/1.2.3:addon_b
|
1433
|
+
| | ADDON_B = dong
|
1434
|
+
| '---E/1.2.3
|
1435
|
+
'---D/1.2.3:addon_c
|
1436
|
+
ADDON_C = dang
|
1437
|
+
A/1.2.3:nondefault
|
1438
|
+
| A_BOTH_CONFIGS = nondefault
|
1439
|
+
| A_NONDEFAULT = BAZ
|
1440
|
+
'---C/4.5.6:nondefault
|
1441
|
+
C_ONLY_IN_C456 = C
|
1442
|
+
END_EXPECTED_OUTPUT
|
1443
|
+
|
1444
|
+
out, err =
|
1445
|
+
fig(%w<--list-variables --list-all-configs --list-tree A/1.2.3>)
|
1446
|
+
out.should == expected
|
1447
|
+
err.should =~
|
1448
|
+
%r<No version in the package descriptor of "D" in an include statement in the \.fig file for "B/1\.2\.3:default" \(line>
|
1449
|
+
end
|
1450
|
+
|
1451
|
+
it %q<lists all dependency variables with a package.fig> do
|
1452
|
+
set_up_list_variables_packages
|
1453
|
+
create_package_dot_fig('A')
|
1454
|
+
|
1455
|
+
expected = clean_expected(<<-'END_EXPECTED_OUTPUT')
|
1456
|
+
[package.fig]
|
1457
|
+
'---A/1.2.3
|
1458
|
+
| A_BOTH_CONFIGS = default
|
1459
|
+
| A_DEFAULT = BAR
|
1460
|
+
| D_OVERRIDES_A = A
|
1461
|
+
| B_OVERRIDES_A_AND_C = A
|
1462
|
+
| A_PATH_DEFAULT = BAR:$A_PATH_DEFAULT
|
1463
|
+
| D_PATH_PREPENDS_A = A:$D_PATH_PREPENDS_A
|
1464
|
+
| B_PATH_PREPENDS_A_AND_C = A:$B_PATH_PREPENDS_A_AND_C
|
1465
|
+
| A_SET_GETS_PREPENDED_WITH_B_AND_C = A
|
1466
|
+
| A_OVERRIDES_C_PREPENDING_B = A
|
1467
|
+
| A_OVERRIDES_B_AND_C = A
|
1468
|
+
| A_OVERRIDES_D = A
|
1469
|
+
| A_PATH_PREPENDS_B_AND_C = A:$A_PATH_PREPENDS_B_AND_C
|
1470
|
+
| A_PATH_PREPENDS_D = A:$A_PATH_PREPENDS_D
|
1471
|
+
'---C/1.2.3
|
1472
|
+
| | C_DEFAULT = BAR
|
1473
|
+
| | B_OVERRIDES_C = C
|
1474
|
+
| | B_OVERRIDES_A_AND_C = C
|
1475
|
+
| | A_OVERRIDES_B_AND_C = C
|
1476
|
+
| | B_PATH_PREPENDS_A_AND_C = C:$B_PATH_PREPENDS_A_AND_C
|
1477
|
+
| | A_PATH_PREPENDS_B_AND_C = C:$A_PATH_PREPENDS_B_AND_C
|
1478
|
+
| | A_SET_GETS_PREPENDED_WITH_B_AND_C = C:$A_SET_GETS_PREPENDED_WITH_B_AND_C
|
1479
|
+
| | A_OVERRIDES_C_PREPENDING_B = C:$A_OVERRIDES_C_PREPENDING_B
|
1480
|
+
| '---D/1.2.3
|
1481
|
+
| | D_DEFAULT = BAR
|
1482
|
+
| | A_OVERRIDES_D = D
|
1483
|
+
| | D_OVERRIDES_A = D
|
1484
|
+
| | D_PATH_PREPENDS_A = D:$D_PATH_PREPENDS_A
|
1485
|
+
| | A_PATH_PREPENDS_D = D:$A_PATH_PREPENDS_D
|
1486
|
+
| '---D/1.2.3:addon_a
|
1487
|
+
| | ADDON_A = ding
|
1488
|
+
| '---D/1.2.3:addon_b
|
1489
|
+
| | | ADDON_B = dong
|
1490
|
+
| | '---E/1.2.3
|
1491
|
+
| '---D/1.2.3:addon_c
|
1492
|
+
| ADDON_C = dang
|
1493
|
+
'---B/1.2.3
|
1494
|
+
| B_DEFAULT = BAR
|
1495
|
+
| B_OVERRIDES_C = B
|
1496
|
+
| B_OVERRIDES_A_AND_C = B
|
1497
|
+
| A_OVERRIDES_B_AND_C = B
|
1498
|
+
| B_PATH_PREPENDS_A_AND_C = B:$B_PATH_PREPENDS_A_AND_C
|
1499
|
+
| A_PATH_PREPENDS_B_AND_C = B:$A_PATH_PREPENDS_B_AND_C
|
1500
|
+
| A_SET_GETS_PREPENDED_WITH_B_AND_C = B:$A_SET_GETS_PREPENDED_WITH_B_AND_C
|
1501
|
+
| A_OVERRIDES_C_PREPENDING_B = B:$A_OVERRIDES_C_PREPENDING_B
|
1502
|
+
'---D/1.2.3
|
1503
|
+
| D_DEFAULT = BAR
|
1504
|
+
| A_OVERRIDES_D = D
|
1505
|
+
| D_OVERRIDES_A = D
|
1506
|
+
| D_PATH_PREPENDS_A = D:$D_PATH_PREPENDS_A
|
1507
|
+
| A_PATH_PREPENDS_D = D:$A_PATH_PREPENDS_D
|
1508
|
+
'---D/1.2.3:addon_a
|
1509
|
+
| ADDON_A = ding
|
1510
|
+
'---D/1.2.3:addon_b
|
1511
|
+
| | ADDON_B = dong
|
1512
|
+
| '---E/1.2.3
|
1513
|
+
'---D/1.2.3:addon_c
|
1514
|
+
ADDON_C = dang
|
1515
|
+
END_EXPECTED_OUTPUT
|
1516
|
+
|
1517
|
+
out, err = fig(%w<--list-variables --list-all-configs --list-tree>)
|
1518
|
+
|
1519
|
+
out.should == expected
|
1520
|
+
err.should =~
|
1521
|
+
%r<No version in the package descriptor of "D" in an include statement in the \.fig file for "B/1\.2\.3:default" \(line>
|
1522
|
+
end
|
1523
|
+
end
|
1524
|
+
end
|
1525
|
+
|
1526
|
+
describe %q<handles "include ... override ...> do
|
1527
|
+
before(:each) do
|
1528
|
+
clean_up_test_environment
|
1529
|
+
set_up_test_environment
|
1530
|
+
set_up_packages_with_overrides
|
1531
|
+
remove_any_package_dot_fig
|
1532
|
+
end
|
1533
|
+
|
1534
|
+
it %<plain (goes through RuntimeEnvironment object)> do
|
1535
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
1536
|
+
C=4.5.6
|
1537
|
+
END_EXPECTED_OUTPUT
|
1538
|
+
|
1539
|
+
out, err = fig(%w<--list-variables A/1.2.3>)
|
1540
|
+
out.should == expected
|
1541
|
+
err.should == ''
|
1542
|
+
end
|
1543
|
+
|
1544
|
+
it %<with --list-tree (goes through PackageCache object)> do
|
1545
|
+
expected = clean_expected(<<-END_EXPECTED_OUTPUT)
|
1546
|
+
A/1.2.3
|
1547
|
+
'---B/1.2.3
|
1548
|
+
'---C/4.5.6
|
1549
|
+
| | C = 4.5.6
|
1550
|
+
| '---D/4.5.6
|
1551
|
+
'---D/4.5.6
|
1552
|
+
END_EXPECTED_OUTPUT
|
1553
|
+
|
1554
|
+
out, err = fig(%w<--list-variables --list-tree A/1.2.3>)
|
1555
|
+
out.should == expected
|
1556
|
+
err.should == ''
|
1557
|
+
end
|
1558
|
+
end
|
1559
|
+
|
1560
|
+
it %q<should complain if local repository isn't in the expected format version> do
|
1561
|
+
clean_up_test_environment
|
1562
|
+
set_up_test_environment
|
1563
|
+
set_up_packages_with_overrides
|
1564
|
+
remove_any_package_dot_fig
|
1565
|
+
set_local_repository_format_to_future_version
|
1566
|
+
|
1567
|
+
out, err, exit_code =
|
1568
|
+
fig(%w<--list-variables A/1.2.3>, :no_raise_on_error => true)
|
1569
|
+
exit_code.should_not == 0
|
1570
|
+
err.should =~
|
1571
|
+
/Local repository is in version \d+ format. This version of fig can only deal with repositories in version \d+ format\./
|
1572
|
+
end
|
1573
|
+
end
|
1574
|
+
end
|