Sha256: a995c53605c5d2fbdc88c8dfe06ae9b631bf6a371522d4efc2b59e4ffd803f57
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
module Generators module Panda module CMS class InstallGenerator < ::Rails::Generators::Base source_root File.expand_path("templates", __dir__) namespace "panda:cms:install" desc "Adds the basic configuration for Panda CMS to your Rails app." def create_initializer_file # Add the initializer initializer_path = "config/initializers/panda/cms.rb" unless File.exist?("#{::Rails.root}/#{initializer_path}") FileUtils.cp "#{::Panda::CMS::Engine.root}/#{initializer_path}", "#{::Rails.root}/#{initializer_path}" end # Add the seed loader to the seeds.rb file unless File.read("#{::Rails.root}/db/seeds.rb")&.include?("Panda::CMS::Engine.load_seed") existing_seeds = File.read("#{::Rails.root}/db/seeds.rb") IO.write("#{::Rails.root}/db/seeds.rb", "Panda::CMS::Engine.load_seed\n\n#{existing_seeds}") end `rails db:migrate` `rails db:seed` end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
panda-cms-0.7.3 | lib/generators/panda/cms/install_generator.rb |
panda-cms-0.7.2 | lib/generators/panda/cms/install_generator.rb |
panda-cms-0.7.0 | lib/generators/panda/cms/install_generator.rb |