Sha256: 72ec42766fe1e3fab1548a5d0ccc51305660c1b0dbe1caa6c51a1396c6a1e77c
Contents?: true
Size: 1.8 KB
Versions: 3
Compression:
Stored size: 1.8 KB
Contents
#require 'rails_generator/generators/components/controller/controller_generator' class RottenControllerGenerator < Rails::Generator::NamedBase def manifest record do |m| # Check for class naming collisions. m.class_collisions class_path, "#{class_name}Controller", "#{class_name}Helper" # Controller, helper, views, and spec 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('spec/controllers', class_path) m.directory File.join('spec/helpers', class_path) m.directory File.join('spec/views', class_path, file_name) @default_file_extension = "html.haml" # Controller spec, class, and helper. m.template 'controller_spec.rb', File.join('spec/controllers', class_path, "#{file_name}_controller_spec.rb") m.template 'helper_spec.rb', File.join('spec/helpers', class_path, "#{file_name}_helper_spec.rb") m.template 'controller:controller.rb', File.join('app/controllers', class_path, "#{file_name}_controller.rb") m.template 'controller:helper.rb', File.join('app/helpers', class_path, "#{file_name}_helper.rb") # View template for each action. actions.each do |action| spec_path = File.join('spec/views', class_path, file_name, "#{action}.html.haml_spec.rb") path = File.join('app/views', class_path, file_name, "#{action}.html.haml") m.template 'view_spec.rb', spec_path, :assigns => { :action => action, :model => file_name } m.template 'view.html.haml', path, :assigns => { :action => action, :path => path } end end end end
Version data entries
3 entries across 3 versions & 3 rubygems