Sha256: 20469304d3274b8155c8c2c6e0c90a100cdb0ef837db7ba492b8aecc03e6c426

Contents?: true

Size: 1.07 KB

Versions: 34

Compression:

Stored size: 1.07 KB

Contents

module Cms
  module Generators
    class PortletGenerator < Rails::Generators::NamedBase

      source_root File.expand_path('../templates', __FILE__)
      argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
      check_class_collision

      def create_portlet
        template 'portlet.rb', File.join('app/portlets', class_path, "#{portlet_file_name}.rb")
      end

      def create_helper
        template 'portlet_helper.rb', File.join('app/portlets/helpers', class_path, "#{portlet_file_name}_helper.rb")
      end

      def create_views
        template '_form.html.erb', File.join('app/views/portlets/', file_name, "_form.html.erb")
        template 'render.html.erb', File.join('app/views/portlets/', file_name, "render.html.erb")
      end

      def create_tests
        template 'unit_test.erb', File.join('test/unit/portlets', "#{portlet_file_name}_test.rb")
      end

      private

      def portlet_class_name
        "#{class_name}Portlet"
      end

      def portlet_file_name
        "#{file_name}_portlet"
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
browsercms-artirix-4.0.4 lib/generators/cms/portlet/portlet_generator.rb
browsercms-artirix-4.0.3.3 lib/generators/cms/portlet/portlet_generator.rb
browsercms-artirix-4.0.3.2 lib/generators/cms/portlet/portlet_generator.rb
browsercms-artirix-4.0.3.1 lib/generators/cms/portlet/portlet_generator.rb
browsercms-artirix-4.0.3 lib/generators/cms/portlet/portlet_generator.rb
browsercms-artirix-4.0.2 lib/generators/cms/portlet/portlet_generator.rb
browsercms-artirix-4.0.1.1 lib/generators/cms/portlet/portlet_generator.rb
browsercms-artirix-4.0.0.rc1.art4 lib/generators/cms/portlet/portlet_generator.rb
browsercms-4.0.0.rc1 lib/generators/cms/portlet/portlet_generator.rb
browsercms-4.0.0.beta lib/generators/cms/portlet/portlet_generator.rb
browsercms-4.0.0.alpha lib/generators/cms/portlet/portlet_generator.rb
browsercms-3.5.7 lib/generators/cms/portlet/portlet_generator.rb
browsercms-3.5.6 lib/generators/cms/portlet/portlet_generator.rb
browsercms-3.5.5 lib/generators/cms/portlet/portlet_generator.rb
browsercms-3.5.4 lib/generators/cms/portlet/portlet_generator.rb
browsercms-3.5.3 lib/generators/cms/portlet/portlet_generator.rb
browsercms-3.5.2 lib/generators/cms/portlet/portlet_generator.rb
browsercms-3.5.1 lib/generators/cms/portlet/portlet_generator.rb
browsercms-3.5.0 lib/generators/cms/portlet/portlet_generator.rb
browsercms-3.5.0.rc3 lib/generators/cms/portlet/portlet_generator.rb