junoser 0.4.1 → 0.4.4

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.
data/lib/junoser/ruler.rb CHANGED
@@ -137,6 +137,8 @@ module Junoser
137
137
  str.gsub!(/"icmp"(.*\s*.*)"icmpv6"/) { %["icmpv6"#$1"icmp"] }
138
138
  str.gsub!(/"snmp"(.*\s*.*)"snmptrap"/) { %["snmptrap"#$1"snmp"] }
139
139
  str.gsub!(/"ospf"(.*\s*.*)"ospf3"/) { %["ospf3"#$1"ospf"] }
140
+ str.gsub! '"tls1" | "tls11" | "tls12"', '"tls11" | "tls12" | "tls1"'
141
+ str.gsub!(/("group1" \| "group2" \| "group5") \| ([^\)]+)/) { "#{$2} | #{$1}"}
140
142
 
141
143
  %w[ccc ethernet-over-atm tcc vpls bridge].each do |encap|
142
144
  str.gsub!(/"ethernet"(.*)"ethernet-#{encap}"/) { %["ethernet-#{encap}"#$1"ethernet"] }
@@ -212,7 +214,16 @@ module Junoser
212
214
  # Fix .xsd: "members" accepts [ foo bar ]
213
215
  str.gsub! '"members" arg', '"members" any'
214
216
 
217
+ # Fix .xsd: "term_object" accepts multiple conditions
218
+ str.gsub!(/^(rule\(:term_object\) do\s*arg\.as\(:arg\) \(\s*)c\(/) { "#{$1}sc(" }
219
+
220
+ # Fix .xsd: keywords "dest-nat-rule-match", "src-nat-rule-match", "static-nat-rule-match" are wrong
221
+ str.gsub!(/"(dest|src|static)-nat-rule-match"/) { '"match"' }
222
+
215
223
  str
224
+
225
+ # Fix .xsd: "snmp system-name" should be "snmp name"
226
+ str.gsub! '"system-name" arg', '"name" (quote | arg)'
216
227
  end
217
228
 
218
229
  def format(str, offset = OFFSET)
@@ -1,3 +1,3 @@
1
1
  module Junoser
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.4"
3
3
  end
@@ -34,14 +34,16 @@ module Junoser
34
34
  end
35
35
 
36
36
  def oneliner?
37
- @oneliner ||= !xml.xpath('./xsd:annotation/xsd:appinfo/flag[text()="oneliner"]').empty?
37
+ # don't use "/flag" as xsd manipulation automatically add "xsd:" prefix
38
+ @oneliner ||= !xml.xpath('./xsd:annotation/xsd:appinfo/*[local-name()="flag" and text()="oneliner"]').empty?
38
39
  end
39
40
 
40
41
 
41
42
  private
42
43
 
43
44
  def nokeyword?
44
- @nokeyword ||= !xml.xpath('./xsd:annotation/xsd:appinfo/flag[text()="nokeyword"]').empty?
45
+ # don't use "/flag" as xsd manipulation automatically add "xsd:" prefix
46
+ @nokeyword ||= !xml.xpath('./xsd:annotation/xsd:appinfo/*[local-name()="flag" and text()="nokeyword"]').empty?
45
47
  end
46
48
 
47
49
  def has_single_child_of?(klass)
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.1
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shintaro Kojima
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-13 00:00:00.000000000 Z
11
+ date: 2022-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet
@@ -89,8 +89,9 @@ executables:
89
89
  extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
+ - ".github/workflows/test-linux.yaml"
92
93
  - ".gitignore"
93
- - ".travis.yml"
94
+ - ".pre-commit-config.yaml"
94
95
  - CHANGELOG.md
95
96
  - Gemfile
96
97
  - Gemfile.lock
@@ -99,6 +100,7 @@ files:
99
100
  - Rakefile
100
101
  - bin/console
101
102
  - bin/setup
103
+ - commitlint.config.js
102
104
  - example/get-schema.xml
103
105
  - example/junos-18.1R3-S9.rb
104
106
  - example/mx-19.3R3-S1.3.rb
@@ -153,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
155
  - !ruby/object:Gem::Version
154
156
  version: '0'
155
157
  requirements: []
156
- rubygems_version: 3.2.15
158
+ rubygems_version: 3.2.22
157
159
  signing_key:
158
160
  specification_version: 4
159
161
  summary: PEG parser for JUNOS configuration.
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 2.6
5
- - 2.7
6
- - 3.0
7
- - ruby-head
8
-
9
- before_install:
10
- - gem update --system
11
- - gem install bundler
12
-
13
- matrix:
14
- allow_failures:
15
- - rvm: ruby-head