Class: Riveter::Generators::CommandGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Riveter::Generators::CommandGenerator
- Defined in:
- lib/generators/riveter/command/command_generator.rb
Instance Method Summary collapse
- #create_command_file ⇒ Object
- #create_locale_file ⇒ Object
- #create_module_file ⇒ Object
-
#initialize(args, *options) ⇒ CommandGenerator
constructor
A new instance of CommandGenerator.
Constructor Details
#initialize(args, *options) ⇒ CommandGenerator
Returns a new instance of CommandGenerator.
16 17 18 19 |
# File 'lib/generators/riveter/command/command_generator.rb', line 16 def initialize(args, *) super parse_command_attributes! end |
Instance Method Details
#create_command_file ⇒ Object
21 22 23 |
# File 'lib/generators/riveter/command/command_generator.rb', line 21 def create_command_file template 'command.rb', File.join('app/commands', class_path, "#{file_name}_command.rb") end |
#create_locale_file ⇒ Object
30 31 32 |
# File 'lib/generators/riveter/command/command_generator.rb', line 30 def create_locale_file template 'commands.en.yml', File.join('config/locales', 'commands.en.yml') unless locale_file_exists? end |
#create_module_file ⇒ Object
25 26 27 28 |
# File 'lib/generators/riveter/command/command_generator.rb', line 25 def create_module_file return if regular_class_path.empty? template 'module.rb', File.join('app/commands', "#{class_path.join('/')}.rb") if behavior == :invoke end |