Class: Podium::InstallGenerator

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

Constant Summary collapse

APP_CONTROLLER_PATH =
"app/controllers/application_controller.rb"
LAYOUT_PATH =
"app/views/layouts/application.html.erb"

Instance Method Summary collapse

Instance Method Details

#add_podlets_to_layoutObject



20
21
22
23
24
25
# 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_initializerObject



12
13
14
15
16
17
18
# 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