class PagesCms::Generators::InstallGenerator

Public Instance Methods

add_route() click to toggle source
# File lib/generators/pages_cms/install_generator.rb, line 18
def add_route
  route "mount PagesCms::Engine => '/'"
end
copy_migrations() click to toggle source
# File lib/generators/pages_cms/install_generator.rb, line 6
def copy_migrations
  puts ' '
  puts '  Installing PagesCMS'
  say set_color('         run', :green, true) + '  installing migrations'
  `rake pages_cms:install:migrations`
end
create_initializer_file() click to toggle source
# File lib/generators/pages_cms/install_generator.rb, line 22
      def create_initializer_file
        create_file "config/initializers/pages_cms.rb", <<-'RUBY'
module PagesCms
  TITLE       = 'Site Name'
  AUTHOR      = 'Your Name'
  EMAIL       = 'example@email.com'
  DESCRIPTION = 'description'
  KEYWORDS    = 'keyword,keyword'

  module PagesCmsAdminFilters

    # def self.included(base)
    #   base.before_filter :authenticate_admin!
    # end
    #
    # def authenticate_admin!
    #   redirect_to root_path unless logged_in_admin?
    # end

  end

  module PagesCmsAppFilters

    # def self.included(base)
    #   base.before_filter :authenticate_user!
    # end
    #
    # def authenticate_user!
    #   redirect_to root_path unless logged_in?
    # end

  end
end

module PagesCmsHelpers
  def logged_in_admin?
    # todo: write a method that checks if an administrator is logged in.
    # this method is only used in view logic. If you don't want to include this,
    # simply override the nav bar and the application layout.
    true
  end
end
        RUBY
      end
instructions() click to toggle source
# File lib/generators/pages_cms/install_generator.rb, line 67
def instructions
  puts '  Remember to create a default image at: public/defaults/default.jpg'
  puts ' '
end
run_migrations() click to toggle source
# File lib/generators/pages_cms/install_generator.rb, line 13
def run_migrations
  say set_color('         run', :green, true) + '  migrating database'
  `rake db:migrate`
end