Sha256: 745490972125f4109ac04245c576de9b451e27535ad5d0f2c0e28daa623eaa56

Contents?: true

Size: 897 Bytes

Versions: 2

Compression:

Stored size: 897 Bytes

Contents

class PortletGenerator < Rails::Generator::NamedBase

  def manifest
    record do |m|
      # Check for class naming collisions.
      m.class_collisions class_path, class_name

      # Create the directory for this portlet 
      m.directory File.join('app/portlets', class_path)

      # Create the content block
      m.template 'portlet.rb', File.join('app/portlets', class_path, "#{file_name}.rb")

      # Create the edit form for the content type
      portlet_name = file_name.sub(/_portlet/,'')
      m.directory File.join('app/views/portlets', portlet_name)
      m.template '_form.html.erb', File.join('app/views/portlets/', portlet_name, "_form.html.erb")
      m.template 'render.html.erb', File.join('app/views/portlets/', portlet_name, "render.html.erb")
    end
  end

  protected
    def banner
      "Usage: #{$0} #{spec.name} PortletName [field:type, field:type]"
    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nate-browsercms-3.0.210 rails_generators/portlet/portlet_generator.rb
nate-browsercms-3.0.211 rails_generators/portlet/portlet_generator.rb