Class: Stationary::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_routesObject



18
19
20
21
22
# File 'lib/generators/stationary/install_generator.rb', line 18

def add_routes
  log :route, 'Stationary Route Insert'
  sentinel = /^end$/
  inject_into_file 'config/routes.rb', "\n  root :to => Stationary::Engine\n  match '/:path(.:format)', :to => Stationary::Engine, :constraints => { :path => /.+?/ }\n\n", { :before => sentinel, :verbose => true }
end

#create_initializer_fileObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/generators/stationary/install_generator.rb', line 5

def create_initializer_file
  create_file "config/initializers/stationary.rb" do <<-TXT
# The example below shows how to configure Stationary to allow public
# access to the pages behind devise and also set the root directory for
# Stationary to look for template files.
#Stationary.configure do |config|
#  config.root               = "\#{Rails.root}/app/views/site"
#  config.skip_before_filter = :authenticate_user!
#end
TXT
  end
end