Class: IronWorkerNG::Feature::Common::MergeExec::Feature

Inherits:
Base
  • Object
show all
Defined in:
lib/iron_worker_ng/feature/common/merge_exec.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#container_add, #rebase

Constructor Details

#initialize(code, path, args) ⇒ Feature

Returns a new instance of Feature.



9
10
11
12
13
14
# File 'lib/iron_worker_ng/feature/common/merge_exec.rb', line 9

def initialize(code, path, args)
  super(code)

  @path = path
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



7
8
9
# File 'lib/iron_worker_ng/feature/common/merge_exec.rb', line 7

def args
  @args
end

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/iron_worker_ng/feature/common/merge_exec.rb', line 6

def path
  @path
end

Instance Method Details

#arg(name, i = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/iron_worker_ng/feature/common/merge_exec.rb', line 16

def arg(name, i = nil)
  if @args.is_a?(Hash)
    return @args[name.to_sym] || @args[name.to_s]
  elsif @args.is_a?(Array) && (not i.nil?)
    return @args[i]
  end

  nil
end

#build_commandObject



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/iron_worker_ng/feature/common/merge_exec.rb', line 34

def build_command
  if @code.remote_build_command || @code.full_remote_build
    if @code.full_remote_build && IronWorkerNG::Fetcher.remote?(rebase(@path))
      "exec '#{rebase(@path)}', #{@args.inspect}"
    else
      "exec '#{@code.dest_dir}#{File.basename(@path)}', #{@args.inspect}"
    end
  else
    nil
  end
end

#bundle(container) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/iron_worker_ng/feature/common/merge_exec.rb', line 26

def bundle(container)
  IronCore::Logger.debug 'IronWorkerNG', "Bundling exec with path='#{@path}' and args='#{@args.inspect}'"

  if (not @code.full_remote_build) || (not IronWorkerNG::Fetcher.remote?(rebase(@path)))
    container_add(container, File.basename(@path), rebase(@path))
  end
end