Class: SulChromeGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- SulChromeGenerator
- Defined in:
- lib/generators/sul_chrome/sul_chrome_generator.rb
Instance Method Summary collapse
-
#assets ⇒ Object
insert require statements into application level CSS/JS manifestes.
-
#inject_sul_chrome_controller_behavior ⇒ Object
Add SulChrome to the application controller.
Instance Method Details
#assets ⇒ Object
insert require statements into application level CSS/JS manifestes.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/generators/sul_chrome/sul_chrome_generator.rb', line 27 def assets unless IO.read("app/assets/stylesheets/application.css").include?("Required by SULChrome") insert_into_file "app/assets/stylesheets/application.css", :after => "/*" do %q{ * Required by SULChrome: *= require sul_chrome/sul_chrome_base *} end end unless IO.read("app/assets/javascripts/application.js").include?("Required by SULChrome") insert_into_file "app/assets/javascripts/application.js", :before => "//= require_tree ." do %q{// Required by SULChrome: //= require sul_chrome/sul_chrome_base } end end end |
#inject_sul_chrome_controller_behavior ⇒ Object
Add SulChrome to the application controller.
17 18 19 20 21 22 23 24 |
# File 'lib/generators/sul_chrome/sul_chrome_generator.rb', line 17 def inject_sul_chrome_controller_behavior unless IO.read("app/controllers/application_controller.rb").include?("SulChrome::Controller") inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do " # Adds a few additional behaviors into the application controller\n" + " include SulChrome::Controller\n\n" end end end |