Class: RailsBlogEngine::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- RailsBlogEngine::InstallGenerator
- Defined in:
- lib/generators/rails_blog_engine/install/install_generator.rb
Instance Method Summary collapse
- #add_route ⇒ Object
- #copy_initializer_file ⇒ Object
- #copy_locales ⇒ Object
- #copy_migrations ⇒ Object
- #copy_sidebar ⇒ Object
- #copy_stylesheets ⇒ Object
- #register_javascripts ⇒ Object
- #register_stylesheets ⇒ Object
Instance Method Details
#add_route ⇒ Object
8 9 10 |
# File 'lib/generators/rails_blog_engine/install/install_generator.rb', line 8 def add_route route 'mount RailsBlogEngine::Engine => "/blog"' end |
#copy_initializer_file ⇒ Object
4 5 6 |
# File 'lib/generators/rails_blog_engine/install/install_generator.rb', line 4 def copy_initializer_file copy_file "rails_blog_engine.rb", "config/initializers/rails_blog_engine.rb" end |
#copy_locales ⇒ Object
19 20 21 |
# File 'lib/generators/rails_blog_engine/install/install_generator.rb', line 19 def copy_locales copy_matching_files_from_gem('config/locales/rails_blog_engine.*.yml') end |
#copy_migrations ⇒ Object
12 13 14 15 16 17 |
# File 'lib/generators/rails_blog_engine/install/install_generator.rb', line 12 def copy_migrations # Normally, we'd just call 'rake # "rails_blog_engine:install:migrations"' to do this for us, but it's # much more difficult to test. So we roll our own version. copy_matching_files_from_gem('db/migrate/*.rb') end |
#copy_sidebar ⇒ Object
23 24 25 |
# File 'lib/generators/rails_blog_engine/install/install_generator.rb', line 23 def copy_matching_files_from_gem('app/views/layouts/rails_blog_engine/_sidebar.html.haml') end |
#copy_stylesheets ⇒ Object
27 28 29 30 31 |
# File 'lib/generators/rails_blog_engine/install/install_generator.rb', line 27 def copy_stylesheets copy_matching_files_from_gem('lib/assets/stylesheets/rails_blog_engine/_config.css.scss') copy_matching_files_from_gem('lib/assets/stylesheets/rails_blog_engine/layout.css.scss') copy_matching_files_from_gem('lib/assets/stylesheets/rails_blog_engine/customizations.css.scss') end |
#register_javascripts ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/generators/rails_blog_engine/install/install_generator.rb', line 33 def register_javascripts in_root do append_file("app/assets/javascripts/application.js", "//= require rails_blog_engine\n", :before => /^\/\/= require/) end end |
#register_stylesheets ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/generators/rails_blog_engine/install/install_generator.rb', line 41 def register_stylesheets in_root do inject_into_file("app/assets/stylesheets/application.css", " *= require rails_blog_engine\n", :before => /^\*\//) end end |