Module: ThreeScaleToolbox::Commands::BackendCommand::CopyCommand::Task

Included in:
CopyMappingRulesTask, CopyMethodsTask, CopyMetricsTask, CreateOrUpdateTargetBackendTask
Defined in:
lib/3scale_toolbox/commands/backend_command/copy_command/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



6
7
8
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 6

def context
  @context
end

Instance Method Details

#callObject



12
13
14
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 12

def call
  run
end

#initialize(context) ⇒ Object



8
9
10
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 8

def initialize(context)
  @context = context
end

#loggerObject



46
47
48
49
50
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 46

def logger
  context[:logger] ||= Logger.new($stdout).tap do |logger|
    logger.formatter = proc { |severity, datetime, progname, msg| "#{msg}\n" }
  end
end

#option_target_system_nameObject



42
43
44
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 42

def option_target_system_name
  context[:option_target_system_name]
end

#reportObject



52
53
54
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 52

def report
  context[:report] ||= {}
end

#source_backendObject



25
26
27
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 25

def source_backend
  context[:source_backend] ||= find_source_backend
end

#source_backend_refObject



37
38
39
40
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 37

def source_backend_ref
  context[:source_backend_ref] ||= raise ThreeScaleToolbox::Error, 'Unexpected error. ' \
    'source_backend_ref not found'
end

#source_remoteObject



29
30
31
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 29

def source_remote
  context[:source_remote]
end

#target_backendObject



20
21
22
23
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 20

def target_backend
  context[:target_backend] ||= raise ThreeScaleToolbox::Error, 'Unexpected error. ' \
    'Target backend should have been created or updated'
end

#target_backend=(target) ⇒ Object



16
17
18
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 16

def target_backend=(target)
  context[:target_backend] = target
end

#target_remoteObject



33
34
35
# File 'lib/3scale_toolbox/commands/backend_command/copy_command/task.rb', line 33

def target_remote
  context[:target_remote]
end