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.
@@ -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}"
@@ -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
- format('c(', str, ')') unless str.empty?
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, ')')
@@ -10,7 +10,7 @@ module Junoser
10
10
  @config ||= children.map {|child|
11
11
  case child.name
12
12
  when 'restriction'
13
- Junoser::Xsd::Restriction.new(child, depth: @depth+1)
13
+ Junoser::Xsd::Restriction.new(child, depth: @depth+1, parent: self)
14
14
  when 'extension'
15
15
  'arg'
16
16
  else
@@ -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
@@ -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.3.9
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: 2019-11-17 00:00:00.000000000 Z
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: '10.0'
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: '10.0'
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.0.4
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: []