Class: ExtensionMigrationGenerator

Inherits:
MigrationGenerator
  • Object
show all
Defined in:
lib/generators/extension_migration/extension_migration_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runtime_args, runtime_options = {}) ⇒ ExtensionMigrationGenerator

Returns a new instance of ExtensionMigrationGenerator.



8
9
10
11
12
# File 'lib/generators/extension_migration/extension_migration_generator.rb', line 8

def initialize(runtime_args, runtime_options = {})
  runtime_args = runtime_args.dup
  @extension_name = runtime_args.shift
  super(runtime_args, runtime_options)
end

Instance Attribute Details

#extension_nameObject

Returns the value of attribute extension_name.



6
7
8
# File 'lib/generators/extension_migration/extension_migration_generator.rb', line 6

def extension_name
  @extension_name
end

Instance Method Details



14
15
16
# File 'lib/generators/extension_migration/extension_migration_generator.rb', line 14

def banner
  "Usage: #{$0} extension_migration ExtensionName MigrationName [field:type, field:type]"
end

#destination_rootObject



22
23
24
# File 'lib/generators/extension_migration/extension_migration_generator.rb', line 22

def destination_root
  File.join(RAILS_ROOT, extension_path)
end

#extension_pathObject



18
19
20
# File 'lib/generators/extension_migration/extension_migration_generator.rb', line 18

def extension_path
  File.join('vendor', 'extensions', @extension_name.underscore)
end