Sha256: 417354bf7b95a324ed4d41761c8155d876bbf4e4035e2afb2db1b89fa2fe937a
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
require 'rails/generators' module Hancock::Catalog::Models class AllGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) argument :class_name, type: :string argument :category_class_name_arg, type: :string, default: "" argument :image_class_name_arg, type: :string, default: "" argument :category_image_class_name_arg, type: :string, default: "" desc 'Hancock::Catalog Models generator' def all generate "hancock:catalog:models:item #{camelcased_class_name}" generate "hancock:catalog:models:category #{category_class_name}" generate "hancock:catalog:models:item_image #{image_class_name}" generate "hancock:catalog:models:category_image #{category_image_class_name}" end private def capitalized_class_name class_name.capitalize end def camelcased_class_name class_name.camelcase end def category_class_name category_class_name_arg.blank? ? "#{camelcased_class_name}Category" : category_class_name_arg end def image_class_name image_class_name_arg.blank? ? "#{camelcased_class_name}Image" : image_class_name_arg end def category_image_class_name category_image_class_name_arg.blank? ? "#{camelcased_class_name}CategoryImage" : category_image_class_name_arg end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hancock_cms_catalog-1.0.2 | lib/generators/hancock/catalog/models/all_generator.rb |