Sha256: 5d1d6a228925ce214b9e552f1bb7204327add8e13103391cc7e5562782df73a8

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

class ControllerGenerator < Rails::Generator::NamedBase
  def manifest
    record do |m|
      # Check for class naming collisions.
      m.class_collisions class_path, "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper"

      # Controller, helper, views, and test directories.
      m.directory File.join('app/controllers', class_path)
      #m.directory File.join('app/helpers', class_path)
      #m.directory File.join('app/views', class_path, file_name)
      #m.directory File.join('test/functional', class_path)

      # Controller class, functional test, and helper class.
      m.template 'controller.rb',
                  File.join('app/controllers',
                            class_path,
                            "#{file_name}_controller.rb")

      # Functional tests are a good idea, but not yet encompassed
#      m.template 'functional_test.rb',
 #                 File.join('test/functional',
  #                          class_path,
   #                         "#{file_name}_controller_test.rb")

#      m.template 'helper.rb',
 #                 File.join('app/helpers',
  #                          class_path,
   #                         "#{file_name}_helper.rb")

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shattered-0.3.1 lib/rails_generator/generators/components/controller/controller_generator.rb
shattered-0.3 lib/rails_generator/generators/components/controller/controller_generator.rb