dgd-tools 0.1.8 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d608eb777e5e4e39c2d9e08175876de2b7a47f8fc20b775692165d8c46dcd3cd
4
- data.tar.gz: c4a833c253ac5c8c191f5d288ae30b3bcb4301371940e524ccd34ce219163f3a
3
+ metadata.gz: '09795a79f0f25997d2d403b58dd2b0c0dc9142bbfac33a4ca4e5e50fc1f67a05'
4
+ data.tar.gz: c5c514b79bd5a14ae6b07812dd2b179cf11224d84fa31816aada17e23721221b
5
5
  SHA512:
6
- metadata.gz: c107d368ef11e8742dcb024194bfb1b13ff916d1572589a0adee3ca263618e56eaed34f407f611e175e0332a7591d4ed1d0de6b2fa624c714c4680669ac84769
7
- data.tar.gz: 66adf5b5c678361e47ae5dac4d706cabeec768de2b50ff021cb101e2ec008d6fa18a39f567e3617272250240c9c9bab32da50d423397d8ab9064ef2fb6d4f448
6
+ metadata.gz: e3c114b8dd4397999651767d0b3a314aa0c482a54490076ad3ee20857eef8a091cdf7870ba4c661480f2033ffd298fbba171e803b56dcc04a7713448c9854000
7
+ data.tar.gz: 55d832529241bbc7f8154757ec93f8e7e0472d09a8d9a4144573bbb80216cfca87a372b939c52f1573f8f687b03c8f4c8567f0342b3cab8e6aac04888eb301d3
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dgd-tools (0.1.8)
4
+ dgd-tools (0.1.11)
5
5
  nokogiri (~> 1.10.5)
6
6
  optimist (~> 3.0.1)
7
+ treetop
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
@@ -13,7 +14,10 @@ GEM
13
14
  nokogiri (1.10.10)
14
15
  mini_portile2 (~> 2.4.0)
15
16
  optimist (3.0.1)
17
+ polyglot (0.3.5)
16
18
  rake (12.3.3)
19
+ treetop (1.6.11)
20
+ polyglot (~> 0.3)
17
21
 
18
22
  PLATFORMS
19
23
  ruby
data/README.md CHANGED
@@ -20,7 +20,7 @@ You can find example "goods" (library) files under the "goods" subdirectory of t
20
20
 
21
21
  ## WOE Objects and skotos-xml-diff
22
22
 
23
- SkotOS-based games use an XML format for in-game objects called WOE, which is [documented in SkotOS-Doc](https://ChatTheatre.github.io/SkotOS-Doc). The skotos-xml-diff utility will diff between WOE objects or directories of WOE objects.
23
+ SkotOS-based games use an XML format for in-game objects ("/base/obj/thing"), which is [documented in SkotOS-Doc](https://ChatTheatre.github.io/SkotOS-Doc). The skotos-xml-diff utility will diff between Things or directories of Things.
24
24
 
25
25
  See SkotOS-Doc for more detail about how this can be used with a SkotOS game.
26
26
 
@@ -30,15 +30,21 @@ Run "skotos-xml-diff --help" for a list of options. You can tell it to ignore wh
30
30
 
31
31
  You would normally install DGDTools directly: `gem install dgd-tools`.
32
32
 
33
- It's possible to add it to a Ruby's application's Gemfile. Ordinarily you wouldn't.
33
+ If you have a Ruby Gemfile or gems.rb that uses it, you can "bundle install" as normal.
34
34
 
35
35
  ## Usage
36
36
 
37
- If you have a DGD application that uses DGD Manifest, run `dgd-manifest install` to download its dependencies and create a fully-assembled DGD directory for it. You can also `dgd-manifest test` to make sure its dependencies are downloaded and satisfied without building an application directory.
37
+ If you have a DGD application that uses DGD Manifest, run `dgd-manifest install` to download its dependencies and create a clean, fully-assembled DGD directory for it. You can also `dgd-manifest test` to make sure its dependencies are downloaded and satisfied without building an application directory. After the initial install, "dgd-manifest update" will avoid deleting any files you may have added.
38
+
39
+ NOTE: "dgd-manifest install" will delete any extra files you may have created in the DGD root. "dgd-manifest update" will not. Neither of these is always the right answer.
38
40
 
39
41
  That fully-assembled DGD directory is named ".root". To run your dgd server, type "dgd-manifest server".
40
42
 
41
- If you update files in your root and want to update files under the generated root directory, use "dgd-manifest update".
43
+ ## Creating a New DGD Manifest App
44
+
45
+ You can type "dgd-manifest new my_app_name" to create a new application using the appropriate DGD manifest structure. This is an easy way to set up an appropriate .gitignore file and similar.
46
+
47
+ You can, of course, do the same without the command if you like.
42
48
 
43
49
  ## Using DGD Manifest with your DGD Application
44
50
 
@@ -94,6 +100,12 @@ Here's what those look like:
94
100
  }
95
101
  ```
96
102
 
103
+ Fields in the Goods file are the same as fields in unbundled_goods.
104
+
105
+ ## Implementation Limits
106
+
107
+ Right now it's not possible to use the same repo multiple times with different branches. So for instance, you can't use one branch of ChatTheatre/SkotOS for your main library while using a different branch of it for some other library. For this reason, it's recommended that you extract smaller libraries into their own repositories rather than keeping multiple libraries in the same repo.
108
+
97
109
  ## Development
98
110
 
99
111
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
data/dgd-tools.gemspec CHANGED
@@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_runtime_dependency "nokogiri", "~>1.10.5"
28
28
  spec.add_runtime_dependency "optimist", "~>3.0.1"
29
+ spec.add_runtime_dependency "treetop"
29
30
  end
data/exe/dgd-manifest CHANGED
@@ -37,7 +37,7 @@ cmd_opts = case cmd
37
37
  puts "Running dgd.manifest installer..."
38
38
  repo = DGD::Manifest::Repo.new
39
39
  repo.manifest_file("dgd.manifest")
40
- repo.precheck(".", verbose: verbose)
40
+ repo.precheck(".", verbose: OPTS[:verbose])
41
41
  puts "Verified Manifest packages: this looks likely correct."
42
42
 
43
43
  when "install"
@@ -48,7 +48,7 @@ cmd_opts = case cmd
48
48
  repo = DGD::Manifest::Repo.new
49
49
  repo.manifest_file("dgd.manifest")
50
50
  current_dir = File.expand_path(".")
51
- repo.precheck(current_dir)
51
+ repo.precheck(current_dir, verbose: OPTS[:verbose])
52
52
  repo.assemble_app(current_dir, verbose: OPTS[:verbose])
53
53
  puts "Assembled DGD application into #{current_dir}"
54
54
 
@@ -0,0 +1,56 @@
1
+ require "dgd-tools/version"
2
+
3
+ require "treetop"
4
+
5
+ require_relative "dgd_grammar_support"
6
+ Treetop.load "#{__dir__}/dgd_grammar.tt"
7
+
8
+ # Preprocessor incantation: cpp -C -I. -D__DGD__ name_of_file.c
9
+
10
+ module DGD; end
11
+
12
+ module DGD::Doc
13
+
14
+ class SourceFile
15
+ attr_reader :parser
16
+
17
+ def initialize(path, dgd_root:)
18
+ unless File.exist?(path)
19
+ raise "No such source file for DGD::Doc::Sourcefile: #{path.inspect}"
20
+ end
21
+
22
+ @parser = DGDGrammarParser.new
23
+ @path = path
24
+ @dgd_root = dgd_root
25
+
26
+ parse_contents
27
+ end
28
+
29
+ private
30
+
31
+ def parse_contents
32
+ preproc_output = `cpp -C -I#{@dgd_root}/include -D__DGD__ #{@path}`
33
+ preproc_output.gsub!(/\n+/, "\n") # The preprocessor often winds up leaving a lot of newlines from various sources
34
+ preproc_output.gsub!(/^# \d+ ".*"\w*\d*$/, "")
35
+ data = @parser.parse(preproc_output)
36
+ if data
37
+ clean_tree(data)
38
+ #puts data.inspect
39
+ else
40
+ puts @parser.failure_reason
41
+ puts @parser.failure_line
42
+ puts @parser.failure_column
43
+
44
+ #puts "Preproc output was:#{preproc_output}\n\n\n"
45
+ raise "Parse error!"
46
+ end
47
+ end
48
+
49
+ def clean_tree(root_node)
50
+ return if(root_node.elements.nil?)
51
+ root_node.elements.each {|node| self.clean_tree(node) }
52
+ root_node.elements.delete_if {|node| node.class.name == "Treetop::Runtime::SyntaxNode" && node.text_value.size < 20 }
53
+ end
54
+
55
+ end
56
+ end
@@ -0,0 +1,373 @@
1
+ grammar DGDGrammar
2
+ rule source_file
3
+ ws (inherit ws)* (top_level_decl ws)*
4
+ end
5
+
6
+ rule inherit
7
+ ("private" WS)? "inherit" WS (ident WS)? ('object' WS)? string_exp ws ';' <Inherit>
8
+ end
9
+
10
+ rule top_level_decl
11
+ data_decl / func_decl
12
+ end
13
+
14
+ rule ident
15
+ [a-zA-Z_] [a-zA-Z_0-9]* <Identifier>
16
+ end
17
+
18
+ rule c_comment
19
+ '/*'
20
+ (
21
+ !'*/'
22
+ (. / "\n")
23
+ )*
24
+ '*/'
25
+ end
26
+
27
+ rule preproc_hash_line
28
+ "\n"? "# " decimal " "+ simple_string (" "+ decimal)? "\n"
29
+ end
30
+
31
+ rule simple_string
32
+ '"' (
33
+ !["\n\\]
34
+ .
35
+ )*
36
+ '"' <StringLiteral>
37
+ end
38
+
39
+ rule complex_string
40
+ '"' ( ((!["\n\\] ) .) / . )+ '"' <StringLiteral>
41
+ end
42
+
43
+ rule simple_char
44
+ "'" ((!['\n\\]) .)+ "'" <CharLiteral>
45
+ end
46
+
47
+ rule complex_char
48
+ "'" (((!['\n\\]) .) / ("\\" .))+ "'" <CharLiteral>
49
+ end
50
+
51
+ rule decimal
52
+ [1-9] [0-9]* <DecimalLiteral>
53
+ end
54
+
55
+ rule octal
56
+ '0' [0-7]* <OctalLiteral>
57
+ end
58
+
59
+ rule hexadecimal
60
+ '0' [xX] [a-fA-F0-9]+ <HexadecimalLiteral>
61
+ end
62
+
63
+ rule float
64
+ ([0-9]+ "." [0-9]+ ([eE] [-+]? [0-9]+)?) <FloatLiteral> /
65
+ ("." [0-9]+ ([eE] [-+]? [0-9]+)?) <FloatLiteral> /
66
+ ([0-9]+ [eE] [-+]? [0-9]+) <FloatLiteral>
67
+ end
68
+
69
+ rule single_WS
70
+ [ \t\v\f\r\n] / c_comment / preproc_hash_line
71
+ end
72
+
73
+ rule ws
74
+ single_WS*
75
+ end
76
+
77
+ rule WS
78
+ single_WS+
79
+ end
80
+
81
+ rule string
82
+ simple_string /
83
+ complex_string
84
+ end
85
+
86
+ rule string_exp
87
+ string /
88
+ '(' ws composite_string ws ')'
89
+ end
90
+
91
+ rule composite_string
92
+ string_exp / string_exp '+' composite_string
93
+ end
94
+
95
+ rule klass
96
+ (class_spec WS)* class_spec
97
+ end
98
+
99
+ rule class_spec
100
+ 'private' / 'static' / 'atomic' / 'nomask' / 'varargs'
101
+ end
102
+
103
+ rule type_spec
104
+ 'int' / 'float' / 'string' / 'object' / 'mapping' / 'mixed' / 'void'
105
+ end
106
+
107
+ rule stars
108
+ ('*' ws)*
109
+ end
110
+
111
+ rule formals
112
+ # If you put these in a different order with '' and 'void' first, parses start failing. That seems bad.
113
+ formal_list (ws '...')? / '' / 'void'
114
+ end
115
+
116
+ rule formal_list
117
+ formal (ws ',' ws formal)*
118
+ end
119
+
120
+ rule formal
121
+ class_type data_declarator /
122
+ ident
123
+ end
124
+
125
+ rule data_decl
126
+ class_type WS declarators ws ';' <DataDecl>
127
+ end
128
+
129
+ rule func_decl
130
+ class_type WS function_declarator ws compound_statement <FuncDecl> /
131
+ klass WS function_name ws '(' ws formals ws ')' ws compound_statement <FuncDecl>
132
+ end
133
+
134
+ rule class_type
135
+ (class_spec WS)* type_spec /
136
+ (class_spec WS)* 'object' list_exp
137
+ end
138
+
139
+ rule data_declarator
140
+ stars ws ident
141
+ end
142
+
143
+ rule function_name
144
+ ident /
145
+ 'operator' ws '+' /
146
+ 'operator' ws '-' /
147
+ 'operator' ws '*' /
148
+ 'operator' ws '/' /
149
+ 'operator' ws '%' /
150
+ 'operator' ws '&' /
151
+ 'operator' ws '^' /
152
+ 'operator' ws '|' /
153
+ 'operator' ws '<' /
154
+ 'operator' ws '>' /
155
+ 'operator' ws '>=' /
156
+ 'operator' ws '<=' /
157
+ 'operator' ws '<<' /
158
+ 'operator' ws '>>' /
159
+ 'operator' ws '~' /
160
+ 'operator' ws '++' /
161
+ 'operator' ws '--' /
162
+ 'operator' ws '[' ws ']' /
163
+ 'operator' ws '[' ws ']' ws '=' /
164
+ 'operator' ws '[' ws '..' ws ']'
165
+ end
166
+
167
+ rule function_declarator
168
+ stars ws function_name ws '(' ws formals ws ')'
169
+ end
170
+
171
+ rule declarator
172
+ function_declarator / data_declarator
173
+ end
174
+
175
+ rule declarators
176
+ declarator (ws ',' ws declarator)*
177
+ end
178
+
179
+ rule locals
180
+ (ws data_decl ws)*
181
+ end
182
+
183
+ rule statements
184
+ (ws statement ws)*
185
+ end
186
+
187
+ rule statement
188
+ 'if' ws '(' ws list_exp ws ')' ws statement (WS 'else' statement)? /
189
+ 'do' WS statement WS 'while' ws '(' ws list_exp ws ')' ws ';' /
190
+ 'while' ws '(' ws list_exp ws ')' ws statement /
191
+ 'for' ws '(' ws list_exp? ws ';' ws list_exp? ws ';' ws list_exp? ws ')' ws statement /
192
+ 'rlimits' ws '(' ws list_exp ws ';' ws list_exp ws ')' ws compound_statement /
193
+ 'catch' ws compound_statement ws ':' statement /
194
+ 'catch' ws compound_statement /
195
+ 'switch' ws '(' ws list_exp ws ')' ws compound_statement /
196
+ 'case' WS exp ws ':' ws statement /
197
+ 'case' WS exp ws '..' ws exp ws ':' statement /
198
+ 'default' ws ':' ws statement /
199
+ 'goto' WS ident ws ';' /
200
+ 'break' ws ';' /
201
+ 'continue' ws ';' /
202
+ 'return' WS list_exp WS ';' /
203
+ 'return' ws ';' /
204
+ ident ws ':' ws statement / # label statement
205
+ list_exp /
206
+ compound_statement /
207
+ ';'
208
+ end
209
+
210
+ rule compound_statement
211
+ '{' ws locals ws statements ws '}'
212
+ end
213
+
214
+ rule function_call
215
+ ('::' ws function_name) /
216
+ (ident ws '::' ws function_name) /
217
+ function_name
218
+ end
219
+
220
+ rule list_exp
221
+ exp ws ',' ws list_exp /
222
+ exp
223
+ end
224
+
225
+ rule exp
226
+ cond_exp ws '=' ws exp /
227
+ cond_exp ws '+=' ws exp /
228
+ cond_exp ws '-=' ws exp /
229
+ cond_exp ws '*=' ws exp /
230
+ cond_exp ws '/=' ws exp /
231
+ cond_exp ws '%=' ws exp /
232
+ cond_exp ws '<<=' ws exp /
233
+ cond_exp ws '>>=' ws exp /
234
+ cond_exp ws '&=' ws exp /
235
+ cond_exp ws '^=' ws exp /
236
+ cond_exp ws '|=' ws exp /
237
+ cond_exp
238
+ end
239
+
240
+ rule cond_exp
241
+ or_exp ws '?' ws list_exp ws ':' ws cond_exp / or_exp
242
+ end
243
+
244
+ rule or_exp
245
+ and_exp ws '||' ws or_exp / and_exp
246
+ end
247
+
248
+ rule and_exp
249
+ bitor_exp ws '&&' ws and_exp / bitor_exp
250
+ end
251
+
252
+ rule bitor_exp
253
+ bitxor_exp ws '|' ws bitor_exp / bitxor_exp
254
+ end
255
+
256
+ rule bitxor_exp
257
+ bitand_exp ws '^' ws bitxor_exp / bitand_exp
258
+ end
259
+
260
+ rule bitand_exp
261
+ equ_exp ws '&' bitand_exp / equ_exp
262
+ end
263
+
264
+ rule equ_exp
265
+ rel_exp ws '==' ws equ_exp /
266
+ rel_exp ws '!=' ws equ_exp /
267
+ rel_exp
268
+ end
269
+
270
+ rule rel_exp
271
+ shift_exp ws '<' ws rel_exp /
272
+ shift_exp ws '>' ws rel_exp /
273
+ shift_exp ws '<=' ws rel_exp /
274
+ shift_exp ws '>=' ws rel_exp /
275
+ shift_exp
276
+ end
277
+
278
+ rule shift_exp
279
+ add_exp ws '<<' ws shift_exp /
280
+ add_exp ws '>>' ws shift_exp /
281
+ add_exp
282
+ end
283
+
284
+ rule add_exp
285
+ mult_exp ws '+' ws add_exp /
286
+ mult_exp ws '-' ws add_exp /
287
+ mult_exp
288
+ end
289
+
290
+ rule mult_exp
291
+ cast_exp ws '*' ws mult_exp /
292
+ cast_exp ws '/' ws mult_exp /
293
+ cast_exp ws '%' ws mult_exp /
294
+ cast_exp
295
+ end
296
+
297
+ rule cast_exp
298
+ '(' ws class_type ws stars ws ')' ws cast_exp /
299
+ prefix_exp
300
+ end
301
+
302
+ rule prefix_exp
303
+ '++' ws cast_exp /
304
+ '--' ws cast_exp /
305
+ '+' ws cast_exp /
306
+ '-' ws cast_exp /
307
+ '!' ws cast_exp /
308
+ '~' ws cast_exp /
309
+ postfix_exp
310
+ end
311
+
312
+ rule postfix_exp
313
+ exp2 (ws ('++' / '--'))?
314
+ end
315
+
316
+ rule exp2
317
+ exp1 ws '->' ws ident ws '(' ws opt_arg_list ws ')' /
318
+ exp1 ws '<-' ws string_exp /
319
+ exp1 ((ws '[' ws list_exp ws ']') / (ws '[' ws (list_exp ws)? '..' ws (list_exp ws)? ']'))*
320
+ end
321
+
322
+ rule exp1
323
+ # This works (for now) with function_call up front, but not when it was lower down...
324
+ # There's some kind of bad stuff going on with precedence that's causing parse failures.
325
+ # That's weird, since I assume it should try all combinations/precedences before giving up...
326
+ function_call ws '(' ws opt_arg_list ws ')' /
327
+ 'catch' ws '(' list_exp ws ')' /
328
+ 'new' (WS 'object')? ws string_exp (ws '(' ws opt_arg_list ws ')')? /
329
+ 'nil' /
330
+ '(' ws '{' ws opt_arg_list_comma ws '}' ws ')' /
331
+ '(' ws '[' ws opt_assoc_list_comma ws ']' ws ')' /
332
+ '::' ws ident /
333
+ decimal /
334
+ octal /
335
+ hexadecimal /
336
+ simple_char /
337
+ complex_char /
338
+ float /
339
+ string /
340
+ ident /
341
+ '(' ws list_exp ws ')'
342
+ end
343
+
344
+ rule arg_list
345
+ exp ws ',' ws arg_list /
346
+ exp
347
+ end
348
+
349
+ rule opt_arg_list
350
+ arg_list ws '...' /
351
+ arg_list?
352
+ end
353
+
354
+ rule opt_arg_list_comma
355
+ arg_list ws ',' /
356
+ arg_list?
357
+ end
358
+
359
+ rule assoc_list
360
+ assoc_pair ws ',' ws assoc_list /
361
+ assoc_pair
362
+ end
363
+
364
+ rule assoc_pair
365
+ exp ws ':' ws exp
366
+ end
367
+
368
+ rule opt_assoc_list_comma
369
+ assoc_list ws ',' /
370
+ assoc_list?
371
+ end
372
+
373
+ end
@@ -0,0 +1,36 @@
1
+ #class StringLiteral < Treetop::Runtime::SyntaxNode
2
+ # def some_name
3
+ # # This is a pretty crude way of handling character escaping, etc.
4
+ # return eval self.text_value
5
+ # end
6
+ #end
7
+
8
+ class DataDecl < Treetop::Runtime::SyntaxNode
9
+ end
10
+
11
+ class FuncDecl < Treetop::Runtime::SyntaxNode
12
+ end
13
+
14
+ class Inherit < Treetop::Runtime::SyntaxNode
15
+ end
16
+
17
+ class Identifier < Treetop::Runtime::SyntaxNode
18
+ end
19
+
20
+ class DecimalLiteral < Treetop::Runtime::SyntaxNode
21
+ end
22
+
23
+ class OctalLiteral < Treetop::Runtime::SyntaxNode
24
+ end
25
+
26
+ class HexadecimalLiteral < Treetop::Runtime::SyntaxNode
27
+ end
28
+
29
+ class FloatLiteral < Treetop::Runtime::SyntaxNode
30
+ end
31
+
32
+ class StringLiteral < Treetop::Runtime::SyntaxNode
33
+ end
34
+
35
+ class CharLiteral < Treetop::Runtime::SyntaxNode
36
+ end
@@ -128,6 +128,8 @@ module DGD::Manifest
128
128
 
129
129
  def assemble_app(location, verbose:)
130
130
  Dir[File.join(dgd_root(location), "*")].each { |dir| FileUtils.rm_rf dir }
131
+ Dir[File.join(dgd_root(location), "state", "*")].each { |dir| FileUtils.rm_rf dir }
132
+ Dir[File.join(dgd_root(location), ".repos", "*")].each { |dir| FileUtils.rm_f dir }
131
133
 
132
134
  write_app_files(location, verbose: verbose)
133
135
  end
@@ -142,6 +144,13 @@ module DGD::Manifest
142
144
  Dir.chdir(location) do
143
145
  write_config_file("#{location}/dgd.config")
144
146
  FileUtils.mkdir_p("#{location}/state") # Statedir for statedumps, editor files, etc.
147
+ repos_dir = "#{location}/.repos"
148
+ FileUtils.mkdir_p(repos_dir) # Links to repos in manifest
149
+
150
+ @manifest_file.ordered_specs.each do |spec|
151
+ # force:true prevents getting an exception if the file exists
152
+ FileUtils.ln_s(spec.source.local_dir, File.join(".repos", spec.name), force: true)
153
+ end
145
154
 
146
155
  assembly_operations(location, verbose: verbose).each do |sd_hash|
147
156
  to_path = "#{dgd_root(location)}/#{sd_hash[:to]}"
@@ -429,6 +438,13 @@ module DGD::Manifest
429
438
  .root
430
439
  dgd.config
431
440
  state/*
441
+ wafer
442
+ websocket-to-tcp-tunnel
443
+ dgd
444
+ log/*
445
+ skotos.database
446
+ skotos.database.old
447
+ .repos/**
432
448
  FILE_CONTENTS
433
449
  end
434
450
 
@@ -562,15 +578,17 @@ FILE_CONTENTS
562
578
 
563
579
  def config_to_ports(data)
564
580
  if data.is_a?(Hash)
565
- # TODO: verify that keys are IP addr strings and values are legal port numbers
566
- return data
581
+ return data.map { |ip, port| [ip, Integer(port) ] }
567
582
  elsif data.is_a?(Array)
568
- # TODO: verify that data is an array of legal integer port numbers
569
- ports = {}
570
- data.each { |p| ports["*"] = p }
583
+ if data[0].is_a?(Array)
584
+ ports = data.map { |ip, port| [ip, Integer(port) ] }
585
+ return ports
586
+ end
587
+
588
+ ports = data.map { |p| [ "*", Integer(p) ] }
571
589
  return ports
572
590
  elsif data.is_a?(Integer)
573
- return { "*": data }
591
+ return [ [ "*", data ] ]
574
592
  else
575
593
  raise "dgd-manifest: not sure how to get port data from a #{data.class.name} -- #{data.inspect}!"
576
594
  end
@@ -1,3 +1,3 @@
1
1
  module DGD
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.13"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dgd-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Gibbs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-09 00:00:00.000000000 Z
11
+ date: 2021-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 3.0.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: treetop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: dgd-tools supplies DGD Manifest and eventually perhaps other tools. DGD
42
56
  Manifest is an experimental DGD library and packaging system.
43
57
  email:
@@ -69,6 +83,9 @@ files:
69
83
  - exe/skotos-xml-diff
70
84
  - goods/chattheatre_kernellib.goods
71
85
  - goods/skotos_httpd.goods
86
+ - lib/dgd-tools/dgd-doc.rb
87
+ - lib/dgd-tools/dgd_grammar.tt
88
+ - lib/dgd-tools/dgd_grammar_support.rb
72
89
  - lib/dgd-tools/manifest.rb
73
90
  - lib/dgd-tools/skotos_xml_obj.rb
74
91
  - lib/dgd-tools/version.rb