Class: Ploy::Command::Bless

Inherits:
Base
  • Object
show all
Defined in:
lib/ploy/command/bless.rb

Instance Method Summary collapse

Instance Method Details

#helpObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/ploy/command/bless.rb', line 25

def help
  return <<helptext
usage: ploy -b BUCKET [-d DEPLOYMENT -B BRANCH -v VERSION | -f DATAFILE]

#{optparser}

Examples:
  $ ploy bless -b deploybucket -d someproject -B master -v 6d4a094dcaad6e421f85b24c7c75153db72ab00c
  $ ploy bless -b deploybucket -f /tmp/version_info.json

Summary

  The bless command takes action to verify that specific package is "blessed" to go to production.
  It should only be marked as such after a successful run through unit, integration and smoke
  tests.

helptext
end

#run(argv) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ploy/command/bless.rb', line 8

def run(argv)
  o = { :variant => "blessed" }
  optparser(o).parse!(argv)
  pkgs = []
  if (o[:datapath]) then
    pkgs = Ploy::Package.(o[:bucket], JSON.parse(File.read(o[:datapath])))
  else
    pkgs.push Ploy::Package.new(o[:bucket], o[:deploy], o[:branch], o[:version])
  end

  pkgs.each do |pkg|
    blessed = pkg.bless(o[:variant])
    blessed.make_current
    puts "blessed #{pkg.deploy_name}/#{pkg.branch} at #{pkg.version} with variant #{o[:variant]}"
  end
end