Class: Vanagon::CLI::Sign

Inherits:
Vanagon::CLI show all
Defined in:
lib/vanagon/cli/sign.rb

Constant Summary collapse

DOCUMENTATION =
<<~DOCOPT.freeze
  Usage:
    sign [--help]

  Options:
    -h, --help                       Display help
DOCOPT

Instance Method Summary collapse

Methods inherited from Vanagon::CLI

#options_translate, #options_validate

Instance Method Details

#parse(argv) ⇒ Object



15
16
17
18
19
20
# File 'lib/vanagon/cli/sign.rb', line 15

def parse(argv)
  Docopt.docopt(DOCUMENTATION, { argv: argv })
rescue Docopt::Exit => e
  VanagonLogger.error e.message
  exit 1
end

#run(_) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vanagon/cli/sign.rb', line 22

def run(_)
  ENV['PROJECT_ROOT'] = Dir.pwd
  if Dir['output/**/*'].select { |entry| File.file?(entry) }.empty?
    VanagonLogger.error 'sign: Error: No packages to sign in the "output" directory. Maybe build some first?'
    exit 1
  end

  require 'packaging'
  Pkg::Util::RakeUtils.load_packaging_tasks
  Pkg::Util::RakeUtils.invoke_task('pl:jenkins:sign_all', 'output')
end