class Fullstack::Cms::InstallGenerator

Public Instance Methods

assets() click to toggle source
# 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() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 95
      def home_page_helper
        append_to_file "app/helpers/application_helper.rb", :after => "ApplicationHelper" do
%q{
 
  def home_page?
    controller_name == "site" && action_name == "home"
  end
      
}
        end
        
      end
install_fullstack_admin() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 109
def install_migrations
  generate "migration:from link menu page_part page redirect setting attachment photo text_page_part text_with_title_page_part"
end
install_settings() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 114
def install_settings
  append_to_file "config/settings.yml", "\n  copyright: \"#{Date.today.year} - #{title}\""
  
end
routes_rb() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 47
    def routes_rb
      src = '''
constraints(:host => /^#{Regexp.escape(Settings.app.domain)}/) do
   root :to => redirect("http://www.#{Settings.app.domain}")
   match "/*path", :to => redirect {|params, request| 
     query_part = request.query_string.present? ? "?#{request.query_string}" : ""  
     "http://www.#{Settings.app.domain}/#{params[:path]}#{query_part}"
   }
end
'''

      if localize
        src << '''

# root :to => redirect("/#{I18n.default_locale}/")
'''
      end

      src << '''
# namespace :site, :path => "/" do
#   mount_controller "site" 
# end
              '''
      
      route src
    end
set_localization() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 74
      def set_localization
        if !localize
          inject_into_file "config/initializers/fullstack.rb", :after => "Fullstack::Cms.configure do |config|" do
%q{
  
  config.localized = false

}            
          end 
        else  
          inject_into_file "config/initializers/fullstack.rb", :after => "Fullstack::Cms.configure do |config|" do
%q{
  
  # config.localized = false

}            
          end 

        end
      end
templates_tree() click to toggle source
# 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

Protected Instance Methods

app() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 142
def app
  Rails.application.class.to_s.split("::").first.underscore      
end
domain() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 130
def domain
  host
end
email() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 146
def email
  "info@#{host}"
end
host() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 126
def host
  options[:host]
end
localize() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 134
def localize
  options[:localize]
end
migration_timestamp() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 122
def migration_timestamp
  Time.now.strftime("%Y%m%d%H%M%S")
end
slogan() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 154
def slogan
  options[:slogan]
end
title() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 150
def title
  options[:title]      
end
user() click to toggle source
# File lib/generators/fullstack/cms/install_generator.rb, line 138
def user
   options[:user]
end