Class: BarrasRails::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/barras_rails/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_call_to_barras_to_app_htmlObject



39
40
41
42
43
# File 'lib/generators/barras_rails/install_generator.rb', line 39

def add_call_to_barras_to_app_html
  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_cssObject



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_javascriptObject



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_fileObject



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_brancoObject



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