Sha256: 34f61b71ad34efebd1264aff6043f4201680ecfe154a8b11b976f7f22df11e3a

Contents?: true

Size: 957 Bytes

Versions: 58

Compression:

Stored size: 957 Bytes

Contents

module Para
  class ComponentGenerator < Rails::Generators::NamedBase
    include Para::Generators::ComponentHelpers

    source_root File.expand_path('../templates', __FILE__)

    desc 'Para component generator'

    def welcome
      say 'Creating component...'
    end

    def copy_component
      template 'component.rb', "app/components/#{ component_file_name }.rb"
    end

    def copy_component_decorator
        template 'decorator.rb', "app/decorators/#{ decorator_file_name }.rb"
      end

    def copy_component_controller
      template 'component_controller.rb', "app/controllers/admin/#{ component_file_name }_controller.rb"
    end

    def create_show_component_view
      template 'show.html.haml', "app/views/admin/#{ component_file_name }/show.html.haml"
    end

    def add_route
      add_component_to_routes :component, file_name
    end

    private

    def component_parent_name
      'Para::Component::Base'
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
para-0.12.4 lib/generators/para/component/component_generator.rb
para-0.12.3 lib/generators/para/component/component_generator.rb
para-0.12.2 lib/generators/para/component/component_generator.rb
para-0.12.1 lib/generators/para/component/component_generator.rb
para-0.12.0 lib/generators/para/component/component_generator.rb
para-0.11.4 lib/generators/para/component/component_generator.rb
para-0.11.3 lib/generators/para/component/component_generator.rb
para-0.11.2 lib/generators/para/component/component_generator.rb
para-0.11.1 lib/generators/para/component/component_generator.rb
para-0.11.0 lib/generators/para/component/component_generator.rb
para-0.10.0 lib/generators/para/component/component_generator.rb
para-0.9.4 lib/generators/para/component/component_generator.rb
para-0.9.3.3 lib/generators/para/component/component_generator.rb
para-0.9.3.2 lib/generators/para/component/component_generator.rb
para-0.9.3.1 lib/generators/para/component/component_generator.rb
para-0.9.2 lib/generators/para/component/component_generator.rb
para-0.9.0 lib/generators/para/component/component_generator.rb
para-0.8.15 lib/generators/para/component/component_generator.rb
para-0.8.14 lib/generators/para/component/component_generator.rb
para-0.8.13 lib/generators/para/component/component_generator.rb