class Popolo::Generators::PopoloGenerator
Run this generator once before using Popolo
in your application.
@example
rails generate popolo
Public Instance Methods
add_rescue_from_block_to_application_controller()
click to toggle source
# File lib/generators/popolo_generator.rb, line 17 def add_rescue_from_block_to_application_controller inject_into_class 'app/controllers/application_controller.rb', 'ApplicationController' do <<-EOS rescue_from Mongoid::Errors::DocumentNotFound do |exception| respond_to do |format| format.html { render file: Rails.root.join('public', '404.html'), status: :not_found, layout: false } format.json { head :not_found } format.atom { head :not_found } end end EOS end end
add_routes()
click to toggle source
# File lib/generators/popolo_generator.rb, line 13 def add_routes route "mount Popolo::Engine => '/'" end
add_ruby_version_to_gemfile()
click to toggle source
# File lib/generators/popolo_generator.rb, line 31 def add_ruby_version_to_gemfile prepend_to_file 'Gemfile', "ruby '1.9.3'" end
show_readme()
click to toggle source
# File lib/generators/popolo_generator.rb, line 35 def show_readme readme 'README' if behavior == :invoke end