Class: BarrasRails::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- BarrasRails::InstallGenerator
- Defined in:
- lib/generators/barras_rails/install_generator.rb
Instance Method Summary collapse
- #add_call_to_barras_to_app_html ⇒ Object
- #add_requires_to_css ⇒ Object
- #add_requires_to_javascript ⇒ Object
- #copy_install_file ⇒ Object
- #copy_logo_uff_branco ⇒ Object
Instance Method Details
#add_call_to_barras_to_app_html ⇒ Object
39 40 41 42 43 |
# File 'lib/generators/barras_rails/install_generator.rb', line 39 def return if file_not_found('app/views/layouts/application.html.erb') inject_into_file 'app/views/layouts/application.html.erb', '<%= barras_governo_e_aplicacoes %>', after: "<body>\n" end |
#add_requires_to_css ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/barras_rails/install_generator.rb', line 21 def add_requires_to_css return if file_not_found('app/assets/stylesheets/application.css', false) inject_into_file 'app/assets/stylesheets/application.css', ' *= require barras_rails/barra_de_aplicacoes', after: %r{([\s]*\*= require [^\n]*\n)+} inject_into_file 'app/assets/stylesheets/application.css', ' *= require barras_rails/barra_do_governo', after: %r{([\s]*\*= require [^\n]*\n)+} end |
#add_requires_to_javascript ⇒ Object
32 33 34 35 36 37 |
# File 'lib/generators/barras_rails/install_generator.rb', line 32 def add_requires_to_javascript return if file_not_found('app/assets/javascripts/application.js') inject_into_file 'app/assets/javascripts/application.js', '//= require barras_rails/barras_rails', after: %r{(//= require [^\n]*\n)+} end |
#copy_install_file ⇒ Object
13 14 15 |
# File 'lib/generators/barras_rails/install_generator.rb', line 13 def copy_install_file copy_file('barras_rails.rb', 'config/initializers/barras_rails.rb') end |
#copy_logo_uff_branco ⇒ Object
17 18 19 |
# File 'lib/generators/barras_rails/install_generator.rb', line 17 def copy_logo_uff_branco copy_file('logo_uff_branco.svg', 'app/assets/images/logo_uff_branco.svg') end |