Sha256: 6fa639fbee20b9bd9218f1e0cd8e034ddbda9f5c03af16b27cf47859a0762c53
Contents?: true
Size: 977 Bytes
Versions: 7
Compression:
Stored size: 977 Bytes
Contents
require 'eucalypt/eucalypt-generate/namespaces/generate-model/generators/model' require 'eucalypt/app' require 'eucalypt/errors' require 'eucalypt/helpers' module Eucalypt class Generate < Thor include Eucalypt::Helpers using Colorize option :table, type: :boolean, default: true, desc: "Generate table migration" option :spec, type: :boolean, default: true, desc: "Include a model spec file" desc "model [NAME] *[COLUMN∶TYPE]", "Generates a model".colorize(:grey) def model(name, *columns) directory = File.expand_path('.') if Eucalypt.app? directory validation = Eucalypt::Helpers::Migration::Validation.new columns return if validation.any_invalid? model = Eucalypt::Generators::Model.new model.destination_root = directory model.generate(name: name, spec: options[:spec], table: options[:table], columns: columns) else Eucalypt::Error.wrong_directory end end end end
Version data entries
7 entries across 7 versions & 1 rubygems