Class: Plans::New
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
Methods inherited from Command
#check_plans_pathname_exists, #initialize, #pathname, #plans_pathname, #raise_error, source_root
Constructor Details
This class inherits a constructor from Plans::Command
Instance Method Details
#check_doc_path_exists(doc_path, plans_path, doc_type) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/plans/new.rb', line 19 def check_doc_path_exists(doc_path, plans_path, doc_type) unless doc_path.exist? say "Cannot create DOC_TYPE #{doc_type} because this template does not exist.", :red say 'Try `plans list` to see the available DOC_TYPEs or' say 'check the templates in the .plans directory here:' say " #{plans_path}" raise_error("DOC_TYPE #{doc_type} does not exist.") end end |
#do(doc_type) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/plans/new.rb', line 6 def do(doc_type) plans_path = plans_pathname(@options[:'plans-path']) check_plans_pathname_exists plans_path doc_path = plans_path + doc_type check_doc_path_exists(doc_path, plans_path, doc_type) # Set the Thor::Actions destination root to the current working directory. self.destination_root = '.' # copy the template directory, but don't include the reference word docs. directory(doc_path, "./#{doc_type}", :exclude_pattern => /docx/) end |