Class: Fullstack::Admin::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/fullstack/admin/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#append_routesObject



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

#assetsObject



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_templatesObject



23
24
25
# File 'lib/generators/fullstack/admin/install_generator.rb', line 23

def copy_templates
  directory "root", Rails.root
end

#install_ckeditorObject



13
14
15
# File 'lib/generators/fullstack/admin/install_generator.rb', line 13

def install_ckeditor
  generate "fullstack:ckeditor:install"
end

#install_fullstackObject



17
18
19
20
21
# 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

#usersObject



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