Sha256: 5d835bf0a2d2b3996f10a787c6dd5863e4166b5b760543228b5faafb83383cb1

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 Bytes

Contents

module Merb::Generators
  
  class ResourceGenerator < ComponentGenerator
    
    desc <<-DESC
      Generates a new resource.
    DESC
    
    first_argument :name, :required => true, :desc => "resource name"
    second_argument :attributes, :as => :hash, :default => {}, :desc => "space separated resource model properties in form of name:type. Example: state:string"
    
    invoke :model do |generator|
      generator.new(destination_root, options, model_name, attributes)
    end
    
    invoke :resource_controller do |generator|
      generator.new(destination_root, options, controller_name, attributes)
    end
    
    def controller_name
      name.pluralize
    end
    
    def model_name
      name.singularize
    end
    
  end
  
  add :resource, ResourceGenerator
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thorero-gen-0.9.4 lib/merb-gen/resource.rb