Class: Mizuho::Generator
- Inherits:
-
Object
- Object
- Mizuho::Generator
- Defined in:
- lib/mizuho/generator.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input, options = {}) ⇒ Generator
constructor
A new instance of Generator.
- #start ⇒ Object
Constructor Details
#initialize(input, options = {}) ⇒ Generator
Returns a new instance of Generator.
15 16 17 18 19 20 21 22 |
# File 'lib/mizuho/generator.rb', line 15 def initialize(input, = {}) @input_file = input @output_name = [:output] @template = locate_template_file([:template]) @multi_page = [:multi_page] @icons_dir = [:icons_dir] @conf_file = [:conf_file] end |
Class Method Details
.run_asciidoc(input, output, icons_dir = nil, conf_file = nil) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/mizuho/generator.rb', line 32 def self.run_asciidoc(input, output, icons_dir = nil, conf_file = nil) args = ["python", ASCIIDOC, "-a", "toc", "-a", "icons"] if icons_dir args << "-a" args << "iconsdir=#{icons_dir}" end if conf_file # With the splat operator we support a string and an array of strings. [*conf_file].each do |cf| args << "-f" args << cf end end args += ["-n", "-o", output, input] if !system(*args) raise GenerationError, "Asciidoc failed." end end |
Instance Method Details
#start ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/mizuho/generator.rb', line 24 def start output_filename = determine_output_filename(@input_file, @output_name) self.class.run_asciidoc(@input_file, output_filename, @icons_dir, @conf_file) if @template apply_template(output_filename, @input_file, @output_name, @template, @multi_page) end end |