Class: Fullstack::Cms::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Fullstack::Cms::InstallGenerator
- Defined in:
- lib/generators/fullstack/cms/install_generator.rb
Instance Method Summary collapse
- #assets ⇒ Object
- #home_page_helper ⇒ Object
- #install_fullstack_admin ⇒ Object
- #install_libraries ⇒ Object
- #install_migrations ⇒ Object
- #routes_rb ⇒ Object
- #set_localization ⇒ Object
- #templates_tree ⇒ Object
Instance Method Details
#assets ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/generators/fullstack/cms/install_generator.rb', line 36 def assets append_to_file "config/assets.yml" do <<-eos - site/site.css - site/site.js eos end end |
#home_page_helper ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/generators/fullstack/cms/install_generator.rb', line 94 def home_page_helper append_to_file "app/controllers/application_controller.rb", :after => "protect_from_forgery" do %q{ helper_method :home_page? protected def home_page? self.class == Site::SiteController && action_name == "home" end } end end |
#install_fullstack_admin ⇒ Object
12 13 14 |
# File 'lib/generators/fullstack/cms/install_generator.rb', line 12 def install_fullstack_admin generate "fullstack:admin:install --host='#{host}' --user='#{user}' --title='#{title}' --slogan='#{slogan}'" end |
#install_libraries ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/generators/fullstack/cms/install_generator.rb', line 16 def install_libraries generate "ars_permalink:install" generate "has_attached:install" generate "acts_as_taggable_on:migration" end |
#install_migrations ⇒ Object
112 113 114 |
# File 'lib/generators/fullstack/cms/install_generator.rb', line 112 def install_migrations generate "migration:from link menu page_part page redirect setting attachment photo text_page_part text_with_title_page_part" end |
#routes_rb ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/generators/fullstack/cms/install_generator.rb', line 47 def routes_rb if !localize route ''' constraints(:host => /^#{Regexp.escape(Settings.app.domain)}/) do root :to => redirect("http://www.#{Settings.app.domain}") match \'/*path\', :to => redirect {|params| "http://www.#{Settings.app.domain}/#{params[:path]}"} end # namespace :site, :path => "/" do # mount_controller "site" # end ''' else route ''' constraints(:host => /^#{Regexp.escape(Settings.app.domain)}/) do root :to => redirect("http://www.#{Settings.app.domain}/#{I18n.default_locale}/") match \'/*path\', :to => redirect {|params| "http://www.#{Settings.app.domain}/#{params[:path]}"} end # root :to => redirect("/#{I18n.default_locale}/") # namespace :site, :path => "/" do # mount_controller "site" # end ''' end end |
#set_localization ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/generators/fullstack/cms/install_generator.rb', line 80 def set_localization if !localize inject_into_file "config/fullstack.rb", :after => "Fullstack::Cms.configure do |config|" do %q{ config.localized = false } end end end |
#templates_tree ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/fullstack/cms/install_generator.rb', line 24 def templates_tree remove_file "public" remove_file "app/assets/javascripts/application.js" remove_file "app/assets/javascripts/application.css" remove_file "app/views/layouts/application.html.erb" remove_file "public/404.html" remove_file "public/robots.txt" remove_file "config/styles.yml" directory "rails", Rails.root end |