class Podium::InstallGenerator
Constants
- APP_CONTROLLER_PATH
- LAYOUT_PATH
Public Instance Methods
add_podlets_to_layout()
click to toggle source
# File lib/generators/podium/install_generator.rb, line 20 def add_podlets_to_layout return if File.read(LAYOUT_PATH).include?("podlet_content!") inject_into_file LAYOUT_PATH, "<%= podlet_content!(:header) %>\n ", before: "<%= yield %>" inject_into_file LAYOUT_PATH, " <%= podlet_content!(:footer) %>\n", after: "<%= yield %>\n" inject_into_file LAYOUT_PATH, " <%= podlet_js_tags %>\n ", before: "</head>\n" end
copy_initializer()
click to toggle source
# File lib/generators/podium/install_generator.rb, line 12 def copy_initializer template "podium.rb", "config/initializers/podium.rb" inside do setup_app_controller end end
Private Instance Methods
setup_app_controller()
click to toggle source
# File lib/generators/podium/install_generator.rb, line 29 def setup_app_controller return unless File.exists?(APP_CONTROLLER_PATH) return if File.read(APP_CONTROLLER_PATH).include?("Podium::ControllerHelpers") new_content = <<-'RUBY' include Podium::ControllerHelpers def podlets [:header, :footer] end RUBY inject_into_class APP_CONTROLLER_PATH, "ApplicationController", new_content end