Sha256: 120a9da0c2349ff706c87e9b3cdc504e814e3104e4f7510b7543e7ee4e84c9ee
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
require 'nokogiri' require 'active_support/all' require 'scaffold_parser/nokogiri_patches' require 'scaffold_parser/file_patches' require 'scaffold_parser/scaffolders/xsd' Nokogiri::XML::Element.include ScaffoldParser::NokogiriPatches::Element Nokogiri::XML::Document.include ScaffoldParser::NokogiriPatches::Document StringIO.include ScaffoldParser::FilePatches module ScaffoldParser def self.scaffold(path, options = {}) unless Dir.exists?('./tmp/') Dir.mkdir('./tmp/') puts './tmp/ directory created' end unless Dir.exists?('./tmp/builders') Dir.mkdir('./tmp/builders') puts './tmp/builders directory created' end unless Dir.exists?('./tmp/parsers') Dir.mkdir('./tmp/parsers') puts './tmp/parsers directory created' end scaffold_to_string(path, options).each do |path, content| complete_path = path.prepend('./tmp/') puts "Writing out #{complete_path}" if options[:verbose] File.open(complete_path, 'wb') { |f| f.write content } end end def self.scaffold_to_string(path, options = {}) doc = Nokogiri::XML(File.open(path)) Scaffolders::XSD.call(doc, options) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
scaffold_parser-0.5.0 | lib/scaffold_parser.rb |
scaffold_parser-0.4.0 | lib/scaffold_parser.rb |
scaffold_parser-0.3.0 | lib/scaffold_parser.rb |