Sha256: 46c79df0dd65eb47507a02ce5601e9298be59c63be25e6c394b8a8b92c35894f
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
require 'rails' require 'rails/generators/active_record' module Coalla module Cms module Lookups class InstallGenerator < ActiveRecord::Generators::Base argument :name, type: :string, default: "" source_root File.expand_path("../../../../../../", __FILE__) class_option :copy, type: :boolean, default: false, description: "Copy all files to project" def copy_files migration_template "lib/generators/coalla/cms/lookups/templates/migration.rb", "db/migrate/create_lookups.rb" if options.copy? [ 'app/views/admin/lookups/_form.html.haml', 'app/views/admin/lookups/edit.html.haml', 'app/views/admin/lookups/index.html.haml', 'app/views/admin/lookups/show.html.haml', 'app/controllers/admin/lookups_controller.rb', 'app/models/lookup.rb', 'app/helpers/lookup_helper.rb' ].each do |path| copy_file path, path end end end def setup_routes sentinel = /namespace :admin do\s*$/ routing_code = " resources :lookups" in_root do inject_into_file 'config/routes.rb', "\n #{routing_code}", { :after => sentinel, :verbose => false } end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
coalla-cms-0.4.2.0 | lib/generators/coalla/cms/lookups/install_generator.rb |
coalla-cms-0.4.4.3 | lib/generators/coalla/cms/lookups/install_generator.rb |