Class: Mapfish::PrintControllerGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/mapfish/print_controller/print_controller_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



5
6
7
# File 'lib/generators/mapfish/print_controller/print_controller_generator.rb', line 5

def self.source_root
  @source_root ||= File.expand_path('../templates', __FILE__)
end

Instance Method Details

#add_routesObject



17
18
19
20
21
# File 'lib/generators/mapfish/print_controller/print_controller_generator.rb', line 17

def add_routes
  route %{match '#{file_name}/:id.:format' => "#{file_name}#show", :via => :get}
  route %{match '#{file_name}/create.:format' => "#{file_name}#create", :via => :post}
  route %{match '#{file_name}/info.:format' => "#{file_name}#info", :via => :get}
end

#create_config_filesObject



13
14
15
# File 'lib/generators/mapfish/print_controller/print_controller_generator.rb', line 13

def create_config_files
  template 'config.yaml', File.join('config', class_path, "print.yaml")
end

#create_controller_filesObject



9
10
11
# File 'lib/generators/mapfish/print_controller/print_controller_generator.rb', line 9

def create_controller_files
  template 'controller.rb', File.join('app/controllers', class_path, "#{file_name}_controller.rb")
end