Sha256: 814781ea32e262631c2f5dbd3754143c7d3b50a4edcadf3d9d52cc97b27bf95d

Contents?: true

Size: 782 Bytes

Versions: 1

Compression:

Stored size: 782 Bytes

Contents

class ControllerGenerator < RubiGen::Base

  attr_reader :name,:class_name,:file_name,:actions

  def initialize(runtime_args, runtime_options = {})
    super
    usage if args.empty?
    @destination_root = File.expand_path('.')
    @name             = args.shift
    @actions          = args

    @file_name  = @name.underscore
    @class_name = @name.pluralize == @name ? @name.classify.pluralize : @name.classify
  end

  def manifest
    record do |m|
      m.directory File.dirname("test/app_root/app/controllers/#{file_name}")
      m.template "controller.rb","test/app_root/app/controllers/#{file_name}_controller.rb"
    end
  end

  protected
    def banner
      <<-EOS
USAGE: #{File.basename($0)} #{spec.name} ControllerName [action] [action] [options]

EOS
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
newplugin-0.0.4 newplugin_generators/controller/controller_generator.rb