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
40 41 42 43 44 45 |
# File 'lib/generators/sunrise/install_generator.rb', line 40 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
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/generators/sunrise/install_generator.rb', line 47 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/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 31 |
# 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-unicorn', 'config/nginx-unicorn.sample') template('config/nginx-passenger', 'config/nginx-passenger.sample') end |
#copy_gitignore ⇒ Object
63 64 65 |
# File 'lib/generators/sunrise/install_generator.rb', line 63 def copy_gitignore copy_file('gitignore', '.gitignore') end |
#copy_models ⇒ Object
copy models
34 35 36 37 |
# File 'lib/generators/sunrise/install_generator.rb', line 34 def copy_models directory "models/#{orm}", "app/models/defaults" directory "models/sunrise", "app/sunrise" end |
#copy_specs ⇒ Object
58 59 60 61 |
# File 'lib/generators/sunrise/install_generator.rb', line 58 def copy_specs directory "spec", "spec" copy_file('rspec', '.rspec') end |
#copy_sunrise_assets ⇒ Object
67 68 69 70 |
# File 'lib/generators/sunrise/install_generator.rb', line 67 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
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 |