Class: Parspec::Cli
Instance Method Summary collapse
Instance Method Details
#header ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/parspec/cli.rb', line 24 def header @header || <<HEADER # coding: utf-8 require 'spec_helper' require 'parslet/convenience' require 'parslet/rig/rspec' HEADER end |
#run(options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/parspec/cli.rb', line 10 def run( = {}) @options = parse_command_line! init_output_dir puts "Translating #@input #{@print_only ? ' ': "to #@output " }..." translation = header + Parspec.translate(@input, @options) if @print_only puts translation exit end File.open(@output, 'w') { |file| file.write(translation) } self end |