class TheRoleGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) # argument :xname, type: :string, default: :xname def generate_controllers if gen_name == 'install' cp_setup else puts 'TheComments Generator - wrong Name' puts 'Try to use install' end end private def gen_name name.to_s.downcase end def cp_setup copy_file 'the_role.rb', 'config/initializers/the_role.rb' end end