Class: FluentMigratorCommandRunner::MigrationCommand
- Inherits:
-
Object
- Object
- FluentMigratorCommandRunner::MigrationCommand
- Defined in:
- lib/fluent-migrator-command-runner/commands/migration_command.rb
Direct Known Subclasses
Constant Summary collapse
- PARAMETER_PREFIX =
'--'
- SPACE_CHAR =
"\s"
- MIGRATOR_DELIMITER =
"#{SPACE_CHAR + PARAMETER_PREFIX}"
- CONNECTION_STRING_DELIMITER =
';'
Instance Attribute Summary collapse
-
#connection_information ⇒ Object
readonly
Returns the value of attribute connection_information.
-
#path_to_migration_assembly ⇒ Object
readonly
Returns the value of attribute path_to_migration_assembly.
-
#path_to_migrator ⇒ Object
readonly
Returns the value of attribute path_to_migrator.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(options = {}) ⇒ MigrationCommand
constructor
A new instance of MigrationCommand.
Constructor Details
#initialize(options = {}) ⇒ MigrationCommand
Returns a new instance of MigrationCommand.
16 17 18 19 20 21 22 23 24 |
# File 'lib/fluent-migrator-command-runner/commands/migration_command.rb', line 16 def initialize( = {}) @profile = [:profile] unless [:profile].nil? @tag = [:tag] unless [:tag].nil? @provider = FigNewton.migration_provider('oracle') @path_to_migrator = FigNewton.path_to_migrator_exe @path_to_migration_assembly = FigNewton.path_to_migration_assembly @connection_information = FigNewton.database.to_hash @connection_information['password'] = [:db_password] unless [:db_password].nil? end |
Instance Attribute Details
#connection_information ⇒ Object (readonly)
Returns the value of attribute connection_information.
3 4 5 |
# File 'lib/fluent-migrator-command-runner/commands/migration_command.rb', line 3 def connection_information @connection_information end |
#path_to_migration_assembly ⇒ Object (readonly)
Returns the value of attribute path_to_migration_assembly.
3 4 5 |
# File 'lib/fluent-migrator-command-runner/commands/migration_command.rb', line 3 def path_to_migration_assembly @path_to_migration_assembly end |
#path_to_migrator ⇒ Object (readonly)
Returns the value of attribute path_to_migrator.
3 4 5 |
# File 'lib/fluent-migrator-command-runner/commands/migration_command.rb', line 3 def path_to_migrator @path_to_migrator end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
3 4 5 |
# File 'lib/fluent-migrator-command-runner/commands/migration_command.rb', line 3 def profile @profile end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
3 4 5 |
# File 'lib/fluent-migrator-command-runner/commands/migration_command.rb', line 3 def provider @provider end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
3 4 5 |
# File 'lib/fluent-migrator-command-runner/commands/migration_command.rb', line 3 def tag @tag end |
Instance Method Details
#build ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fluent-migrator-command-runner/commands/migration_command.rb', line 26 def build connection_string = build_connection_string(@connection_information) command_sections = [] command_sections.push(@path_to_migrator) command_sections.push("provider #{@provider}") command_sections.push("conn \"#{connection_string}\"") command_sections.push('task migrate') command_sections.push("assembly \"#{@path_to_migration_assembly}\"") command_sections.push("tag #{@tag}") if @tag command_sections.push("profile=#{@profile}") if @profile command_sections.join(MIGRATOR_DELIMITER) end |