Class: Hyraft::Rule::TemplateCommand
- Inherits:
-
Object
- Object
- Hyraft::Rule::TemplateCommand
- Defined in:
- lib/hyraft/rule/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.
12 13 14 15 16 |
# File 'lib/hyraft/rule/template_command.rb', line 12 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
8 9 10 |
# File 'lib/hyraft/rule/template_command.rb', line 8 def self.start(args) new(args).execute end |
Instance Method Details
#execute ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/hyraft/rule/template_command.rb', line 18 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/pages/#{@resource_name}/\e[0m" end |