Class: IronWorkerNG::Feature::Common::MergeFile::Feature

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#container_add, #rebase

Constructor Details

#initialize(code, path, dest) ⇒ Feature

Returns a new instance of Feature.



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

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

  @path = path
  @dest = dest + (dest.empty? || dest.end_with?('/') ? '' : '/')
end

Instance Attribute Details

#destObject (readonly)

Returns the value of attribute dest.



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

def dest
  @dest
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#build_commandObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/iron_worker_ng/feature/common/merge_file.rb', line 24

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

#bundle(container) ⇒ Object



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

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

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