Class: Cmdx::TaskGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/cmdx/task_generator.rb

Overview

Rails generator that scaffolds a new CMDx::Task subclass under ‘app/tasks`, honoring nested module paths supplied through the NAME argument (e.g. `Billing::ChargeCard` writes to `app/tasks/billing/charge_card.rb`).

Invoked via ‘rails generate cmdx:task NAME`.

See Also:

Instance Method Summary collapse

Instance Method Details

#copy_filesvoid

This method returns an undefined value.

Renders ‘task.rb.tt` into `app/tasks/<class_path>/<file_name>.rb`.



21
22
23
24
# File 'lib/generators/cmdx/task_generator.rb', line 21

def copy_files
  path = File.join("app/tasks", class_path, "#{file_name}.rb")
  template("task.rb.tt", path)
end