Sha256: c0fc45890b7dac720941e34b246df8eeb5a6ba64f05c5e0fa9cf08a003edf181

Contents?: true

Size: 713 Bytes

Versions: 5

Compression:

Stored size: 713 Bytes

Contents

module Hobo
  class RoutesGenerator < Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)

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

    def generate_routes
      Hobo::Routes.reset_linkables
      template "hobo_routes.rb.erb", Hobo::Engine.config.hobo.routes_path
    end

private

    def subsites
      [nil, *Hobo.subsites]
    end

    def controllers_for(subsite)
      Hobo::Controller::Model.all_controllers(subsite, :force).select { |c| c < Hobo::Controller::Model }
    end

    def router_for(subsite, controller)
      Generators::Hobo::Routes::Router.new(subsite, controller)
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hobo-1.3.0.pre14 lib/generators/hobo/routes/routes_generator.rb
hobo-1.3.0.pre13 lib/generators/hobo/routes/routes_generator.rb
hobo-1.3.0.pre12 lib/generators/hobo/routes/routes_generator.rb
hobo-1.3.0.pre11 lib/generators/hobo/routes/routes_generator.rb
hobo-1.3.0.pre10 lib/generators/hobo/routes/routes_generator.rb