Class: Deck::Container::Archive

Inherits:
Object
  • Object
show all
Includes:
Repeatable, Submodule
Defined in:
lib/deck/container/archive.rb

Instance Method Summary collapse

Methods included from Repeatable

#attributes, #next, #step

Methods included from Submodule

#attributes, #get, included, #map, #set, #value

Instance Method Details

#build_command(deps) ⇒ Object



20
21
22
23
# File 'lib/deck/container/archive.rb', line 20

def build_command(deps)
  cmd = "ADD #{attributes[:file]} #{attributes[:path]}\n"
  cmd += "RUN #{send attributes[:type]}"
end

#define(file, path: '/', type: :tar) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/deck/container/archive.rb', line 8

def define(file, path: '/', type: :tar)
  step do
    attributes[:file] = file
    attributes[:path] = path
    attributes[:type] = type
  end
end

#exportObject



16
17
18
# File 'lib/deck/container/archive.rb', line 16

def export
  attributes[:file]
end

#filenameObject



37
38
39
# File 'lib/deck/container/archive.rb', line 37

def filename
  File.basename attributes[:file]
end

#tarObject



25
26
27
# File 'lib/deck/container/archive.rb', line 25

def tar
  "cd #{attributes[:path]} && tar xf #{filename}"
end

#tar_gzObject



29
30
31
# File 'lib/deck/container/archive.rb', line 29

def tar_gz
  "cd #{attributes[:path]} && tar zxf #{filename}"
end

#zipObject



33
34
35
# File 'lib/deck/container/archive.rb', line 33

def zip
  "cd #{attributes[:path]} && unzip #{filename}"
end