Sha256: 090a4d2a54366100f8e208917cff55173531d122178526dd451433f9ba626749
Contents?: true
Size: 941 Bytes
Versions: 81
Compression:
Stored size: 941 Bytes
Contents
#!/usr/bin/env ruby require "./lib/parser" require "byebug" require "nokogiri" require "yaml" require "json" require "fileutils" require "parser" files = Parser::Files.load puts "Parsing docs for #{files.length} files." puts "If you're not seeing the files you would expect ensure they are named according to the README" files.each_pair do |category, file| unless file puts "No file found for #{category} category" next end puts "Parsing for #{category} with #{file.inspect}" structured = Parser::Engine.parse_doc(category, file) structured.each do |endpoint| resource_path = "./data/resource_fixtures/#{endpoint[:type]}" FileUtils.mkdir_p resource_path path = "#{resource_path}/#{endpoint[:name]}" File.open(path + ".yml", 'w+') { |f| f.write(endpoint.to_yaml) } File.open(path + '.json', 'w+') { |f| f.write(JSON.pretty_generate(endpoint)) } end end puts "Parsing is done. Check yo diffs."
Version data entries
81 entries across 81 versions & 1 rubygems