Rakefile in junoser-0.4.1 vs Rakefile in junoser-0.4.2
- old
+ new
@@ -17,16 +17,26 @@
i.close
o.close
end
+def move_wildcards(element)
+ ['ipaddr', 'ipv6addr', 'ipprefix'].each do |pattern|
+ element.xpath(%[.//xsd:element[@type="#{pattern}"]/xsd:annotation/xsd:appinfo/flag[text()="nokeyword"]/../../..]).each do |wildcard|
+ parent = wildcard.parent
+ removed = wildcard.remove
+ parent << removed
+ end
+ end
+end
namespace :build do
desc 'Build an intermediate config hierarchy'
task :config do
open_files(xsd_path, rule_path) do |input, output|
Nokogiri::XML(input).root.remove_unused.xpath('/xsd:schema/*').each do |e|
+ move_wildcards e # Move wildcard elements to the end of siblings as they capture keywords unexpectedly
output.puts e.to_config
end
end
end
@@ -53,10 +63,9 @@
next if ['arg', 'end', 'ipaddr', 'time'].include?(method)
puts method unless vsrx =~ /rule\(:#{method}\)/m || vmx =~ /rule\(:#{method}\)/m
end
end
-
Rake::TestTask.new do |t|
t.libs << 'test'
t.verbose = true