Sha256: 3d219cb901e4d8b04b52a519e7b477f520fa019fc4d1b9142be6e71df44d9f47
Contents?: true
Size: 987 Bytes
Versions: 3
Compression:
Stored size: 987 Bytes
Contents
require 'thor' require 'active_support/core_ext/string' module ServiceTemplate module Generators class ScaffoldGenerator < Thor::Group include Thor::Actions source_root "#{File.dirname(__FILE__)}/templates/scaffold" argument :app_name argument :app_path, optional: true class_option :database, default: 'mysql', aliases: '-d', desc: 'Preconfigure for selected database (options: mysql/postgres/pg)' def generate say 'Generating scaffold...' @database_gem = ['pg','postgres'].include?(options[:database]) ? 'pg' : 'mysql2' @database_adapter = ['pg','postgres'].include?(options[:database]) ? 'postgresql' : 'mysql2' @database_encoding = ['pg','postgres'].include?(options[:database]) ? 'unicode' : 'utf8' @database_user = ['pg','postgres'].include?(options[:database]) ? '' : 'root' directory ".", (app_path || app_name) say 'Done!', :green end end end end
Version data entries
3 entries across 3 versions & 1 rubygems