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 "usage: ploy -b BUCKET [-d DEPLOYMENT -B BRANCH -v VERSION | -f DATAFILE]\n\n\#{optparser}\n\nExamples:\n  $ ploy bless -b deploybucket -d someproject -B master -v 6d4a094dcaad6e421f85b24c7c75153db72ab00c\n  $ ploy bless -b deploybucket -f /tmp/version_info.json\n\nSummary\n\n  The bless command takes action to verify that specific package is \"blessed\" to go to production.\n  It should only be marked as such after a successful run through unit, integration and smoke\n  tests.\n\n"
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