Class: Hobo::RoutesGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Generators::HoboSupport::EvalTemplate
Defined in:
lib/generators/hobo/routes/routes_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



9
10
11
# File 'lib/generators/hobo/routes/routes_generator.rb', line 9

def self.banner
  "rails generate hobo:routes #{self.arguments.map(&:usage).join(' ')} [options]"
end

Instance Method Details

#generate_routesObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/generators/hobo/routes/routes_generator.rb', line 13

def generate_routes
  Hobo::Routes.reset_linkables
  h = Hobo::Engine.config.hobo
  template_name = 'hobo_routes.rb.erb'
  if h.read_only_file_system
    # just fill the @linkable_keys without writing any file
    eval_template template_name
  else
    template template_name, h.routes_path
  end
end