Class: PagesCore::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- PagesCore::Generators::InstallGenerator
- Defined in:
- lib/rails/generators/pages_core/install/install_generator.rb
Instance Method Summary collapse
- #create_application_controller ⇒ Object
- #create_application_helper ⇒ Object
- #create_default_template ⇒ Object
- #create_frontend_controller ⇒ Object
- #create_frontend_helper ⇒ Object
- #create_gitignore ⇒ Object
- #create_initializer_file ⇒ Object
- #create_pages_controller ⇒ Object
- #create_template_initializer ⇒ Object
- #default_app_name ⇒ Object
- #read_configuration! ⇒ Object
Instance Method Details
#create_application_controller ⇒ Object
25 26 27 28 |
# File 'lib/rails/generators/pages_core/install/install_generator.rb', line 25 def create_application_controller template("application_controller.rb", File.join("app/controllers/application_controller.rb")) end |
#create_application_helper ⇒ Object
30 31 32 33 |
# File 'lib/rails/generators/pages_core/install/install_generator.rb', line 30 def create_application_helper template("application_helper.rb", File.join("app/helpers/application_helper.rb")) end |
#create_default_template ⇒ Object
50 51 52 53 |
# File 'lib/rails/generators/pages_core/install/install_generator.rb', line 50 def create_default_template copy_file("default_page_template.html.erb", File.join("app/views/pages/templates/index.html.erb")) end |
#create_frontend_controller ⇒ Object
35 36 37 38 |
# File 'lib/rails/generators/pages_core/install/install_generator.rb', line 35 def create_frontend_controller template("frontend_controller.rb", File.join("app/controllers/frontend_controller.rb")) end |
#create_frontend_helper ⇒ Object
40 41 42 43 |
# File 'lib/rails/generators/pages_core/install/install_generator.rb', line 40 def create_frontend_helper template("frontend_helper.rb", File.join("app/helpers/frontend_helper.rb")) end |
#create_gitignore ⇒ Object
67 68 69 |
# File 'lib/rails/generators/pages_core/install/install_generator.rb', line 67 def create_gitignore template "gitignore.erb", File.join(".gitignore") end |
#create_initializer_file ⇒ Object
55 56 57 58 59 |
# File 'lib/rails/generators/pages_core/install/install_generator.rb', line 55 def create_initializer_file read_configuration! template("pages_initializer.rb", File.join("config/initializers/pages.rb")) end |
#create_pages_controller ⇒ Object
45 46 47 48 |
# File 'lib/rails/generators/pages_core/install/install_generator.rb', line 45 def create_pages_controller template("pages_controller.rb", File.join("app/controllers/pages_controller.rb")) end |
#create_template_initializer ⇒ Object
61 62 63 64 65 |
# File 'lib/rails/generators/pages_core/install/install_generator.rb', line 61 def create_template_initializer read_configuration! template("page_templates_initializer.rb", File.join("config/initializers/page_templates.rb")) end |
#default_app_name ⇒ Object
9 10 11 |
# File 'lib/rails/generators/pages_core/install/install_generator.rb', line 9 def default_app_name Rails.root.to_s.split("/").last end |
#read_configuration! ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rails/generators/pages_core/install/install_generator.rb', line 13 def read_configuration! @app_name ||= ask_with_fallback("App name?", default_app_name) @site_name ||= ask_with_fallback("Site name?", @app_name.humanize) @domain_name ||= ask_with_fallback("Domain name?", "#{@app_name}.no") @default_sender ||= ask_with_fallback( "Default sender?", "no-reply@#{@domain_name}" ) nil end |