Class: Chive::Generators::ControllersGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ModuleFunctions
Defined in:
lib/generators/chive/controllers_generator.rb

Defined Under Namespace

Modules: ModuleFunctions

Instance Method Summary collapse

Methods included from ModuleFunctions

controller_names, controller_path

Instance Method Details

#manifestObject

This option is not necessary while there is only one controller class_option :only, type: :array, enum: ModuleFunctions.controller_names, default: [], desc: ‘Select controllers (default is all)’



30
31
32
33
34
35
36
37
# File 'lib/generators/chive/controllers_generator.rb', line 30

def manifest
  puts 'running'
  controller_names.each do |name|
    # This option is not necessary while there is only one controller
    # next unless options[:only].empty? || file.start_with?(options[:only])
    copy_file "chive/#{name}_controller.rb", "app/controllers/chive/#{name}_controller.rb"
  end
end