Sha256: 72ecb928f6e2385609e769fd2ba80a73e7e8420c86fa7dde398b1a39457000b2
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 KB
Contents
module Tennpipes module Generators ## # Responsible for generating migration files for the appropriate ORM component. # class Migration < Thor::Group Tennpipes::Generators.add_generator(:migration, self) def self.source_root; File.expand_path(File.dirname(__FILE__)); end def self.banner; "tennpipes-init migration [name] [fields]"; end include Thor::Actions include Tennpipes::Generators::Actions include Tennpipes::Generators::Components::Actions desc "Description:\n\n\ttennpipes-init migration generates a new migration file" argument :name, :desc => 'The name of your tennpipes migration' argument :columns, :desc => 'The columns for the migration', :type => :array, :default => [] class_option :root, :desc => 'The root destination', :aliases => '-r', :default => '.', :type => :string class_option :destroy, :aliases => '-d', :default => false, :type => :boolean # Show help if no ARGV given. require_arguments! # Creates the migration file within a Tennpipes project. def create_migration self.destination_root = options[:root] if in_app_root? self.behavior = :revoke if options[:destroy] if include_component_module_for(:orm) create_migration_file(name, name, columns) else say '<= You need an ORM adapter for run this generator. Sorry!' raise SystemExit end else say 'You are not at the root of a Tennpipes application! (config/boot.rb not found)' end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tennpipes-init-3.6.6 | lib/tennpipes-init/generators/migration.rb |