Class: IronWorkerNG::Feature::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/iron_worker_ng/feature/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Base

Returns a new instance of Base.



4
5
6
# File 'lib/iron_worker_ng/feature/base.rb', line 4

def initialize(code)
  @code = code
end

Instance Method Details

#build_commandObject



39
40
41
# File 'lib/iron_worker_ng/feature/base.rb', line 39

def build_command
  nil
end

#bundle(container) ⇒ Object



36
37
# File 'lib/iron_worker_ng/feature/base.rb', line 36

def bundle(container)
end

#container_add(container, dest, src, commit = false) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/iron_worker_ng/feature/base.rb', line 16

def container_add(container, dest, src, commit = false)
  IronWorkerNG::Fetcher.fetch_to_file(src) do |local_src|
    if local_src.nil? || (not File.exists?(local_src))
      IronCore::Logger.error 'IronWorkerNG', "Can't find src with path='#{src}'", IronCore::Error
    end

    if File.directory?(local_src)
      ::Dir.glob(local_src + '/**/**') do |path|
        container.add(@code.dest_dir + dest + path[local_src.length .. -1], path)
      end
    else
      container.add(@code.dest_dir + dest, local_src)
    end

    if IronWorkerNG::Fetcher.remote?(src) || commit
      container.commit
    end
  end
end

#rebase(path) ⇒ Object



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

def rebase(path)
  if IronWorkerNG::Fetcher.remote?(path) || path.start_with?('/')
    return path
  end

  @code.base_dir + path
end