Class: Nymphia::CLI
- Inherits:
-
Object
- Object
- Nymphia::CLI
- Defined in:
- lib/nymphia/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
10 11 12 13 |
# File 'lib/nymphia/cli.rb', line 10 def initialize(argv) @argv = argv.dup parser.parse!(@argv) end |
Class Method Details
.start(argv) ⇒ Object
6 7 8 |
# File 'lib/nymphia/cli.rb', line 6 def self.start(argv) new(argv).run end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/nymphia/cli.rb', line 15 def run validate_args! dsl_code_file = File.open(@file_path) absolute_dsl_file_path = File.absolute_path(dsl_code_file.path) dsl_code = dsl_code_file.read dsl = Nymphia::DSL.new(dsl_code, absolute_dsl_file_path) dsl.compile if @output_file_path dsl.render(File.open(@output_file_path, 'w')) else dsl.render(STDOUT) end end |