Sha256: e24d1785f45e686e1b3db2dfc2bc16119a1c2857301fd11a3e4c7e3bb8cc07da
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
module JsonVoorhees class EngineCreateControllerGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) argument :module_name, :type => :string argument :resource_name, :type => :string argument :api_version, :type => :string, :default => "1" class_option :authorization, :type => :boolean, :default => true, :description => "Include authorization in controller" def sprint if options.authorization? template "controller_template.rb.erb", "app/controllers/#{module_name.underscore}/api/v#{api_version}/#{resource_plural}_controller.rb" else template "no_auth_controller_template.rb.erb", "app/controllers/#{module_name.underscore}/api/v#{api_version}/#{resource_plural}_controller.rb" end end private def resource_singular resource_name.underscore.singularize end def resource_plural resource_name.underscore.pluralize end def resource_camel resource_name.camelize.singularize end def module_camel module_name.camelize end def module_snake module_name.underscore.downcase end end end
Version data entries
2 entries across 2 versions & 1 rubygems