Sha256: 1e3af96136725c801cc794001f325ae515a231f0c9c9ceb79a61aeca93d143d3
Contents?: true
Size: 1.16 KB
Versions: 23
Compression:
Stored size: 1.16 KB
Contents
require 'rails/generators' class NafGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) argument :schema_name, type: :string, default: "naf" def add_configuration_files filename = "naf.rb" filepath = "config/initializers/#{filename}" path = "#{Rails.root}/#{filepath}" if File.exists?(path) puts "Skipping #{filepath} creation, as file already exists!" else puts "Adding Naf initializer (#{filepath})..." template filename, path end end def add_log4r_configuration_files directory "config" end def add_layouts_file filename = "naf_layout.html.erb" filepath = "app/views/layouts/#{filename}" path = "#{Rails.root}/#{filepath}" if File.exists?(path) puts "Skipping #{filepath} creation, as file already exists!" else puts "Adding naf_layout (#{filepath})..." template filename, path end end def mount_engine puts "Mounting Naf::Engine at \"/job_system\" in config/routes.rb..." insert_into_file("#{Rails.root}/config/routes.rb", after: /routes.draw.do\n/) do %Q{\n mount Naf::Engine, at: "/job_system"\n} end end end
Version data entries
23 entries across 23 versions & 1 rubygems