Class: FluentMigratorRunner

Inherits:
Object
  • Object
show all
Includes:
Albacore::RunCommand, Albacore::Task
Defined in:
lib/albacore/fluentmigratorrunner.rb

Constant Summary collapse

TaskName =
:fluentmigrator

Instance Attribute Summary collapse

Attributes included from Albacore::RunCommand

#command, #working_directory

Attributes included from Logging

#current_log_device, #logger

Instance Method Summary collapse

Methods included from Albacore::RunCommand

#get_command, #run_command

Methods included from AttrMethods

#attr_array, #attr_hash

Methods included from Albacore::Task

clean_dirname, create_rake_task, include_config, included

Methods included from UpdateAttributes

#<<, #update_attributes

Methods included from YAMLConfig

#configure, #load_config_by_task_name

Methods included from Logging

#create_logger, #log_device=, #log_level, #log_level=

Methods included from Failure

#fail_with_message

Constructor Details

#initialize(command = nil) ⇒ FluentMigratorRunner

Returns a new instance of FluentMigratorRunner.



10
11
12
13
14
# File 'lib/albacore/fluentmigratorrunner.rb', line 10

def initialize(command=nil)
	super()
	update_attributes Albacore.configuration.fluentmigrator.to_hash
	@command = command unless command.nil?
end

Instance Attribute Details

#connectionObject

Returns the value of attribute connection.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def connection
  @connection
end

#namespaceObject

Returns the value of attribute namespace.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def namespace
  @namespace
end

#outputObject

Returns the value of attribute output.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def output
  @output
end

#output_filenameObject

Returns the value of attribute output_filename.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def output_filename
  @output_filename
end

#previewObject

Returns the value of attribute preview.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def preview
  @preview
end

#profileObject

Returns the value of attribute profile.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def profile
  @profile
end

#providerObject

Returns the value of attribute provider.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def provider
  @provider
end

#script_directoryObject

Returns the value of attribute script_directory.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def script_directory
  @script_directory
end

#show_helpObject

Returns the value of attribute show_help.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def show_help
  @show_help
end

#stepsObject

Returns the value of attribute steps.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def steps
  @steps
end

#targetObject

Returns the value of attribute target.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def target
  @target
end

#taskObject

Returns the value of attribute task.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def task
  @task
end

#timeoutObject

Returns the value of attribute timeout.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def timeout
  @timeout
end

#verboseObject

Returns the value of attribute verbose.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def verbose
  @verbose
end

#versionObject

Returns the value of attribute version.



8
9
10
# File 'lib/albacore/fluentmigratorrunner.rb', line 8

def version
  @version
end

Instance Method Details

#executeObject



45
46
47
48
49
50
# File 'lib/albacore/fluentmigratorrunner.rb', line 45

def execute()
   result = run_command "FluentMigrator", get_command_parameters

   failure_message = "FluentMigrator failed. See build log for detail."
   fail_with_message failure_message if !result
end

#get_command_lineObject



16
17
18
19
20
21
# File 'lib/albacore/fluentmigratorrunner.rb', line 16

def get_command_line
  commandline = "#{@command}"
  commandline << get_command_parameters
  @logger.debug "Build FuentMigrator Test Runner Command Line: " + commandline
  commandline
end

#get_command_parametersObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/albacore/fluentmigratorrunner.rb', line 23

def get_command_parameters
   if @show_help
     params = " /?"
   else
     params = " /target=\"#{@target}\""
     params << " /provider=#{@provider}"
     params << " /connection=\"#{@connection}\""
     params << " /ns=#{@namespace}" unless @namespace.nil?
     params << " /out" if @output == true
     params << " /outfile=\"#{@output_filename}\"" unless @output_filename.nil?
     params << " /preview" if @preview == true
     params << " /steps=#{@steps}" unless @steps.nil?
     params << " /task=#{@task}" unless @task.nil?
     params << " /version=#{@version}" unless @version.nil?
     params << " /verbose=#{@verbose}" if @verbose == true
     params << " /wd=\"#{@script_directory}\"" unless @script_directory.nil?
     params << " /profile=#{@profile}" unless @profile.nil?
     params << " /timeout=#{@timeout}" unless @timeout.nil?
   end 
   params
end