9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/generators/panda_cms/install_generator.rb', line 9
def create_initializer_file
initializer_path = "config/initializers/panda_cms.rb"
unless File.exist?("#{::Rails.root}/#{initializer_path}")
FileUtils.cp "#{::PandaCms::Engine.root}/#{initializer_path}", "#{::Rails.root}/#{initializer_path}"
end
unless File.read("#{::Rails.root}/db/seeds.rb")&.include?("PandaCms::Engine.load_seed")
existing_seeds = File.read("#{::Rails.root}/db/seeds.rb")
IO.write("#{::Rails.root}/db/seeds.rb", "PandaCms::Engine.load_seed\n\n#{existing_seeds}")
end
`rails db:migrate`
`rails db:seed`
end
|