Sha256: a640df6f0935ba5e5841994809a793cbc2ab031cfced420cc2a3d36c1b60157f

Contents?: true

Size: 845 Bytes

Versions: 8

Compression:

Stored size: 845 Bytes

Contents

require 'rails/generators/erb'
require 'rails/generators/resource_helpers'

module Rails
  class ShowlessScaffoldGenerator < Erb::Generators::Base
    include Rails::Generators::ResourceHelpers

    argument :attributes, type: :array, default: [], banner: "field:type field:type"

    def create_root_folder
      empty_directory File.join("app/views", controller_file_path)
    end

    def copy_view_files
      available_views.each do |view|
        formats.each do |format|
          filename = filename_with_extensions(view, format)
          template filename, File.join("app/views", controller_file_path, filename)
        end
      end
    end

    def self.source_root
      @source_root ||= File.join(File.dirname(__FILE__), 'templates')
    end

    protected

    def available_views
      %w(index edit new _form)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sal-engine-0.2.0 lib/generators/rails/showless_scaffold/showless_scaffold_generator.rb
sal-engine-0.1.0 lib/generators/rails/showless_scaffold/showless_scaffold_generator.rb
sal-engine-0.0.6 lib/generators/rails/showless_scaffold/showless_scaffold_generator.rb
sal-engine-0.0.5 lib/generators/rails/showless_scaffold/showless_scaffold_generator.rb
sal-engine-0.0.4 lib/generators/rails/showless_scaffold/showless_scaffold_generator.rb
sal-engine-0.0.3 lib/generators/rails/showless_scaffold/showless_scaffold_generator.rb
sal-engine-0.0.2 lib/generators/rails/showless_scaffold/showless_scaffold_generator.rb
sal-engine-0.0.1 lib/generators/rails/showless_scaffold/showless_scaffold_generator.rb