Sha256: 7e0d937a07c2d9bbff08b6b2ae40e247af4d7ae5a90f87acdae983e2df79ec59

Contents?: true

Size: 968 Bytes

Versions: 7

Compression:

Stored size: 968 Bytes

Contents

module Generators
  module Hobo
    Controller = classy_module do

      # check_class_collision :suffix => 'Controller'

      class_option :helpers, :type => :boolean,
      :desc => "Generates helper files",
      :default => !Rails.application.config.hobo.dryml_only_templates

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

      def generate_controller
        if class_path.length == 1 and
          subsite = class_path.first and
	  (
	    options[:subsite_controller_is_being_created] or 
            File.exist?(File.join('app/controllers', class_path, "#{subsite}_site_controller.rb"))
          )
          @subsite = subsite.camelize
        end
        template 'controller.rb.erb', File.join('app/controllers',"#{file_path}_controller.rb")
      end

      def generate_helper
        return unless options[:helpers]
        invoke 'helper', [name], options
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hobo-2.2.6 lib/generators/hobo/controller.rb
hobo-2.2.5 lib/generators/hobo/controller.rb
hobo-2.2.4 lib/generators/hobo/controller.rb
hobo-2.2.3 lib/generators/hobo/controller.rb
hobo-2.2.2 lib/generators/hobo/controller.rb
hobo-2.2.1 lib/generators/hobo/controller.rb
hobo-2.2.0 lib/generators/hobo/controller.rb