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_gitignore ⇒ Object
-
#copy_models ⇒ Object
copy models.
- #copy_specs ⇒ Object
- #copy_sunrise_assets ⇒ Object
-
#copy_uploaders ⇒ Object
copy uploaders.
-
#copy_views ⇒ Object
copy views.
Instance Method Details
#add_routes ⇒ Object
Add devise routes
42 43 44 45 46 47 |
# File 'lib/generators/sunrise/install_generator.rb', line 42 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
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/generators/sunrise/install_generator.rb', line 49 def autoload_paths log :autoload_paths, 'models/defaults' sentinel = %r{\.autoload_paths\s+\+=\s+\%W\(\#\{config\.root\}/extras\)\s*$} code = 'config.autoload_paths += %W(#{config.root}/app/models/defaults #{config.root}/app/sunrise)' in_root do inject_into_file 'config/application.rb', " #{code}\n", after: sentinel, verbose: false end end |
#copy_configurations ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/generators/sunrise/install_generator.rb', line 25 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-unicorn', 'config/nginx-unicorn.sample') template('config/nginx-passenger', 'config/nginx-passenger.sample') end |
#copy_gitignore ⇒ Object
65 66 67 |
# File 'lib/generators/sunrise/install_generator.rb', line 65 def copy_gitignore copy_file('gitignore', '.gitignore') end |
#copy_models ⇒ Object
copy models
36 37 38 39 |
# File 'lib/generators/sunrise/install_generator.rb', line 36 def copy_models directory "models/#{orm}", 'app/models/defaults' directory 'models/sunrise', 'app/sunrise' end |
#copy_specs ⇒ Object
60 61 62 63 |
# File 'lib/generators/sunrise/install_generator.rb', line 60 def copy_specs directory 'spec', 'spec' copy_file('rspec', '.rspec') end |
#copy_sunrise_assets ⇒ Object
69 70 71 72 |
# File 'lib/generators/sunrise/install_generator.rb', line 69 def copy_sunrise_assets copy_file('assets/plugins.js', 'app/assets/javascripts/sunrise/plugins.js') copy_file('assets/plugins.css', 'app/assets/stylesheets/sunrise/plugins.css') end |
#copy_uploaders ⇒ Object
copy uploaders
21 22 23 |
# File 'lib/generators/sunrise/install_generator.rb', line 21 def copy_uploaders directory 'uploaders', 'app/uploaders' end |
#copy_views ⇒ Object
copy views
16 17 18 |
# File 'lib/generators/sunrise/install_generator.rb', line 16 def copy_views directory 'views', 'app/views' end |