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.



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

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.



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

def extension_name
  @extension_name
end

Instance Method Details



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

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

#destination_rootObject



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

def destination_root
  File.join(Rails.root, extension_path)
end

#extension_pathObject



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

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