class Fullstack::Admin::InstallGenerator

Public Instance Methods

append_routes() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/generators/fullstack/admin/install_generator.rb, line 23
def copy_templates
  directory "root", Rails.root
end
install_ckeditor() click to toggle source
# File lib/generators/fullstack/admin/install_generator.rb, line 13
def install_ckeditor
  generate "fullstack:ckeditor:install"
end
install_fullstack() click to toggle source
# File lib/generators/fullstack/admin/install_generator.rb, line 17
def install_fullstack
  if options[:fullstack]
    generate "fullstack:install  --host='#{host}' --user='#{user}'  --title='#{title}' --slogan='#{slogan}'"
  end
end
users() click to toggle source
# 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 => "admin@example.com",
                    :password => "password" 
                    )
end
  
eos
          
        end
      
      end

Protected Instance Methods

app() click to toggle source
# File lib/generators/fullstack/admin/install_generator.rb, line 88
def app
  Rails.application.class.to_s.split("::").first.underscore      
end
email() click to toggle source
# File lib/generators/fullstack/admin/install_generator.rb, line 92
def email
  "info@#{host}"
end
host() click to toggle source
# File lib/generators/fullstack/admin/install_generator.rb, line 80
def host
  options[:host]
end
migration_timestamp() click to toggle source
# File lib/generators/fullstack/admin/install_generator.rb, line 76
def migration_timestamp
  Time.now.strftime("%Y%m%d%H%M%S")
end
slogan() click to toggle source
# File lib/generators/fullstack/admin/install_generator.rb, line 100
def slogan
  options[:slogan]
end
title() click to toggle source
# File lib/generators/fullstack/admin/install_generator.rb, line 96
def title
  options[:title]      
end
user() click to toggle source
# File lib/generators/fullstack/admin/install_generator.rb, line 84
def user
   options[:user]
end