Class: Lines::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Lines::InstallGenerator
- Defined in:
- lib/generators/lines/install_generator.rb
Instance Method Summary collapse
- #add_routes ⇒ Object
- #add_user ⇒ Object
- #copy_config ⇒ Object
- #copy_stylesheets ⇒ Object
- #copy_views ⇒ Object
- #display_readme ⇒ Object
- #install_migrations ⇒ Object
- #load_seeds ⇒ Object
Instance Method Details
#add_routes ⇒ Object
11 12 13 |
# File 'lib/generators/lines/install_generator.rb', line 11 def add_routes route 'mount Lines::Engine => "/blog"' end |
#add_user ⇒ Object
37 38 39 40 41 |
# File 'lib/generators/lines/install_generator.rb', line 37 def add_user if yes?("Would you like to create an admin user? (y/N):") rake 'lines:add_user' end end |
#copy_config ⇒ Object
27 28 29 |
# File 'lib/generators/lines/install_generator.rb', line 27 def copy_config copy_file "../../../config/lines_config.yml", 'config/lines_config.yml' end |
#copy_stylesheets ⇒ Object
15 16 17 18 |
# File 'lib/generators/lines/install_generator.rb', line 15 def copy_stylesheets FileUtils.mkdir_p "app/assets/stylesheets/lines" directory('../../../app/assets/stylesheets/lines/', 'app/assets/stylesheets/lines/', {:exclude_pattern => /admin/} ) end |
#copy_views ⇒ Object
20 21 22 23 24 25 |
# File 'lib/generators/lines/install_generator.rb', line 20 def copy_views directory('../../../app/views/lines', 'app/views/lines/', {:exclude_pattern => /admin|sessions/}) directory('../../../app/views/kaminari', 'app/views/kaminari/') copy_file('../../../app/views/layouts/lines/application.html.erb', 'app/views/layouts/lines/application.html.erb') copy_file('../../../app/views/layouts/lines/preview.html.erb', 'app/views/layouts/lines/preview.html.erb') end |
#display_readme ⇒ Object
43 44 45 |
# File 'lib/generators/lines/install_generator.rb', line 43 def display_readme readme 'README' end |
#install_migrations ⇒ Object
7 8 9 |
# File 'lib/generators/lines/install_generator.rb', line 7 def install_migrations rake "lines:install:migrations" end |
#load_seeds ⇒ Object
32 33 34 35 |
# File 'lib/generators/lines/install_generator.rb', line 32 def load_seeds FileUtils.mkdir_p "vendor/screenshots" copy_file './templates/octorel.png', 'vendor/screenshots/octorel.png' end |