Class: Padrino::Generators::Migration
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Padrino::Generators::Migration
- Includes:
- Actions, Components::Actions, Thor::Actions
- Defined in:
- padrino-gen/lib/padrino-gen/generators/migration.rb
Overview
Responsible for generating migration files for the appropriate ORM component.
Class Method Summary (collapse)
-
+ (Object) banner
Defines the banner for this CLI generator.
-
+ (Object) source_root
Define the source template root.
Instance Method Summary (collapse)
-
- (Object) create_migration
Creates the migration file within a Padrino project.
Methods included from Actions
#app_skeleton, #apply_component_for, #ask, #check_app_existence, #destination_root, #execute_component_setup, #fetch_app_name, #fetch_component_choice, #in_app_root?, #include_component_module_for, #initializer, #insert_hook, #insert_into_gemfile, #insert_middleware, #invalid_fields, #require_contrib, #require_dependencies, #resolve_valid_choice, #retrieve_component_config, #run_bundler, #store_component_choice, #store_component_config, #test?, #tiny?, #valid_choice?, #valid_constant?
Class Method Details
+ (Object) banner
Defines the banner for this CLI generator
14 |
# File 'padrino-gen/lib/padrino-gen/generators/migration.rb', line 14 def self.; "padrino-gen migration [name] [fields]" end |
+ (Object) source_root
Define the source template root
12 |
# File 'padrino-gen/lib/padrino-gen/generators/migration.rb', line 12 def self.source_root; File.(File.dirname(__FILE__)) end |
Instance Method Details
- (Object) create_migration
Creates the migration file within a Padrino project.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'padrino-gen/lib/padrino-gen/generators/migration.rb', line 32 def create_migration self.destination_root = [:root] if in_app_root? self.behavior = :revoke if [: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 Padrino application! (config/boot.rb not found)" end end |