Class: FluentMigratorCommandRunner::Rake::Task

Inherits:
Object
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/fluent-migrator-command-runner/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task_name) {|_self| ... } ⇒ Task

Returns a new instance of Task.

Yields:

  • (_self)

Yield Parameters:



17
18
19
20
21
22
23
# File 'lib/fluent-migrator-command-runner/task.rb', line 17

def initialize(task_name)
	@task_name = task_name

	yield self if block_given?

	define_task
end

Instance Attribute Details

#fig_newton_fileObject

Returns the value of attribute fig_newton_file.



13
14
15
# File 'lib/fluent-migrator-command-runner/task.rb', line 13

def fig_newton_file
  @fig_newton_file
end

#profileObject

Returns the value of attribute profile.



14
15
16
# File 'lib/fluent-migrator-command-runner/task.rb', line 14

def profile
  @profile
end

#tagObject

Returns the value of attribute tag.



15
16
17
# File 'lib/fluent-migrator-command-runner/task.rb', line 15

def tag
  @tag
end

Instance Method Details

#define_taskObject



25
26
27
28
29
30
31
32
33
# File 'lib/fluent-migrator-command-runner/task.rb', line 25

def define_task
	task @task_name, [:password] do |t, params|
		FigNewton.load(@fig_newton_file) unless @fig_newton_file.nil?
		options = migration_options
		options[:db_password] = params[:password] unless params[:password].nil?
		command = CommandBuilder.build(options)
		Runner.execute(command)
	end
end

#migration_optionsObject



35
36
37
38
39
40
# File 'lib/fluent-migrator-command-runner/task.rb', line 35

def migration_options
	options = {}
	options[:profile] = profile unless profile.nil?
	options[:tag] = tag unless tag.nil?
	return options
end