Class: Bootstrap::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#installObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/bootstrap/install_generator.rb', line 7

def install
  # Insert lines in application.js  
  inject_into_file "app/assets/javascripts/application.js", 
    "//= require bootstrap\n//= require jquery.toastmessage\n", :before => "//= require_tree"

  # Insert lines in application.css
  inject_into_file "app/assets/stylesheets/application.css", 
    " *= require bootstrap\n *= require jquery.toastmessage\n", :before => "*= require_self"

  # Insert lines in application.html.erb
  inject_into_file "app/views/layouts/application.html.erb", 
    "<%= menu_bar %>\n\n<div class='container-fluid' style='padding-top: 45px'>\n  <% flash.each do |name, msg| %>\n    <%= display_toast_message(msg, name) %>\n  <% end %>\n  ", :before => "<%= yield %>"
  
  inject_into_file "app/views/layouts/application.html.erb", "\n</div>", :after => "<%= yield %>"
end