Class: DevelopWithPassion::Expander::CLIInterface
- Defined in:
- lib/developwithpassion_expander/cli_interface.rb
Instance Method Summary collapse
- #ensure_expansion_file_provided(file) ⇒ Object
- #get_expansion_file_name(args) ⇒ Object
- #run(args = []) ⇒ Object
- #startup ⇒ Object
Instance Method Details
#ensure_expansion_file_provided(file) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/developwithpassion_expander/cli_interface.rb', line 20 def ensure_expansion_file_provided(file) unless File.exist?(file) print <<-prompt dwp_expand aborted! No Expansionfile found (looking for: Expansionfile) prompt exit end end |
#get_expansion_file_name(args) ⇒ Object
16 17 18 |
# File 'lib/developwithpassion_expander/cli_interface.rb', line 16 def get_expansion_file_name(args) return args.count > 0 ? args[0] : "Expansionfile" end |
#run(args = []) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/developwithpassion_expander/cli_interface.rb', line 30 def run(args = []) file_to_run = get_expansion_file_name(args) ensure_expansion_file_provided file_to_run startup enable_logging log "Running Expansions defined in file:#{file_to_run}" load file_to_run Expansion.instance.run end |
#startup ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/developwithpassion_expander/cli_interface.rb', line 4 def startup [ TemplateProcessors, TemplateVisitor, Expansion, Shell ].each{|item| item.send(:include,Singleton)} TemplateProcessors.instance.register_processor(:erb,ERBTemplateFile.new) TemplateProcessors.instance.register_processor(:mustache,MustacheTemplateFile.new) end |