Sha256: bebf0c3c561d2bc97a7678b8430b10e57e537f84c4cbbc85b9101839b0b7c02a
Contents?: true
Size: 973 Bytes
Versions: 11
Compression:
Stored size: 973 Bytes
Contents
require 'generators/rom' module ROM module Generators class CommandsGenerator < Base class_option :adapter, banner: "--adapter=adapter", desc: "specify an adapter to use", required: true, default: ROM.adapters.keys.first def create_create_command template 'create.rb.erb', command_file(:create) end def create_update_command template 'update.rb.erb', command_file(:update) end def create_delete_command template 'delete.rb.erb', command_file(:delete) end private def command_file(command) File.join('app', 'commands', command_dir, "#{command}.rb") end def command_dir "#{class_name.downcase.singularize}_commands" end def relation class_name.pluralize.underscore end def model_name class_name.singularize end def adapter options[:adapter] end end end end
Version data entries
11 entries across 11 versions & 1 rubygems