Class: Hobo::UserControllerGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
classy_module do # check_class_collision :suffix => 'Controller' class_option :helpers, :type => :boolean, :desc => "Generates helper files", :default => !Railsclassy_module do # check_class_collision :suffix => 'Controller' class_option :helpers, :type => :boolean, :desc => "Generates helper files", :default => !Rails.applicationclassy_module do # check_class_collision :suffix => 'Controller' class_option :helpers, :type => :boolean, :desc => "Generates helper files", :default => !Rails.application.configclassy_module do # check_class_collision :suffix => 'Controller' class_option :helpers, :type => :boolean, :desc => "Generates helper files", :default => !Rails.application.config.hoboclassy_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, classy_module do class_option :invite_only, :aliases => '-i', :type => :boolean, :desc => "Add features for an invite only website" private def invite_only? options[:invite_only] end end
Defined in:
lib/generators/hobo/user_controller/user_controller_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



11
12
13
# File 'lib/generators/hobo/user_controller/user_controller_generator.rb', line 11

def self.banner
  "rails generate hobo:user_controller [NAME=users] [options]"
end

Instance Method Details

#generate_accept_invitationObject



19
20
21
22
# File 'lib/generators/hobo/user_controller/user_controller_generator.rb', line 19

def generate_accept_invitation
  return unless invite_only?
  template "accept_invitation.dryml", File.join('app/views', file_path, "accept_invitation.dryml")
end

#generate_controllerObject



15
16
17
# File 'lib/generators/hobo/user_controller/user_controller_generator.rb', line 15

def generate_controller
  template 'controller.rb.erb', File.join('app/controllers',"#{file_path}_controller.rb")
end