Class: Docker::Template::Scratch

Inherits:
Common show all
Defined in:
lib/docker/template/scratch.rb

Constant Summary

Constants inherited from Common

Common::CopyMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Common

#aliased?, #build, #chdir_build, #parent_img, #parent_repo, #push, #rootfs?

Constructor Details

#initialize(repo) ⇒ Scratch

Returns a new instance of Scratch.



9
10
11
# File 'lib/docker/template/scratch.rb', line 9

def initialize(repo)
  @repo = repo
end

Instance Attribute Details

#imgObject (readonly)

Returns the value of attribute img.



8
9
10
# File 'lib/docker/template/scratch.rb', line 8

def img
  @img
end

#repoObject (readonly)

Returns the value of attribute repo.



8
9
10
# File 'lib/docker/template/scratch.rb', line 8

def repo
  @repo
end

#rootfsObject (readonly)

Returns the value of attribute rootfs.



8
9
10
# File 'lib/docker/template/scratch.rb', line 8

def rootfs
  @rootfs
end

Instance Method Details

#dataObject



15
16
17
18
19
20
21
# File 'lib/docker/template/scratch.rb', line 15

def data
  Template.get(:scratch, {
    :maintainer => @repo.["maintainer"],
    :entrypoint => @repo.["entry"].fallback,
    :tar_gz => @tar_gz.basename
  })
end


25
26
27
28
29
30
# File 'lib/docker/template/scratch.rb', line 25

def unlink(img: false)
  @copy.rmtree if @copy && @copy.directory?
  @img.delete "force" => true if @img && img
  @context.rmtree if @context && @context.directory?
  @tar_gz.unlink if @tar_gz && @tar_gz.file?
end