9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/ploy/command/list.rb', line 9
def run(argv)
o = {:branch => 'master', :all => false, :json => false, :deploy => nil}
optparser(o).parse!(argv)
bucket = o[:bucket]
branch = o[:branch]
packages = []
if o[:deploy].nil?
store = Ploy::S3Storage.new(bucket)
packages = store.list
else
packages = [o[:deploy]]
end
packages.each do |name|
current = Ploy::Package.new(bucket, name, branch, 'current').remote_version
blessed_current = Ploy::Package.new(bucket, name, branch, 'current', 'blessed').remote_version
if o[:all] || current != blessed_current
if o[:json]
h = { name => {
'name' => name,
'sha' => current,
'branch' => branch,
'blessed_sha' => blessed_current
} }
puts h.to_json
else
puts "#{name} #{branch} #{current} #{blessed_current}"
end
end
end
end
|