junoser 0.7.0 → 0.7.1
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/CHANGELOG.md +8 -0
- data/Gemfile.lock +3 -3
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/lib/junoser/js_ruler.rb +32 -16
- data/lib/junoser/parser.rb +18 -0
- data/lib/junoser/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd8d0023004d5b1a354481038fd124a73b1aff42b66fd0582534dbed3587acfc
|
4
|
+
data.tar.gz: 26215df72ca310d36a6b57e5e288d145c5e575ced116633e023b0d895db4546f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fb26b5d915d873942e4ae4fcff612f70664ed933353287597c74da9ecf42f68f7e6f55ce8472e64a73ae2598a77937beacfb1fc9b417b9247e4dfcbcf76904f
|
7
|
+
data.tar.gz: 534d3484149a158d384e2beaabd6a12c33cd16ef993d2ddfb90e61410b76a6dd3ef214e7894c9a2b2541effbe69f7e271b4cc7208d9bb22470efc5e16a912c99
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
junoser (0.7.
|
4
|
+
junoser (0.7.1)
|
5
5
|
parslet
|
6
6
|
|
7
7
|
GEM
|
@@ -12,7 +12,7 @@ GEM
|
|
12
12
|
mini_portile2 (~> 2.8.2)
|
13
13
|
racc (~> 1.4)
|
14
14
|
parslet (2.0.0)
|
15
|
-
power_assert (2.0.
|
15
|
+
power_assert (2.0.5)
|
16
16
|
racc (1.8.1)
|
17
17
|
rake (13.2.1)
|
18
18
|
test-unit (3.6.7)
|
@@ -29,4 +29,4 @@ DEPENDENCIES
|
|
29
29
|
test-unit
|
30
30
|
|
31
31
|
BUNDLED WITH
|
32
|
-
2.
|
32
|
+
2.6.2
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2015-
|
3
|
+
Copyright (c) 2015-2025 Shintaro Kojima
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
data/lib/junoser/js_ruler.rb
CHANGED
@@ -29,17 +29,20 @@ module Junoser
|
|
29
29
|
# set groups
|
30
30
|
str.gsub! /"groups" \(.*\s*s\(\s*any\s*\)\s*\)/, <<-EOS.strip
|
31
31
|
"groups" arg ( /* Configuration groups */
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
"
|
42
|
-
|
32
|
+
c(
|
33
|
+
this.configuration({ groups: false }),
|
34
|
+
"when" ( /* Specify additional conditions for groups */
|
35
|
+
c(
|
36
|
+
"chassis" arg /* Chassis id */,
|
37
|
+
"member" arg /* Member of virtual chassis */,
|
38
|
+
"model" arg /* Model name */,
|
39
|
+
"node" arg /* Node of cluster */,
|
40
|
+
"peers" arg /* Hosts on which this group should be effective */,
|
41
|
+
"routing-engine" arg /* Routing Engine */,
|
42
|
+
"time" ( /* Time at which group should be effective */
|
43
|
+
"to" arg /* End time([yyyy-mm-dd.]hh:mm) */,
|
44
|
+
arg
|
45
|
+
)
|
43
46
|
)
|
44
47
|
)
|
45
48
|
)
|
@@ -91,8 +94,8 @@ module Junoser
|
|
91
94
|
end
|
92
95
|
|
93
96
|
def process_common_syntax(str)
|
94
|
-
# rule(:foo) do -> foo(
|
95
|
-
str.gsub!(/^rule\(:(\S+)\) do/) { "#$1(
|
97
|
+
# rule(:foo) do -> foo(opts) {
|
98
|
+
str.gsub!(/^rule\(:(\S+)\) do/) { "#$1(opts) { return_next_line" }
|
96
99
|
# end -> }
|
97
100
|
str.gsub!(/^(\s*)end$/) { "#$1}" }
|
98
101
|
|
@@ -167,12 +170,12 @@ module Junoser
|
|
167
170
|
end
|
168
171
|
|
169
172
|
def process_structural_syntax(str)
|
170
|
-
# "foo" ( /* doc */ -> "foo | doc": (
|
173
|
+
# "foo" ( /* doc */ -> "foo | doc": (opts) => {
|
171
174
|
str.gsub!(%r|^(\s*)"(\S+)" \( /\* (.*) \*/|) { "#$1\"#$2 | #$3\": {" }
|
172
|
-
# "foo" ( -> "foo": (
|
175
|
+
# "foo" ( -> "foo": (opts) => {
|
173
176
|
str.gsub!(%r|^(\s*)"(\S+)" \($|) { "#$1\"#$2\": {" }
|
174
177
|
|
175
|
-
# "foo" arg ( /* doc */ -> "foo | doc": (
|
178
|
+
# "foo" arg ( /* doc */ -> "foo | doc": (opts) => {
|
176
179
|
str.gsub!(%r|^(\s*)"(\S+)" arg \( /\* (.*) \*/|) { "#$1\"#$2 | #$3\": {" }
|
177
180
|
|
178
181
|
str
|
@@ -286,6 +289,8 @@ module Junoser
|
|
286
289
|
|
287
290
|
# "arg" -> "arg_1"
|
288
291
|
lines.gsub('"arg":') { %["arg_#{sequence}":] }
|
292
|
+
|
293
|
+
conditional_groups(lines)
|
289
294
|
end
|
290
295
|
|
291
296
|
# } -> )
|
@@ -349,6 +354,17 @@ module Junoser
|
|
349
354
|
lines
|
350
355
|
end
|
351
356
|
|
357
|
+
def conditional_groups(lines)
|
358
|
+
# "null_13264": this.configuration(false),
|
359
|
+
# ->
|
360
|
+
# (opts === undefined || opts?.configuration !== false) && { "null_13264": this.configuration(false) },
|
361
|
+
#
|
362
|
+
# ref: process_lines()
|
363
|
+
lines.gsub(/("groups\(arg\) \| .*":) {/) {
|
364
|
+
"#{$1} opts?.groups !== false && {"
|
365
|
+
}
|
366
|
+
end
|
367
|
+
|
352
368
|
def rule_header
|
353
369
|
<<~EOS
|
354
370
|
/* eslint-disable semi */
|
data/lib/junoser/parser.rb
CHANGED
@@ -86863,6 +86863,14 @@ module Junoser
|
|
86863
86863
|
httpd_traceoptions_type
|
86864
86864
|
),
|
86865
86865
|
a(str("management-url"), arg),
|
86866
|
+
# Ported from vSRX 18.4R1.8
|
86867
|
+
b(str("http"),
|
86868
|
+
a(str("port"), arg),
|
86869
|
+
b(str("interface"),
|
86870
|
+
interface_name
|
86871
|
+
)
|
86872
|
+
),
|
86873
|
+
# End of vSRX 18.4R1.8
|
86866
86874
|
b(str("https"),
|
86867
86875
|
c(
|
86868
86876
|
a(str("port"), arg),
|
@@ -86876,6 +86884,16 @@ module Junoser
|
|
86876
86884
|
)
|
86877
86885
|
)
|
86878
86886
|
),
|
86887
|
+
# Ported from vSRX 18.4R1.8
|
86888
|
+
b(str("http"),
|
86889
|
+
c(
|
86890
|
+
a(str("port"), arg),
|
86891
|
+
b(str("interface"),
|
86892
|
+
interface_name
|
86893
|
+
)
|
86894
|
+
)
|
86895
|
+
),
|
86896
|
+
# End of vSRX 18.4R1.8
|
86879
86897
|
b(str("control"),
|
86880
86898
|
c(
|
86881
86899
|
a(str("max-threads"), arg)
|
data/lib/junoser/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: junoser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shintaro Kojima
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-02-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: parslet
|
@@ -141,7 +140,6 @@ files:
|
|
141
140
|
homepage: https://github.com/codeout/junoser
|
142
141
|
licenses: []
|
143
142
|
metadata: {}
|
144
|
-
post_install_message:
|
145
143
|
rdoc_options: []
|
146
144
|
require_paths:
|
147
145
|
- lib
|
@@ -156,8 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
154
|
- !ruby/object:Gem::Version
|
157
155
|
version: '0'
|
158
156
|
requirements: []
|
159
|
-
rubygems_version: 3.
|
160
|
-
signing_key:
|
157
|
+
rubygems_version: 3.6.2
|
161
158
|
specification_version: 4
|
162
159
|
summary: PEG parser for JUNOS configuration.
|
163
160
|
test_files: []
|