Class: BootstrapEngine::Devise::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_assetsObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/generators/bootstrap_engine/devise/install/install_generator.rb', line 12

def add_assets

  if File.exist?('app/assets/javascripts/application.js')
    insert_into_file "app/assets/javascripts/application.js", "//= require rails-bootstrap-engine\n", :after => "jquery_ujs\n"
  end

  if File.exist?('app/assets/stylesheets/application.css')
    content = File.read("app/assets/stylesheets/application.css")
    if content.match(/require_tree\s+\.\s*$/)
      style_require_block = " *= require rails-bootstrap-engine\n"
      insert_into_file "app/assets/stylesheets/application.css", style_require_block, :after => "require_self\n"
    end
  end
  
  # Copy Devise Layout for Override
  copy_file "devise.html.erb", 'app/views/layouts/devise.html.erb'
  
puts	%{

 ******************************************************************
 * Rails Bootstrap Engine has a message for you ...
 ****************************************************************** 
 
 Dear Developer,
 			
  √ Remember to overload the Application Brand Helpers.
  
  
}

end