Sha256: 02edfb397b10c64ed422002d6c840a9f47130722a9c514b9f45fc1b254d60414
Contents?: true
Size: 876 Bytes
Versions: 13
Compression:
Stored size: 876 Bytes
Contents
require 'rails/generators' module Hancock::Cms module Controllers class DecoratorsGenerator < Rails::Generators::Base source_root File.expand_path('../../../../../../app/controllers/concerns/hancock/decorators', __FILE__) argument :controllers, type: :array, default: [] desc 'Hancock::Cms Controllers decorators generator' def decorators copied = false (controllers == ['all'] ? permitted_controllers : controllers & permitted_controllers).each do |c| copied = true copy_file "#{c}.rb", "app/controllers/concerns/hancock/decorators/#{c}.rb" end puts "U need to set controller`s name. One of this: #{permitted_controllers.join(", ")} or `all`." unless copied end private def permitted_controllers ['home', 'sessions', 'registrations'] end end end end
Version data entries
13 entries across 13 versions & 1 rubygems