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

Version Path
alula-ruby-2.6.1 bin/docparse
alula-ruby-2.6.0 bin/docparse
alula-ruby-2.5.0 bin/docparse
alula-ruby-2.4.0 bin/docparse
alula-ruby-2.3.0 bin/docparse
alula-ruby-2.2.0 bin/docparse
alula-ruby-2.1.2 bin/docparse
alula-ruby-2.1.1 bin/docparse
alula-ruby-2.1.0 bin/docparse
alula-ruby-2.0.0 bin/docparse
alula-ruby-1.10.5 bin/docparse
alula-ruby-1.10.4 bin/docparse
alula-ruby-1.10.3 bin/docparse
alula-ruby-1.10.2 bin/docparse
alula-ruby-1.10.1 bin/docparse
alula-ruby-1.10.0 bin/docparse
alula-ruby-1.9.17 bin/docparse
alula-ruby-1.9.16 bin/docparse
alula-ruby-1.9.15 bin/docparse
alula-ruby-1.9.14 bin/docparse