Class: Sunrise::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Sunrise::Generators::InstallGenerator
- Defined in:
- lib/generators/sunrise/install_generator.rb
Instance Method Summary collapse
-
#add_routes ⇒ Object
Add devise routes.
- #autoload_paths ⇒ Object
- #copy_configurations ⇒ Object
-
#copy_models ⇒ Object
copy models.
- #copy_specs ⇒ Object
-
#copy_uploaders ⇒ Object
copy uploaders.
-
#copy_views ⇒ Object
copy views.
Instance Method Details
#add_routes ⇒ Object
Add devise routes
39 40 41 42 43 44 |
# File 'lib/generators/sunrise/install_generator.rb', line 39 def add_routes route 'root :to => "welcome#index"' route "resources :pages, :only => [:show]" route "devise_for :users" route "mount Sunrise::Engine => '/manage'" end |
#autoload_paths ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/generators/sunrise/install_generator.rb', line 46 def autoload_paths log :autoload_paths, "models/defaults" sentinel = /\.autoload_paths\s+\+=\s+\%W\(\#\{config\.root\}\/extras\)\s*$/ code = 'config.autoload_paths += %W(#{config.root}/app/models/defaults #{config.root}/app/models/sunrise)' in_root do inject_into_file 'config/application.rb', " #{code}\n", { :after => sentinel, :verbose => false } end end |
#copy_configurations ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/generators/sunrise/install_generator.rb', line 23 def copy_configurations copy_file('config/seeds.rb', 'db/seeds.rb') copy_file("config/#{orm}/sunrise.rb", 'config/initializers/sunrise.rb') template('config/database.yml', 'config/database.yml.sample') template('config/logrotate-config', 'config/logrotate-config.sample') template('config/nginx-config', 'config/nginx-config.sample') end |
#copy_models ⇒ Object
copy models
33 34 35 36 |
# File 'lib/generators/sunrise/install_generator.rb', line 33 def copy_models directory "models/#{orm}", "app/models/defaults" directory "models/sunrise", "app/models/sunrise" end |
#copy_specs ⇒ Object
57 58 59 60 |
# File 'lib/generators/sunrise/install_generator.rb', line 57 def copy_specs directory "spec", "spec" copy_file('rspec', '.rspec') end |
#copy_uploaders ⇒ Object
copy uploaders
19 20 21 |
# File 'lib/generators/sunrise/install_generator.rb', line 19 def copy_uploaders directory "uploaders", "app/uploaders" end |
#copy_views ⇒ Object
copy views
14 15 16 |
# File 'lib/generators/sunrise/install_generator.rb', line 14 def copy_views directory "views", "app/views" end |