class Alchemy::Generators::InstallGenerator
Public Instance Methods
copy_config()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 56 def copy_config copy_file "#{gem_config_path}/config.yml", app_config_path.join("alchemy", "config.yml") end
copy_demo_views()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 72 def copy_demo_views return if options[:skip_demo_files] copy_file "application.html.erb", app_views_path.join("layouts", "application.html.erb") copy_file "article.css", app_assets_path.join("stylesheets", "alchemy", "elements", "_article.css") stylesheet_require = %(@import "alchemy/elements/article";\n) if File.exist?(app_assets_path.join("stylesheets", "application.css")) prepend_file app_assets_path.join("stylesheets", "application.css"), stylesheet_require else create_file app_assets_path.join("stylesheets", "application.css"), stylesheet_require end copy_file "_article.html.erb", app_views_path.join("alchemy", "elements", "_article.html.erb") copy_file "_standard.html.erb", app_views_path.join("alchemy", "page_layouts", "_standard.html.erb") copy_file "alchemy.en.yml", app_config_path.join("locales", "alchemy.en.yml") end
copy_dragonfly_config()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 90 def copy_dragonfly_config template( "#{__dir__}/templates/dragonfly.rb.tt", app_config_path.join("initializers", "dragonfly.rb"), skip: options[:auto_accept] ) end
copy_yml_files()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 60 def copy_yml_files %w[elements page_layouts menus].each do |file| template "#{__dir__}/templates/#{file}.yml.tt", app_config_path.join("alchemy", "#{file}.yml") end end
finalize()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 119 def finalize header say "Alchemy successfully installed!" say "Now start the server with:\n\n" say " bin/rails server\n\n" say "and point your browser to\n\n" say " http://localhost:3000/admin\n\n" say "and follow the onscreen instructions to finalize the installation.\n\n" end
install_assets()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 66 def install_assets copy_file "all.js", app_vendor_assets_path.join("javascripts", "alchemy", "admin", "all.js") copy_file "custom.css", app_assets_path.join("stylesheets/alchemy/admin/custom.css") append_to_file Rails.root.join("app/assets/config/manifest.js"), "//= link alchemy/admin/custom.css\n" end
install_gutentag_migrations()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 98 def install_gutentag_migrations rake "gutentag:install:migrations" end
mount()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 50 def mount return if options[:skip_mount] install_tasks.inject_routes(options[:auto_accept]) end
set_primary_language()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 102 def set_primary_language header install_tasks.set_primary_language( code: options[:default_language_code], name: options[:default_language_name], auto_accept: options[:auto_accept] ) end
setup()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 44 def setup header say "Welcome to AlchemyCMS!" say "Let's begin with some questions.\n\n" end
setup_database()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 111 def setup_database rake("db:create", abort_on_failure: true) unless options[:skip_db_create] # We can't invoke this rake task, because Rails will use wrong engine names otherwise rake("alchemy:install:migrations", abort_on_failure: true) rake("db:migrate", abort_on_failure: true) install_tasks.inject_seeder end
Private Instance Methods
app_assets_path()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 157 def app_assets_path @_app_assets_path ||= app_root.join("app", "assets") end
app_config_path()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 149 def app_config_path @_app_config_path ||= app_root.join("config") end
app_root()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 165 def app_root @_app_root ||= Rails.root end
app_vendor_assets_path()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 161 def app_vendor_assets_path @_app_vendor_assets_path ||= app_root.join("vendor", "assets") end
app_views_path()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 153 def app_views_path @_app_views_path ||= app_root.join("app", "views") end
gem_config_path()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 145 def gem_config_path @_config_path ||= File.expand_path("../../../../config/alchemy", __dir__) end
header()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 131 def header return if options[:auto_accept] puts "─────────────────────" puts "* Alchemy Installer *" puts "─────────────────────" end
install_tasks()
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 169 def install_tasks @_install_tasks ||= Alchemy::Install::Tasks.new end
say(something)
click to toggle source
# File lib/generators/alchemy/install/install_generator.rb, line 139 def say(something) return if options[:auto_accept] puts " #{something}" end