Module: Docker::Template::Notify

Defined in:
lib/docker/template/notify.rb

Class Method Summary collapse

Class Method Details

.alias(builder) ⇒ Object

– Notify the user that we are tag aliasing. –



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

def alias(builder)
  repo = builder.repo
  aliased_repo = builder.aliased_repo || builder.aliased_tag
  msg = Simple::Ansi.green("Aliasing #{repo} -> #{aliased_repo}")
  $stderr.puts msg
end

.build(repo, rootfs: false) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/docker/template/notify.rb', line 33

def build(repo, rootfs: false)
  build_start(repo, {
    :rootfs => rootfs
  })

  if block_given?
    yield
    build_end(repo, {
      :rootfs => rootfs
    })
  end
end

.build_end(repo, rootfs: false) ⇒ Object

– Notify the user that building their repository has ended. –



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/docker/template/notify.rb', line 70

def build_end(repo, rootfs: false)
  if ENV["TRAVIS"] && !ENV.key?("RSPEC_RUNNING")
    STDOUT.puts(format("travis_fold:end:%s",
      repo.to_s(:rootfs => rootfs).tr("^A-Za-z0-9", "-").gsub(
        /\-$/, ""
      )
    ))
  end

  $stderr.puts Simple::Ansi.green(format(
    "Done Building: %s", repo.to_s({
      :rootfs => rootfs
    })
  ))
end

.build_start(repo, rootfs: false) ⇒ Object

– Notify the user that we are building their repository. –



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/docker/template/notify.rb', line 50

def build_start(repo, rootfs: false)
  if ENV["TRAVIS"] && !ENV.key?("RSPEC_RUNNING")
    STDOUT.puts(format("travis_fold:end:%s",
      repo.to_s(:rootfs => rootfs).tr("^A-Za-z0-9", "-").gsub(
        /\-$/, ""
      )
    ))
  end

  $stderr.puts Simple::Ansi.green(format(
    "Building: %s", repo.to_s({
      :rootfs => rootfs
    })
  ))
end

.push(builder) ⇒ Object

– Notify the user of a push that is happening. –



14
15
16
17
18
# File 'lib/docker/template/notify.rb', line 14

def push(builder)
  $stderr.puts Simple::Ansi.green(
    "Pushing: #{builder.repo}"
  )
end