Sha256: 749767e5a9ec2b21bae89a07fd1a366628d94c0368b8e42898f3eb4a5587a386
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
class ScaffoldGenerator attr_accessor :attributes, :model def initialize(args) @model = args.shift.downcase @attributes = [] validate_scaffold_command(args) end def build ModelGenerator.new(model, attributes).build RepositoryGenerator.new(model, attributes).build ControllerGenerator.new(model, attributes).build FreemarkerGenerator.new(model, attributes).build end private def validate_scaffold_command(args) unless File.exist?("pom.xml") puts "To run scaffold please go to the project root folder." Kernel::exit end validate_parse_attributes(args) end def validate_parse_attributes(args) args.each do |arg| parsedAttribute = arg.split(":") validate_parse_attribute(parsedAttribute) end end def validate_parse_attribute(parsedAttribute) type = parsedAttribute.last.downcase unless Attribute.valid_types.include?(type) puts "Attribute #{type} is not supported. The supported attributes types are: #{Attribute.valid_types.join(" ")}" Kernel::exit end @attributes << Attribute.new(parsedAttribute.first, type) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vraptor-scaffold-0.0.1.beta5 | lib/generators/scaffold_generator/scaffold_generator.rb |