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,203 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
4
|
+
|
5
|
+
require 'fig/statement/archive'
|
6
|
+
require 'fig/statement/resource'
|
7
|
+
|
8
|
+
[Fig::Statement::Archive, Fig::Statement::Resource].each do
|
9
|
+
|statement_type|
|
10
|
+
|
11
|
+
describe statement_type do
|
12
|
+
describe '.validate_and_process_escapes_in_location()' do
|
13
|
+
def test_should_equal_and_should_glob(
|
14
|
+
statement_type, original_location, location
|
15
|
+
)
|
16
|
+
block_message = nil
|
17
|
+
location = location.clone
|
18
|
+
|
19
|
+
tokenized_location =
|
20
|
+
statement_type.validate_and_process_escapes_in_location(location) do
|
21
|
+
|message| block_message = message
|
22
|
+
end
|
23
|
+
|
24
|
+
block_message.should be_nil
|
25
|
+
|
26
|
+
location = tokenized_location.to_expanded_string
|
27
|
+
need_to_glob = ! tokenized_location.single_quoted?
|
28
|
+
|
29
|
+
location.should == original_location
|
30
|
+
need_to_glob.should be true
|
31
|
+
|
32
|
+
return
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_should_equal_and_should_not_glob(
|
36
|
+
statement_type, original_location, location
|
37
|
+
)
|
38
|
+
block_message = nil
|
39
|
+
location = location.clone
|
40
|
+
|
41
|
+
tokenized_location =
|
42
|
+
statement_type.validate_and_process_escapes_in_location(location) do
|
43
|
+
|message| block_message = message
|
44
|
+
end
|
45
|
+
|
46
|
+
location = tokenized_location.to_expanded_string
|
47
|
+
need_to_glob = ! tokenized_location.single_quoted?
|
48
|
+
|
49
|
+
block_message.should be_nil
|
50
|
+
location.should == original_location
|
51
|
+
need_to_glob.should be false
|
52
|
+
|
53
|
+
return
|
54
|
+
end
|
55
|
+
|
56
|
+
# "foo * bar": whitespace and glob character
|
57
|
+
[%q<foo * bar>].each do
|
58
|
+
|original_location|
|
59
|
+
|
60
|
+
it %Q<does not modify «#{original_location}» and says that it should be globbed> do
|
61
|
+
test_should_equal_and_should_glob(
|
62
|
+
statement_type, original_location, original_location
|
63
|
+
)
|
64
|
+
end
|
65
|
+
it %Q<strips quotes from «"#{original_location}"» and says that it should be globbed> do
|
66
|
+
test_should_equal_and_should_glob(
|
67
|
+
statement_type, original_location, %Q<"#{original_location}">
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
it %Q<strips quotes from «'#{original_location}'» and says that it should not be globbed> do
|
72
|
+
test_should_equal_and_should_not_glob(
|
73
|
+
statement_type, original_location, %Q<'#{original_location}'>
|
74
|
+
)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
%w< \\ ' >.each do
|
79
|
+
|character|
|
80
|
+
|
81
|
+
escaped_location = %Q<foo \\#{character} bar>
|
82
|
+
unescaped_location = %Q<foo #{character} bar>
|
83
|
+
it %Q<processes escapes from «'#{escaped_location}'» and says that it should not be globbed> do
|
84
|
+
test_should_equal_and_should_not_glob(
|
85
|
+
statement_type, unescaped_location, %Q<'#{escaped_location}'>
|
86
|
+
)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
%w< \\ " >.each do
|
91
|
+
|character|
|
92
|
+
|
93
|
+
escaped_location = %Q<foo \\#{character} bar>
|
94
|
+
unescaped_location = %Q<foo #{character} bar>
|
95
|
+
it %Q<processes escapes from «#{escaped_location}» and says that it should be globbed> do
|
96
|
+
test_should_equal_and_should_glob(
|
97
|
+
statement_type, unescaped_location, escaped_location
|
98
|
+
)
|
99
|
+
end
|
100
|
+
it %Q<processes escapes from «"#{escaped_location}"» and says that it should be globbed> do
|
101
|
+
test_should_equal_and_should_glob(
|
102
|
+
statement_type, unescaped_location, %Q<"#{escaped_location}">
|
103
|
+
)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_got_error_message(statement_type, location, error_regex)
|
108
|
+
block_message = nil
|
109
|
+
|
110
|
+
statement_type.validate_and_process_escapes_in_location(location.dup) do
|
111
|
+
|message| block_message = message
|
112
|
+
end
|
113
|
+
|
114
|
+
block_message.should =~ error_regex
|
115
|
+
|
116
|
+
return
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_contains_bad_escape(statement_type, location)
|
120
|
+
test_got_error_message(
|
121
|
+
statement_type, location, /contains a bad escape sequence/i
|
122
|
+
)
|
123
|
+
|
124
|
+
return
|
125
|
+
end
|
126
|
+
|
127
|
+
%w< @ " >.each do
|
128
|
+
|character|
|
129
|
+
|
130
|
+
it %Q<says «'foo \\#{character} bar'» isn't allowed> do
|
131
|
+
test_contains_bad_escape(statement_type, %Q<'foo \\#{character} bar'>)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
%w< ' 'xxx xxx' '\' '\\ >.each do
|
136
|
+
|location|
|
137
|
+
|
138
|
+
it %Q<says «#{location}» has unbalanced quotes> do
|
139
|
+
test_got_error_message(
|
140
|
+
statement_type, location, /has unbalanced single quotes/i
|
141
|
+
)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
%w< " "xxx xxx" "\" "\\ >.each do
|
146
|
+
|location|
|
147
|
+
|
148
|
+
it %Q<says «#{location}» has unbalanced quotes> do
|
149
|
+
test_got_error_message(
|
150
|
+
statement_type, location, /has unbalanced double quotes/i
|
151
|
+
)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
%w< xxx'xxx xxx"xxx >.each do
|
156
|
+
|location|
|
157
|
+
|
158
|
+
it %Q<says «#{location}» has unescaped quote> do
|
159
|
+
test_got_error_message(
|
160
|
+
statement_type, location, /unescaped .* quote/i
|
161
|
+
)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
%w< \\ xxx\\ >.each do
|
166
|
+
|location|
|
167
|
+
|
168
|
+
it %Q<says «#{location}» has incomplete escape> do
|
169
|
+
test_got_error_message(statement_type, location, /incomplete escape/i)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
%w< \\n '\\n' "\\n" >.each do
|
174
|
+
|location|
|
175
|
+
|
176
|
+
it %Q<says «#{location}» has bad escape> do
|
177
|
+
test_got_error_message(statement_type, location, /bad escape/i)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
%w<
|
182
|
+
foo\\\\\\\\bar\\\\baz 'foo\\\\\\\\bar\\\\baz' "foo\\\\\\\\bar\\\\baz"
|
183
|
+
>.each do
|
184
|
+
|original_location|
|
185
|
+
|
186
|
+
it %Q<collapses the backslashes in «#{original_location}»> do
|
187
|
+
location = original_location.clone
|
188
|
+
block_message = nil
|
189
|
+
|
190
|
+
tokenized_location =
|
191
|
+
statement_type.validate_and_process_escapes_in_location(location) do
|
192
|
+
|message| block_message = message
|
193
|
+
end
|
194
|
+
|
195
|
+
tokenized_location.to_expanded_string == 'foo\\\\bar\\baz'
|
196
|
+
block_message.should be_nil
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
# vim: set fileencoding=utf8 :
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
4
|
+
|
5
|
+
require 'fig/statement/command'
|
6
|
+
require 'fig/statement/configuration'
|
7
|
+
require 'fig/statement/include'
|
8
|
+
require 'fig/statement/override'
|
9
|
+
require 'fig/statement/path'
|
10
|
+
require 'fig/statement/set'
|
11
|
+
require 'fig/statement/synthetic_raw_text'
|
12
|
+
|
13
|
+
describe 'Statement::Configuration' do
|
14
|
+
it 'moves override statements to the front of the set of statements' do
|
15
|
+
override_c = Fig::Statement::Override.new(nil, nil, 'C', 'version')
|
16
|
+
override_b = Fig::Statement::Override.new(nil, nil, 'B', 'version')
|
17
|
+
override_a = Fig::Statement::Override.new(nil, nil, 'A', 'version')
|
18
|
+
|
19
|
+
command = Fig::Statement::Command.new(nil, nil, %w< something to run >)
|
20
|
+
incorporate = Fig::Statement::Include.new(nil, nil, nil, nil, nil)
|
21
|
+
|
22
|
+
parsed_name, parsed_value =
|
23
|
+
Fig::Statement::Path.parse_name_value 'name=value'
|
24
|
+
path = Fig::Statement::Path.new(nil, nil, parsed_name, parsed_value)
|
25
|
+
set = Fig::Statement::Set.new(nil, nil, parsed_name, parsed_value)
|
26
|
+
|
27
|
+
config = Fig::Statement::Configuration.new(
|
28
|
+
nil,
|
29
|
+
nil,
|
30
|
+
'name',
|
31
|
+
[command, override_c, incorporate, override_b, path, override_a, set]
|
32
|
+
)
|
33
|
+
|
34
|
+
statements_to_be_checked =
|
35
|
+
config.statements.reject {
|
36
|
+
|statement| statement.is_a? Fig::Statement::SyntheticRawText
|
37
|
+
}
|
38
|
+
statements_to_be_checked.should ==
|
39
|
+
[override_c, override_b, override_a, command, incorporate, path, set]
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
4
|
+
|
5
|
+
require 'fig/operating_system'
|
6
|
+
require 'fig/working_directory_maintainer'
|
7
|
+
|
8
|
+
describe 'WorkingDirectoryMaintainer' do
|
9
|
+
let(:base_directory) { "#{CURRENT_DIRECTORY}/retrieve-test" }
|
10
|
+
let(:working_directory) { "#{base_directory}/working" }
|
11
|
+
let(:source_directory) { "#{base_directory}/source" }
|
12
|
+
|
13
|
+
def new_maintainer
|
14
|
+
return Fig::WorkingDirectoryMaintainer.new(
|
15
|
+
working_directory, Fig::OperatingSystem.macos?,
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
before(:each) do
|
20
|
+
clean_up_test_environment
|
21
|
+
set_up_test_environment
|
22
|
+
|
23
|
+
[working_directory, source_directory].each do
|
24
|
+
|directory|
|
25
|
+
|
26
|
+
FileUtils.rm_rf(directory)
|
27
|
+
FileUtils.mkdir_p(directory)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'maintains files for a single package' do
|
32
|
+
# Set up some test files
|
33
|
+
source_foo = "#{source_directory}/foo.txt"
|
34
|
+
source_bar = "#{source_directory}/bar.txt"
|
35
|
+
source_baz = "#{source_directory}/baz.txt"
|
36
|
+
File.open(source_foo, 'w') {|f| f << 'FOO'}
|
37
|
+
File.open(source_bar, 'w') {|f| f << 'BAR'}
|
38
|
+
File.open(source_baz, 'w') {|f| f << 'BAZ'}
|
39
|
+
|
40
|
+
working_foo = File.join(working_directory, 'foo.txt')
|
41
|
+
working_bar = File.join(working_directory, 'bar.txt')
|
42
|
+
working_baz = File.join(working_directory, 'baz.txt')
|
43
|
+
|
44
|
+
# Retrieve files A and B
|
45
|
+
maintainer = new_maintainer
|
46
|
+
maintainer.switch_to_package_version('foo', '1.2.3')
|
47
|
+
maintainer.retrieve(source_foo, 'foo.txt')
|
48
|
+
maintainer.retrieve(source_bar, 'bar.txt')
|
49
|
+
File.read(working_foo).should == 'FOO'
|
50
|
+
File.read(working_bar).should == 'BAR'
|
51
|
+
|
52
|
+
# Retrieve files B and C for a different version
|
53
|
+
maintainer.switch_to_package_version('foo', '4.5.6')
|
54
|
+
maintainer.retrieve(source_bar, 'bar.txt')
|
55
|
+
maintainer.retrieve(source_baz, 'baz.txt')
|
56
|
+
File.read(working_bar).should == 'BAR'
|
57
|
+
File.read(working_baz).should == 'BAZ'
|
58
|
+
File.exist?(working_foo).should == false
|
59
|
+
|
60
|
+
# Save and reload
|
61
|
+
maintainer.prepare_for_shutdown(:purged_unused_packages)
|
62
|
+
maintainer = new_maintainer
|
63
|
+
|
64
|
+
# Switch back to original version
|
65
|
+
maintainer.switch_to_package_version('foo', '1.2.3')
|
66
|
+
maintainer.retrieve(source_foo, 'foo.txt')
|
67
|
+
maintainer.retrieve(source_bar, 'bar.txt')
|
68
|
+
|
69
|
+
File.read(working_foo).should == 'FOO'
|
70
|
+
File.read(working_bar).should == 'BAR'
|
71
|
+
File.exist?(working_baz).should == false
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'preserves executable bit' do
|
75
|
+
File.open("#{source_directory}/plain", 'w') {|f| f << 'plain'}
|
76
|
+
File.open("#{source_directory}/executable", 'w') {|f| f << 'executable.exe'}
|
77
|
+
FileUtils.chmod(0755, "#{source_directory}/executable")
|
78
|
+
|
79
|
+
maintainer = new_maintainer
|
80
|
+
maintainer.switch_to_package_version('foo', '1.2.3')
|
81
|
+
maintainer.retrieve("#{source_directory}/plain", 'plain')
|
82
|
+
maintainer.retrieve("#{source_directory}/executable", 'executable.exe')
|
83
|
+
|
84
|
+
File.stat(File.join(working_directory, 'plain')).executable?.should == false
|
85
|
+
File.stat(File.join(working_directory, 'executable.exe')).executable?.should == true
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'fails on corrupted metadata' do
|
89
|
+
FileUtils.mkdir_p("#{working_directory}/.fig")
|
90
|
+
|
91
|
+
metadata_file = "#{working_directory}/.fig/retrieve"
|
92
|
+
IO.write(metadata_file, 'random garbage')
|
93
|
+
|
94
|
+
expect { new_maintainer }.to raise_error(/parse error/)
|
95
|
+
|
96
|
+
# This is so much fun. It appears that once we've had a file open within
|
97
|
+
# this process, we cannot delete that file, i.e. "File.rm(metadata_file)"
|
98
|
+
# results in an EACCESS on Windows. So, in lieu of removing the file, we
|
99
|
+
# just make it empty.
|
100
|
+
IO.write(metadata_file, '')
|
101
|
+
end
|
102
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.pre.alpha.
|
4
|
+
version: 2.0.0.pre.alpha.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fig Folks
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-08-20 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bcrypt_pbkdf
|
@@ -306,7 +306,7 @@ dependencies:
|
|
306
306
|
description: |-
|
307
307
|
Fig is a utility for configuring environments and managing dependencies across a team of developers. Given a list of packages and a command to run, Fig builds environment variables named in those packages (e.g., CLASSPATH), then executes the command in that environment. The caller's environment is not affected.
|
308
308
|
|
309
|
-
Built from git SHA1:
|
309
|
+
Built from git SHA1: ac8e555-dirty
|
310
310
|
email: maintainer@figpackagemanager.org
|
311
311
|
executables:
|
312
312
|
- fig
|
@@ -448,6 +448,7 @@ files:
|
|
448
448
|
- lib/fig/repository_error.rb
|
449
449
|
- lib/fig/repository_package_publisher.rb
|
450
450
|
- lib/fig/runtime_environment.rb
|
451
|
+
- lib/fig/spec_utils.rb
|
451
452
|
- lib/fig/statement.rb
|
452
453
|
- lib/fig/statement/archive.rb
|
453
454
|
- lib/fig/statement/asset.rb
|
@@ -475,10 +476,46 @@ files:
|
|
475
476
|
- lib/fig/working_directory_maintainer.rb
|
476
477
|
- lib/fig/working_directory_metadata.rb
|
477
478
|
- lib/git_helper.rb
|
479
|
+
- spec/application_configuration_spec.rb
|
480
|
+
- spec/command/clean_spec.rb
|
481
|
+
- spec/command/command_line_vs_package_spec.rb
|
482
|
+
- spec/command/dump_package_definition_spec.rb
|
483
|
+
- spec/command/environment_variables_spec.rb
|
484
|
+
- spec/command/grammar_asset_spec.rb
|
485
|
+
- spec/command/grammar_command_spec.rb
|
486
|
+
- spec/command/grammar_environment_variable_spec.rb
|
487
|
+
- spec/command/grammar_retrieve_spec.rb
|
488
|
+
- spec/command/grammar_spec.rb
|
489
|
+
- spec/command/grammar_spec_helper.rb
|
490
|
+
- spec/command/include_file_spec.rb
|
491
|
+
- spec/command/listing_spec.rb
|
492
|
+
- spec/command/miscellaneous_spec.rb
|
493
|
+
- spec/command/publish_local_and_updates_spec.rb
|
494
|
+
- spec/command/publishing_retrieval_spec.rb
|
495
|
+
- spec/command/publishing_spec.rb
|
496
|
+
- spec/command/running_commands_spec.rb
|
497
|
+
- spec/command/suppress_includes_spec.rb
|
498
|
+
- spec/command/suppress_warning_include_statement_missing_version_spec.rb
|
499
|
+
- spec/command/update_lock_response_spec.rb
|
500
|
+
- spec/command/usage_errors_spec.rb
|
501
|
+
- spec/command_options_spec.rb
|
502
|
+
- spec/command_spec.rb
|
503
|
+
- spec/deparser/v1_spec.rb
|
504
|
+
- spec/environment_variables_spec.rb
|
505
|
+
- spec/figrc_spec.rb
|
506
|
+
- spec/parser_spec.rb
|
507
|
+
- spec/repository_spec.rb
|
508
|
+
- spec/runtime_environment_spec.rb
|
509
|
+
- spec/spec_helper.rb
|
510
|
+
- spec/split_repo_url_spec.rb
|
511
|
+
- spec/statement/asset_spec.rb
|
512
|
+
- spec/statement/configuration_spec.rb
|
513
|
+
- spec/support/formatters/seed_spitter.rb
|
514
|
+
- spec/working_directory_maintainer_spec.rb
|
478
515
|
licenses:
|
479
516
|
- BSD-3-Clause
|
480
517
|
metadata:
|
481
|
-
git_sha:
|
518
|
+
git_sha: ac8e555-dirty
|
482
519
|
rdoc_options: []
|
483
520
|
require_paths:
|
484
521
|
- lib
|
@@ -496,5 +533,5 @@ requirements: []
|
|
496
533
|
rubygems_version: 3.6.1
|
497
534
|
specification_version: 4
|
498
535
|
summary: 'Utility for configuring environments and managing dependencies across a
|
499
|
-
team of developers. Built from git SHA1:
|
536
|
+
team of developers. Built from git SHA1: ac8e555-dirty'
|
500
537
|
test_files: []
|