Sha256: 9880aa35fc0bf94ac649699677fe9d6537e0709521ca3951e5a07a46c7f2f927

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

class ScaffoldGenerator < SpringMvcScaffold::Base

  attr_accessor :generated_attributes
  argument :model
  argument :attributes, type: :hash, default: {}, banner: "field:type field:type"

  def self.banner
    "springmvc scaffold #{self.arguments.map(&:usage).join(' ')}"
  end

  def initialize(args)
    super(args)
    @generated_attributes = attributes.map {|field, type| Attribute.new(field, type) }
  end

  def controller_generator
    ControllerGenerator.new(model, generated_attributes).build
  end

  def model_generator
    ModelGenerator.new(model, generated_attributes).build
  end

  def template_generator
    JspGenerator.new(model, generated_attributes).build
  end

  def repository_generator
    RepositoryGenerator.new(model, generated_attributes).build
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
springmvc-scaffold-1.0.1 lib/springmvc-scaffold/generators/scaffold/scaffold_generator.rb