junoser 0.3.9 → 0.4.0
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/.travis.yml +2 -2
- data/CHANGELOG.md +93 -45
- data/Gemfile.lock +10 -10
- data/LICENSE.txt +1 -1
- data/README.md +47 -11
- data/Rakefile +1 -1
- data/example/get-schema.xml +19 -0
- data/example/junos-18.1R3-S9.rb +102366 -0
- data/example/mx-19.3R3-S1.3.rb +118420 -0
- data/example/vmx-17.2R1.13.rb +2287 -2272
- data/junoser.gemspec +1 -1
- data/lib/junoser/display/config_store.rb +2 -2
- data/lib/junoser/parser.rb +53526 -34952
- data/lib/junoser/ruler.rb +106 -71
- data/lib/junoser/squash.rb +51 -57
- data/lib/junoser/version.rb +1 -1
- data/lib/junoser/xsd/base.rb +5 -4
- data/lib/junoser/xsd/choice.rb +6 -2
- data/lib/junoser/xsd/complex_type.rb +3 -3
- data/lib/junoser/xsd/element.rb +7 -3
- data/lib/junoser/xsd/restriction.rb +2 -2
- data/lib/junoser/xsd/sequence.rb +11 -3
- data/lib/junoser/xsd/simple_content.rb +1 -1
- data/lib/junoser/xsd/simple_type.rb +2 -2
- data/lib/junoser/xsd/union.rb +1 -1
- metadata +11 -8
@@ -17,9 +17,9 @@ module Junoser
|
|
17
17
|
@config ||= children.map {|child|
|
18
18
|
case child.name
|
19
19
|
when 'enumeration'
|
20
|
-
Junoser::Xsd::Enumeration.new(child, depth: @depth+1)
|
20
|
+
Junoser::Xsd::Enumeration.new(child, depth: @depth+1, parent: self)
|
21
21
|
when 'simpleType'
|
22
|
-
Junoser::Xsd::SimpleType.new(child, depth: @depth+1)
|
22
|
+
Junoser::Xsd::SimpleType.new(child, depth: @depth+1, parent: self)
|
23
23
|
when 'attribute'
|
24
24
|
else
|
25
25
|
raise "ERROR: unknown element: #{child.name}"
|
data/lib/junoser/xsd/sequence.rb
CHANGED
@@ -11,9 +11,9 @@ module Junoser
|
|
11
11
|
@config ||= children.map {|child|
|
12
12
|
case child.name
|
13
13
|
when 'choice'
|
14
|
-
Junoser::Xsd::Choice.new(child, depth: @depth+1)
|
14
|
+
Junoser::Xsd::Choice.new(child, depth: @depth+1, parent: self)
|
15
15
|
when 'element'
|
16
|
-
Junoser::Xsd::Element.new(child, depth: @depth+1)
|
16
|
+
Junoser::Xsd::Element.new(child, depth: @depth+1, parent: self)
|
17
17
|
when 'any'
|
18
18
|
'any'
|
19
19
|
else
|
@@ -28,7 +28,15 @@ module Junoser
|
|
28
28
|
when has_single_child_of?(Junoser::Xsd::Choice)
|
29
29
|
child = config.first
|
30
30
|
str = child.config.map(&:to_s).reject(&:empty?).join(",\n")
|
31
|
-
|
31
|
+
|
32
|
+
return if str.empty?
|
33
|
+
|
34
|
+
# Assuming that <xsd:sequence> always has <xsd:complexType> as the parent
|
35
|
+
if parent.parent&.oneliner? && config.first.unbounded?
|
36
|
+
format('sc(', str, ')')
|
37
|
+
else
|
38
|
+
format('c(', str, ')')
|
39
|
+
end
|
32
40
|
else
|
33
41
|
str = config.map {|c| c.is_a?(String) ? format(OFFSET + c) : c.to_s }.reject(&:empty?).join(",\n")
|
34
42
|
format('s(', str, ')')
|
@@ -11,9 +11,9 @@ module Junoser
|
|
11
11
|
@config ||= children.map {|child|
|
12
12
|
case child.name
|
13
13
|
when 'restriction'
|
14
|
-
Junoser::Xsd::Restriction.new(child, depth: @depth+1)
|
14
|
+
Junoser::Xsd::Restriction.new(child, depth: @depth+1, parent: self)
|
15
15
|
when 'union'
|
16
|
-
Junoser::Xsd::Union.new(child, depth: @depth+1)
|
16
|
+
Junoser::Xsd::Union.new(child, depth: @depth+1, parent: self)
|
17
17
|
else
|
18
18
|
raise "ERROR: unknown element: #{child.name}"
|
19
19
|
end
|
data/lib/junoser/xsd/union.rb
CHANGED
@@ -9,7 +9,7 @@ module Junoser
|
|
9
9
|
@config ||= children.map {|child|
|
10
10
|
case child.name
|
11
11
|
when 'simpleType'
|
12
|
-
Junoser::Xsd::SimpleType.new(child, depth: @depth+1)
|
12
|
+
Junoser::Xsd::SimpleType.new(child, depth: @depth+1, parent: self)
|
13
13
|
else
|
14
14
|
raise "ERROR: unknown element: #{child.name}"
|
15
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: junoser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shintaro Kojima
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parslet
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,6 +99,9 @@ files:
|
|
99
99
|
- Rakefile
|
100
100
|
- bin/console
|
101
101
|
- bin/setup
|
102
|
+
- example/get-schema.xml
|
103
|
+
- example/junos-18.1R3-S9.rb
|
104
|
+
- example/mx-19.3R3-S1.3.rb
|
102
105
|
- example/vmx-17.2R1.13.rb
|
103
106
|
- example/vsrx-12.1.x47.rb
|
104
107
|
- example/vsrx-18.3R1.9.rb
|
@@ -135,7 +138,7 @@ files:
|
|
135
138
|
homepage: https://github.com/codeout/junoser
|
136
139
|
licenses: []
|
137
140
|
metadata: {}
|
138
|
-
post_install_message:
|
141
|
+
post_install_message:
|
139
142
|
rdoc_options: []
|
140
143
|
require_paths:
|
141
144
|
- lib
|
@@ -150,8 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
153
|
- !ruby/object:Gem::Version
|
151
154
|
version: '0'
|
152
155
|
requirements: []
|
153
|
-
rubygems_version: 3.
|
154
|
-
signing_key:
|
156
|
+
rubygems_version: 3.2.15
|
157
|
+
signing_key:
|
155
158
|
specification_version: 4
|
156
159
|
summary: PEG parser for JUNOS configuration.
|
157
160
|
test_files: []
|