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
39 40 41 42 43 |
# File 'lib/generators/lines/install_generator.rb', line 39 def add_user if yes?("Would you like to create an admin user? (y/N):") rake 'lines:add_user' end end |
#copy_config ⇒ Object
29 30 31 |
# File 'lib/generators/lines/install_generator.rb', line 29 def copy_config copy_file "../../../config/lines_config.yml", 'config/lines_config.yml' end |
#copy_stylesheets ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/generators/lines/install_generator.rb', line 15 def copy_stylesheets FileUtils.mkdir_p "app/assets/stylesheets/lines" copy_file "../../../app/assets/stylesheets/lines/style.css.scss", "app/assets/stylesheets/lines/style.css.scss" copy_file "../../../app/assets/stylesheets/lines/media_queries.css.scss", "app/assets/stylesheets/lines/media_queries.css.scss" copy_file "../../../app/assets/stylesheets/lines/navbar.css.scss", "app/assets/stylesheets/lines/navbar.css.scss" copy_file "../../../app/assets/stylesheets/lines/pygments.css.erb", "app/assets/stylesheets/lines/pygments.css.erb" end |
#copy_views ⇒ Object
23 24 25 26 27 |
# File 'lib/generators/lines/install_generator.rb', line 23 def copy_views directory('../../../app/views/lines', 'app/views/lines/', {:exclude_pattern => /admin|sessions/}) 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
45 46 47 |
# File 'lib/generators/lines/install_generator.rb', line 45 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
34 35 36 37 |
# File 'lib/generators/lines/install_generator.rb', line 34 def load_seeds FileUtils.mkdir_p "vendor/screenshots" copy_file './templates/octorel.png', 'vendor/screenshots/octorel.png' end |