Class: PagesCms::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- PagesCms::Generators::InstallGenerator
- Defined in:
- lib/generators/pages_cms/install_generator.rb
Instance Method Summary collapse
- #add_route ⇒ Object
- #copy_migrations ⇒ Object
- #create_initializer_file ⇒ Object
- #instructions ⇒ Object
- #run_migrations ⇒ Object
Instance Method Details
#add_route ⇒ Object
18 19 20 |
# File 'lib/generators/pages_cms/install_generator.rb', line 18 def add_route route "mount PagesCms::Engine => '/'" end |
#copy_migrations ⇒ Object
6 7 8 9 10 11 |
# 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 ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# 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 = '[email protected]' 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 ⇒ Object
67 68 69 70 |
# 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 ⇒ Object
13 14 15 16 |
# 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 |