Sha256: e6638f6e54bc17c0839d91d2a83a76faaa6f52727edddbc815b3686d7363d7ba

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

require 'bundler/gem_tasks'
require 'junoser/development'
require 'nokogiri'
require 'pathname'
require 'rake/testtask'

xsd_path = File.expand_path('../tmp/junos-system.xsd', Pathname.new(__FILE__).realpath)
rule_path = File.expand_path('../tmp/rule.rb', Pathname.new(__FILE__).realpath)
parser_path = File.expand_path('../lib/junoser/parser.rb', Pathname.new(__FILE__).realpath)

def open_files(input, output, &block)
  i = open(input)
  o = open(output, 'w')

  yield i, o

  i.close
  o.close
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|
        output.puts e.to_config
      end
    end
  end

  desc 'Build the parser'
  task(:rule) do
    open_files(rule_path, parser_path) do |input, output|
      output.puts Junoser::Ruler.new(input).to_rule
    end
  end
end


Rake::TestTask.new do |t|
  t.verbose = true
end

desc 'Run tests'
task default: :test

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
junoser-0.2.2 Rakefile
junoser-0.2.1 Rakefile
junoser-0.2.0 Rakefile
junoser-0.1.6 Rakefile
junoser-0.1.5 Rakefile
junoser-0.1.4 Rakefile
junoser-0.1.3 Rakefile