Class: Hyraft::Rule::Template::TemplateCommand
- Inherits:
-
Object
- Object
- Hyraft::Rule::Template::TemplateCommand
- Defined in:
- lib/hyraft/rule/template/template_command.rb
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(args) ⇒ TemplateCommand
constructor
A new instance of TemplateCommand.
Constructor Details
#initialize(args) ⇒ TemplateCommand
Returns a new instance of TemplateCommand.
13 14 15 16 17 |
# File 'lib/hyraft/rule/template/template_command.rb', line 13 def initialize(args) @resource_input = args[0] # "users" or "admin-app/users" @target_dir = args[1] || "." parse_resource_input end |
Class Method Details
.start(args) ⇒ Object
9 10 11 |
# File 'lib/hyraft/rule/template/template_command.rb', line 9 def self.start(args) new(args).execute end |
Instance Method Details
#execute ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/hyraft/rule/template/template_command.rb', line 19 def execute return show_usage unless @resource_name puts "\e[36m📝 Generating .hyr templates for '#{@resource_name}'\e[0m" generate_templates puts "\e[32m✅ Templates generated in #{@app_folder}/display/#{@resource_name}/\e[0m" end |