Class: Fullstack::Admin::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Fullstack::Admin::InstallGenerator
- Defined in:
- lib/generators/fullstack/admin/install_generator.rb
Instance Method Summary collapse
- #append_routes ⇒ Object
- #assets ⇒ Object
- #copy_templates ⇒ Object
- #install_ckeditor ⇒ Object
- #install_fullstack ⇒ Object
- #users ⇒ Object
Instance Method Details
#append_routes ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/generators/fullstack/admin/install_generator.rb', line 60 def append_routes src = <<-eos devise_for :administrators, :controllers => { :sessions => "admin/sessions" } namespace :admin do root :to => "dashboard#show" end eos route(src) #route("\n devise_for :users\n") end |
#assets ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/generators/fullstack/admin/install_generator.rb', line 27 def assets append_to_file "config/assets.yml" do <<-eos - admin/admin.css - admin/admin.js eos end end |
#copy_templates ⇒ Object
23 24 25 |
# File 'lib/generators/fullstack/admin/install_generator.rb', line 23 def copy_templates directory "root", Rails.root end |
#install_ckeditor ⇒ Object
13 14 15 |
# File 'lib/generators/fullstack/admin/install_generator.rb', line 13 def install_ckeditor generate "fullstack:ckeditor:install" end |
#install_fullstack ⇒ Object
17 18 19 20 21 |
# File 'lib/generators/fullstack/admin/install_generator.rb', line 17 def install_fullstack if [:fullstack] generate "fullstack:install --host='#{host}' --user='#{user}' --title='#{title}' --slogan='#{slogan}'" end end |
#users ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/generators/fullstack/admin/install_generator.rb', line 39 def users generate "migration:from administrator" generate "migration:from user" append_to_file "db/seeds.rb" do <<-eos if Rails.env.development? user = Administrator.create!( :username => "admin", :email => "[email protected]", :password => "password" ) end eos end end |