fig 0.1.73 → 0.1.75
Sign up to get free protection for your applications and to get access to all the features.
- data/Changes +75 -0
- data/lib/fig.rb +1 -1
- data/lib/fig/command.rb +36 -12
- data/lib/fig/command/action.rb +1 -1
- data/lib/fig/command/action/dump_package_definition_parsed.rb +4 -6
- data/lib/fig/command/action/run_command_statement.rb +3 -2
- data/lib/fig/command/options.rb +12 -3
- data/lib/fig/command/options/parser.rb +2 -0
- data/lib/fig/command/package_loader.rb +1 -0
- data/lib/fig/config_file_error.rb +1 -1
- data/lib/fig/grammar/base.rb +214 -0
- data/lib/fig/grammar/base.treetop +29 -0
- data/lib/fig/grammar/v0.rb +1493 -0
- data/lib/fig/grammar/v0.treetop +167 -0
- data/lib/fig/grammar/v1.rb +1478 -0
- data/lib/fig/grammar/v1.treetop +174 -0
- data/lib/fig/grammar/version.rb +144 -0
- data/lib/fig/grammar/version.treetop +22 -0
- data/lib/fig/grammar/version_identification.rb +113 -0
- data/lib/fig/grammar/version_identification.treetop +27 -0
- data/lib/fig/log4r_config_error.rb +1 -1
- data/lib/fig/no_such_package_config_error.rb +1 -1
- data/lib/fig/not_found_error.rb +7 -0
- data/lib/fig/operating_system.rb +31 -20
- data/lib/fig/package.rb +8 -3
- data/lib/fig/package_definition_text_assembler.rb +88 -0
- data/lib/fig/package_descriptor_parse_error.rb +1 -1
- data/lib/fig/parser.rb +115 -29
- data/lib/fig/parser_package_build_state.rb +38 -11
- data/lib/fig/repository.rb +5 -8
- data/lib/fig/repository_package_publisher.rb +114 -96
- data/lib/fig/runtime_environment.rb +42 -14
- data/lib/fig/statement.rb +133 -0
- data/lib/fig/statement/archive.rb +6 -4
- data/lib/fig/statement/asset.rb +28 -34
- data/lib/fig/statement/command.rb +6 -2
- data/lib/fig/statement/configuration.rb +4 -12
- data/lib/fig/statement/grammar_version.rb +22 -0
- data/lib/fig/statement/include.rb +5 -6
- data/lib/fig/statement/override.rb +6 -3
- data/lib/fig/statement/path.rb +12 -2
- data/lib/fig/statement/resource.rb +8 -8
- data/lib/fig/statement/retrieve.rb +11 -3
- data/lib/fig/statement/set.rb +12 -2
- data/lib/fig/unparser.rb +127 -0
- data/lib/fig/unparser/v0.rb +84 -0
- data/lib/fig/unparser/v1.rb +77 -0
- data/lib/fig/url.rb +7 -0
- metadata +139 -25
- data/lib/fig/grammar.treetop +0 -147
data/Changes
CHANGED
@@ -1,3 +1,78 @@
|
|
1
|
+
v0.1.75
|
2
|
+
|
3
|
+
Backwards incompatibilities:
|
4
|
+
|
5
|
+
- Unquoted archive statements now have their values globbed if they don't
|
6
|
+
look like URLs. If you happen to have a statement like
|
7
|
+
|
8
|
+
archive some/path/foo?bar*.tar.gz
|
9
|
+
|
10
|
+
then this will match files that it did not previously find.
|
11
|
+
|
12
|
+
New features:
|
13
|
+
|
14
|
+
- Asset statements now behave identically, with the exception of the
|
15
|
+
extraction of archive statements and the path preservation of resource
|
16
|
+
statements. Previously, archives weren't globbed, i.e. you couldn't say
|
17
|
+
|
18
|
+
archive yadda/*.tar.gz
|
19
|
+
|
20
|
+
You had to specify all archives individually.
|
21
|
+
|
22
|
+
- New --run-command-statement option that allows you to run command
|
23
|
+
statements in unpublished packages. (No more need to publish to test
|
24
|
+
whether they work!) Say you have a package.fig file in the current
|
25
|
+
directory that looks like
|
26
|
+
|
27
|
+
config default
|
28
|
+
command "echo hello!"
|
29
|
+
end
|
30
|
+
|
31
|
+
If you just run "fig", it still says that there's nothing to do, but it
|
32
|
+
additionally warns you about the situation. You can get non-default
|
33
|
+
commands to run using the --config option, e.g. "fig
|
34
|
+
--run-command-statement --config run-chrome":
|
35
|
+
|
36
|
+
config run-chrome
|
37
|
+
command "chrome ..."
|
38
|
+
end
|
39
|
+
|
40
|
+
- New grammar statement to allow for future expansion. Syntax:
|
41
|
+
|
42
|
+
grammar v<number>
|
43
|
+
|
44
|
+
This statement is only valid as the first statement in a package
|
45
|
+
definition. In other words
|
46
|
+
|
47
|
+
grammar v0
|
48
|
+
config default
|
49
|
+
end
|
50
|
+
|
51
|
+
is valid, but
|
52
|
+
|
53
|
+
config default
|
54
|
+
end
|
55
|
+
grammar v0
|
56
|
+
|
57
|
+
is not. The only valid version right now is 0, but this means that we can
|
58
|
+
change the syntax in the future without breaking any existing packages.
|
59
|
+
|
60
|
+
Note that this statement will be emitted for all published packages, but
|
61
|
+
will be commented out so that older versions of Fig can still read them.
|
62
|
+
For example, the significant parts of the package definition generated by
|
63
|
+
"fig --publish foo/5 --set variable=value" are:
|
64
|
+
|
65
|
+
# grammar v0
|
66
|
+
config default
|
67
|
+
set variable=value
|
68
|
+
end
|
69
|
+
|
70
|
+
v0.1.74.beta.3
|
71
|
+
v0.1.74.beta.2
|
72
|
+
v0.1.74.beta.1
|
73
|
+
|
74
|
+
- Test releases
|
75
|
+
|
1
76
|
v0.1.73
|
2
77
|
|
3
78
|
Backwards incompatibilities:
|
data/lib/fig.rb
CHANGED
data/lib/fig/command.rb
CHANGED
@@ -37,11 +37,11 @@ class Fig::Command
|
|
37
37
|
return @options.exit_code
|
38
38
|
end
|
39
39
|
|
40
|
+
Fig::Logging.initialize_pre_configuration(@options.log_level())
|
41
|
+
|
40
42
|
actions = @options.actions()
|
41
43
|
if actions.empty?
|
42
|
-
|
43
|
-
$stderr.puts %q<Run "fig --help" for a full list of commands.>
|
44
|
-
return Fig::Command::Action::EXIT_FAILURE
|
44
|
+
return handle_nothing_to_do
|
45
45
|
end
|
46
46
|
|
47
47
|
actions.each do
|
@@ -53,8 +53,6 @@ class Fig::Command
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
Fig::Logging.initialize_pre_configuration(@options.log_level())
|
57
|
-
|
58
56
|
@descriptor = @options.descriptor
|
59
57
|
check_descriptor_requirement()
|
60
58
|
if actions.any? {|action| not action.allow_both_descriptor_and_file? }
|
@@ -133,6 +131,26 @@ class Fig::Command
|
|
133
131
|
:package_source_description
|
134
132
|
)
|
135
133
|
|
134
|
+
def handle_nothing_to_do()
|
135
|
+
command_statement = nil
|
136
|
+
if ! @descriptor && @options.package_definition_file != :none
|
137
|
+
load_base_package()
|
138
|
+
config = base_config
|
139
|
+
command_statement = @base_package[config].command_statement
|
140
|
+
end
|
141
|
+
|
142
|
+
$stderr.puts "Nothing to do.\n\n"
|
143
|
+
|
144
|
+
if command_statement
|
145
|
+
$stderr.puts \
|
146
|
+
%Q<You have a command statement in the "#{config}" config. If you want to run it, use the "--run-command-statement" option.\n\n>
|
147
|
+
end
|
148
|
+
|
149
|
+
$stderr.puts %q<Run "fig --help" for a full list of commands.>
|
150
|
+
|
151
|
+
return Fig::Command::Action::EXIT_FAILURE
|
152
|
+
end
|
153
|
+
|
136
154
|
def check_include_statements_versions?()
|
137
155
|
return false if @options.suppress_warning_include_statement_missing_version?
|
138
156
|
|
@@ -248,13 +266,7 @@ class Fig::Command
|
|
248
266
|
apply_config = apply_config?
|
249
267
|
apply_base_config = apply_config ? apply_base_config? : nil
|
250
268
|
|
251
|
-
|
252
|
-
if @options.actions.all? {|action| action.base_package_can_come_from_descriptor?}
|
253
|
-
@base_package = package_loader.load_package_object()
|
254
|
-
else
|
255
|
-
@base_package = package_loader.load_package_object_from_file()
|
256
|
-
end
|
257
|
-
@package_source_description = package_loader.package_source_description()
|
269
|
+
load_base_package()
|
258
270
|
|
259
271
|
applier = new_package_applier()
|
260
272
|
|
@@ -271,6 +283,18 @@ class Fig::Command
|
|
271
283
|
return
|
272
284
|
end
|
273
285
|
|
286
|
+
def load_base_package()
|
287
|
+
package_loader = new_package_loader()
|
288
|
+
if @options.actions.all? {|action| action.base_package_can_come_from_descriptor?}
|
289
|
+
@base_package = package_loader.load_package_object()
|
290
|
+
else
|
291
|
+
@base_package = package_loader.load_package_object_from_file()
|
292
|
+
end
|
293
|
+
@package_source_description = package_loader.package_source_description()
|
294
|
+
|
295
|
+
return
|
296
|
+
end
|
297
|
+
|
274
298
|
def invoke_post_set_up_actions()
|
275
299
|
@post_set_up_actions.each do
|
276
300
|
|action|
|
data/lib/fig/command/action.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'fig/command/action'
|
2
2
|
require 'fig/command/action/role/has_no_sub_action'
|
3
|
+
require 'fig/unparser/v0'
|
3
4
|
|
4
5
|
module Fig; end
|
5
6
|
class Fig::Command; end
|
@@ -34,13 +35,10 @@ class Fig::Command::Action::DumpPackageDefinitionParsed
|
|
34
35
|
end
|
35
36
|
|
36
37
|
def execute()
|
37
|
-
|
38
|
-
|
38
|
+
unparser = Fig::Unparser::V0.new :emit_as_to_be_published
|
39
|
+
text = unparser.unparse(@execution_context.base_package.statements)
|
39
40
|
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
print lines.join("\n").strip
|
41
|
+
print text.gsub(/\n{3,}/, "\n\n").strip
|
44
42
|
|
45
43
|
return EXIT_SUCCESS
|
46
44
|
end
|
@@ -14,7 +14,7 @@ class Fig::Command::Action::RunCommandStatement
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def descriptor_requirement()
|
17
|
-
return
|
17
|
+
return nil
|
18
18
|
end
|
19
19
|
|
20
20
|
def modifies_repository?()
|
@@ -47,9 +47,10 @@ class Fig::Command::Action::RunCommandStatement
|
|
47
47
|
def execute()
|
48
48
|
environment = @execution_context.environment
|
49
49
|
base_package = @execution_context.base_package
|
50
|
+
base_config = @execution_context.base_config
|
50
51
|
|
51
52
|
environment.execute_config(
|
52
|
-
base_package, @descriptor, @extra_argv || []
|
53
|
+
base_package, base_config, @descriptor, @extra_argv || []
|
53
54
|
) { |command| @execution_context.operating_system.shell_exec command }
|
54
55
|
|
55
56
|
return EXIT_SUCCESS
|
data/lib/fig/command/options.rb
CHANGED
@@ -299,6 +299,12 @@ class Fig::Command::Options
|
|
299
299
|
set_base_action(Fig::Command::Action::Clean)
|
300
300
|
end
|
301
301
|
|
302
|
+
@parser.on(
|
303
|
+
'--run-command-statement', 'run the command in even in local file'
|
304
|
+
) do
|
305
|
+
set_base_action(Fig::Command::Action::RunCommandStatement)
|
306
|
+
end
|
307
|
+
|
302
308
|
@parser.on(
|
303
309
|
'--publish', 'install package in $FIG_HOME and in remote repo'
|
304
310
|
) do |publish|
|
@@ -544,7 +550,10 @@ class Fig::Command::Options
|
|
544
550
|
return
|
545
551
|
end
|
546
552
|
|
547
|
-
|
553
|
+
if @base_action
|
554
|
+
return if @base_action.class == Fig::Command::Action::Help
|
555
|
+
return if @base_action.class == action_class
|
556
|
+
end
|
548
557
|
|
549
558
|
if @base_action
|
550
559
|
raise Fig::Command::OptionError.new(
|
@@ -577,13 +586,13 @@ class Fig::Command::Options
|
|
577
586
|
end
|
578
587
|
|
579
588
|
def new_content_statement(option, path, statement_class)
|
580
|
-
statement_class.
|
589
|
+
need_to_glob = statement_class.validate_and_process_escapes_in_url!(path) {
|
581
590
|
|error_description|
|
582
591
|
|
583
592
|
@parser.raise_invalid_argument(option, path, error_description)
|
584
593
|
}
|
585
594
|
|
586
|
-
return statement_class.new(nil, "#{option} option", path)
|
595
|
+
return statement_class.new(nil, "#{option} option", path, need_to_glob)
|
587
596
|
end
|
588
597
|
|
589
598
|
def set_up_sub_actions()
|
@@ -16,6 +16,7 @@ Short usage summary (use --help-long for everything):
|
|
16
16
|
Running under Fig:
|
17
17
|
fig [...] [DESCRIPTOR] [-- COMMAND]
|
18
18
|
fig [...] [DESCRIPTOR] --command-extra-args VALUES
|
19
|
+
fig [...] [DESCRIPTOR] --run-command-statement
|
19
20
|
|
20
21
|
Querying:
|
21
22
|
fig {-g | --get} VARIABLE [DESCRIPTOR] [...]
|
@@ -42,6 +43,7 @@ Running under Fig:
|
|
42
43
|
|
43
44
|
fig [...] [DESCRIPTOR] [-- COMMAND]
|
44
45
|
fig [...] [DESCRIPTOR] --command-extra-args VALUES
|
46
|
+
fig [...] [DESCRIPTOR] --run-command-statement
|
45
47
|
|
46
48
|
Querying:
|
47
49
|
|
@@ -0,0 +1,214 @@
|
|
1
|
+
# Autogenerated from a Treetop grammar. Edits may be lost.
|
2
|
+
|
3
|
+
|
4
|
+
# Treetop (http://treetop.rubyforge.org/) grammar for common definitions.
|
5
|
+
|
6
|
+
require 'treetop'
|
7
|
+
|
8
|
+
module Fig
|
9
|
+
module Grammar
|
10
|
+
module Base
|
11
|
+
include Treetop::Runtime
|
12
|
+
|
13
|
+
def root
|
14
|
+
@root ||= :ws
|
15
|
+
end
|
16
|
+
|
17
|
+
def _nt_ws
|
18
|
+
start_index = index
|
19
|
+
if node_cache[:ws].has_key?(index)
|
20
|
+
cached = node_cache[:ws][index]
|
21
|
+
if cached
|
22
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
23
|
+
@index = cached.interval.end
|
24
|
+
end
|
25
|
+
return cached
|
26
|
+
end
|
27
|
+
|
28
|
+
s0, i0 = [], index
|
29
|
+
loop do
|
30
|
+
if has_terminal?('\G[ \\n\\r\\t]', true, index)
|
31
|
+
r1 = true
|
32
|
+
@index += 1
|
33
|
+
else
|
34
|
+
r1 = nil
|
35
|
+
end
|
36
|
+
if r1
|
37
|
+
s0 << r1
|
38
|
+
else
|
39
|
+
break
|
40
|
+
end
|
41
|
+
end
|
42
|
+
if s0.empty?
|
43
|
+
@index = i0
|
44
|
+
r0 = nil
|
45
|
+
else
|
46
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
47
|
+
end
|
48
|
+
|
49
|
+
node_cache[:ws][start_index] = r0
|
50
|
+
|
51
|
+
r0
|
52
|
+
end
|
53
|
+
|
54
|
+
def _nt_optional_ws
|
55
|
+
start_index = index
|
56
|
+
if node_cache[:optional_ws].has_key?(index)
|
57
|
+
cached = node_cache[:optional_ws][index]
|
58
|
+
if cached
|
59
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
60
|
+
@index = cached.interval.end
|
61
|
+
end
|
62
|
+
return cached
|
63
|
+
end
|
64
|
+
|
65
|
+
s0, i0 = [], index
|
66
|
+
loop do
|
67
|
+
if has_terminal?('\G[ \\n\\r\\t]', true, index)
|
68
|
+
r1 = true
|
69
|
+
@index += 1
|
70
|
+
else
|
71
|
+
r1 = nil
|
72
|
+
end
|
73
|
+
if r1
|
74
|
+
s0 << r1
|
75
|
+
else
|
76
|
+
break
|
77
|
+
end
|
78
|
+
end
|
79
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
80
|
+
|
81
|
+
node_cache[:optional_ws][start_index] = r0
|
82
|
+
|
83
|
+
r0
|
84
|
+
end
|
85
|
+
|
86
|
+
module Comment0
|
87
|
+
end
|
88
|
+
|
89
|
+
def _nt_comment
|
90
|
+
start_index = index
|
91
|
+
if node_cache[:comment].has_key?(index)
|
92
|
+
cached = node_cache[:comment][index]
|
93
|
+
if cached
|
94
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
95
|
+
@index = cached.interval.end
|
96
|
+
end
|
97
|
+
return cached
|
98
|
+
end
|
99
|
+
|
100
|
+
i0, s0 = index, []
|
101
|
+
if has_terminal?('#', false, index)
|
102
|
+
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
103
|
+
@index += 1
|
104
|
+
else
|
105
|
+
terminal_parse_failure('#')
|
106
|
+
r1 = nil
|
107
|
+
end
|
108
|
+
s0 << r1
|
109
|
+
if r1
|
110
|
+
s2, i2 = [], index
|
111
|
+
loop do
|
112
|
+
if has_terminal?('\G[^\\n]', true, index)
|
113
|
+
r3 = true
|
114
|
+
@index += 1
|
115
|
+
else
|
116
|
+
r3 = nil
|
117
|
+
end
|
118
|
+
if r3
|
119
|
+
s2 << r3
|
120
|
+
else
|
121
|
+
break
|
122
|
+
end
|
123
|
+
end
|
124
|
+
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
|
125
|
+
s0 << r2
|
126
|
+
if r2
|
127
|
+
if has_terminal?("\n", false, index)
|
128
|
+
r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
|
129
|
+
@index += 1
|
130
|
+
else
|
131
|
+
terminal_parse_failure("\n")
|
132
|
+
r4 = nil
|
133
|
+
end
|
134
|
+
s0 << r4
|
135
|
+
end
|
136
|
+
end
|
137
|
+
if s0.last
|
138
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
139
|
+
r0.extend(Comment0)
|
140
|
+
else
|
141
|
+
@index = i0
|
142
|
+
r0 = nil
|
143
|
+
end
|
144
|
+
|
145
|
+
node_cache[:comment][start_index] = r0
|
146
|
+
|
147
|
+
r0
|
148
|
+
end
|
149
|
+
|
150
|
+
def _nt_ws_or_comment
|
151
|
+
start_index = index
|
152
|
+
if node_cache[:ws_or_comment].has_key?(index)
|
153
|
+
cached = node_cache[:ws_or_comment][index]
|
154
|
+
if cached
|
155
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
156
|
+
@index = cached.interval.end
|
157
|
+
end
|
158
|
+
return cached
|
159
|
+
end
|
160
|
+
|
161
|
+
i0 = index
|
162
|
+
r1 = _nt_ws
|
163
|
+
if r1
|
164
|
+
r0 = r1
|
165
|
+
else
|
166
|
+
r2 = _nt_comment
|
167
|
+
if r2
|
168
|
+
r0 = r2
|
169
|
+
else
|
170
|
+
@index = i0
|
171
|
+
r0 = nil
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
node_cache[:ws_or_comment][start_index] = r0
|
176
|
+
|
177
|
+
r0
|
178
|
+
end
|
179
|
+
|
180
|
+
def _nt_optional_ws_or_comment
|
181
|
+
start_index = index
|
182
|
+
if node_cache[:optional_ws_or_comment].has_key?(index)
|
183
|
+
cached = node_cache[:optional_ws_or_comment][index]
|
184
|
+
if cached
|
185
|
+
cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
|
186
|
+
@index = cached.interval.end
|
187
|
+
end
|
188
|
+
return cached
|
189
|
+
end
|
190
|
+
|
191
|
+
s0, i0 = [], index
|
192
|
+
loop do
|
193
|
+
r1 = _nt_ws_or_comment
|
194
|
+
if r1
|
195
|
+
s0 << r1
|
196
|
+
else
|
197
|
+
break
|
198
|
+
end
|
199
|
+
end
|
200
|
+
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
|
201
|
+
|
202
|
+
node_cache[:optional_ws_or_comment][start_index] = r0
|
203
|
+
|
204
|
+
r0
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
class BaseParser < Treetop::Runtime::CompiledParser
|
210
|
+
include Base
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
end
|