ploy 0.0.21 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/ploy/command.rb +2 -0
- data/lib/ploy/command/bless.rb +1 -1
- data/lib/ploy/command/help.rb +1 -0
- data/lib/ploy/command/list.rb +88 -0
- data/lib/ploy/s3storage.rb +13 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDM2ZGI2OWE5OTY0NmE1MWY5Y2EwYzU4NTgxNzJkMDI3ZDFhMjc5Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWQ5MWYyODUxNzRjNDlhNTk1NTY3ZGU2MjJiZjhkOWMxZWE5MmJiMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmM5YjZhODQyYWIwODZjOTc2N2E2YzEwMGZkN2NiODVhOGNmZWVkNTBiNDYw
|
10
|
+
ZmMxMjRmNjcwYTQyMWJmZWMwMWE0MjQxYTk1YWRlOTMzMjZkZTk3MzFhY2Fm
|
11
|
+
YmRhODFiZDU2N2ZjNTAzNmQzYjNmZmI0ZjkyNmY0ZThhNjMwYmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmFkNzJhNTU1YTVmNzExMmZlOTU3ZTI2YjQzOTM3ZTRlYjBiN2ExZGMxZDE1
|
14
|
+
MjNjZjA5OWY5MGJiMTM4ZTZmOWIwODBjY2JkMTk2MTdmMTc4MTNiYTI5MTkz
|
15
|
+
ZjBmZGExMGJkYTNhMzFmNTQ2YTgwYzBjYTQ1MzU0OTY3ZTZjNjQ=
|
data/lib/ploy/command.rb
CHANGED
@@ -5,6 +5,7 @@ require 'ploy/command/bless'
|
|
5
5
|
require 'ploy/command/oracle'
|
6
6
|
require 'ploy/command/client'
|
7
7
|
require 'ploy/command/build'
|
8
|
+
require 'ploy/command/list'
|
8
9
|
|
9
10
|
module Ploy
|
10
11
|
module Command
|
@@ -17,6 +18,7 @@ module Ploy
|
|
17
18
|
'oracle' => Ploy::Command::Oracle,
|
18
19
|
'client' => Ploy::Command::Client,
|
19
20
|
'build' => Ploy::Command::Build,
|
21
|
+
'list' => Ploy::Command::List
|
20
22
|
}
|
21
23
|
mod = lookup[topic] || lookup['help']
|
22
24
|
return mod.new
|
data/lib/ploy/command/bless.rb
CHANGED
data/lib/ploy/command/help.rb
CHANGED
@@ -0,0 +1,88 @@
|
|
1
|
+
require 'ploy/command/base'
|
2
|
+
require 'ploy/package'
|
3
|
+
require 'json'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
module Ploy
|
7
|
+
module Command
|
8
|
+
class List < Base
|
9
|
+
def run(argv)
|
10
|
+
o = {:branch => 'master', :all => false, :json => false, :deploy => nil}
|
11
|
+
optparser(o).parse!(argv)
|
12
|
+
#puts o.to_yaml
|
13
|
+
|
14
|
+
bucket = o[:bucket]
|
15
|
+
branch = o[:branch]
|
16
|
+
|
17
|
+
packages = []
|
18
|
+
if o[:deploy].nil?
|
19
|
+
store = Ploy::S3Storage.new(bucket)
|
20
|
+
packages = store.list
|
21
|
+
else
|
22
|
+
packages = [o[:deploy]]
|
23
|
+
end
|
24
|
+
|
25
|
+
packages.each do |name|
|
26
|
+
current = Ploy::Package.new(bucket, name, branch, 'current').remote_version
|
27
|
+
blessed_current = Ploy::Package.new(bucket, name, branch, 'current', 'blessed').remote_version
|
28
|
+
|
29
|
+
if o[:all] || current != blessed_current
|
30
|
+
if o[:json]
|
31
|
+
h = { name => {
|
32
|
+
'name' => name,
|
33
|
+
'sha' => current,
|
34
|
+
'branch' => branch,
|
35
|
+
'blessed_sha' => blessed_current
|
36
|
+
} }
|
37
|
+
puts h.to_json
|
38
|
+
else
|
39
|
+
puts "#{name} #{branch} #{current} #{blessed_current}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def help
|
46
|
+
return <<helptext
|
47
|
+
usage: ploy -b BUCKET [-d DEPLOYMENT -B BRANCH]
|
48
|
+
|
49
|
+
#{optparser}
|
50
|
+
|
51
|
+
Examples:
|
52
|
+
$ ploy list -b deploybucket
|
53
|
+
|
54
|
+
Summary
|
55
|
+
|
56
|
+
The list command lists published packages, their current sha, and
|
57
|
+
their current blessed sha. (By default it only lists packages where
|
58
|
+
blessed is not current.)
|
59
|
+
helptext
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
def optparser(o)
|
64
|
+
options = OptionParser.new do |opts|
|
65
|
+
opts.banner = ''
|
66
|
+
opts.on("-b", "--bucket BUCKET", "use the given S3 bucket") do |bucket|
|
67
|
+
o[:bucket] = bucket
|
68
|
+
end
|
69
|
+
opts.on("-d", "--deployment DEPLOYMENT", "only return results for the given deployment") do |dep|
|
70
|
+
o[:deploy] = dep
|
71
|
+
end
|
72
|
+
opts.on("-B", "--branch BRANCH", "use the given branch instead of #{o[:branch]}") do |branch|
|
73
|
+
o[:branch] = branch
|
74
|
+
end
|
75
|
+
|
76
|
+
opts.on("-a", "--all", "include packages where blessed is current") do |asdf|
|
77
|
+
o[:all] = true
|
78
|
+
end
|
79
|
+
opts.on("-j", "--json", "output json suitable for bless") do |asdf|
|
80
|
+
o[:json] = true
|
81
|
+
end
|
82
|
+
end
|
83
|
+
return options
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/lib/ploy/s3storage.rb
CHANGED
@@ -36,5 +36,18 @@ module Ploy
|
|
36
36
|
return {}
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
40
|
+
def list
|
41
|
+
tree = AWS::S3.new.buckets[@bucketname].as_tree
|
42
|
+
dirs = tree.children.select(&:branch?).collect(&:prefix)
|
43
|
+
package_names = []
|
44
|
+
dirs.each do |dir|
|
45
|
+
dir.chop!
|
46
|
+
if dir != 'hub' && dir != 'blessed'
|
47
|
+
package_names.push(dir)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
return package_names
|
51
|
+
end
|
39
52
|
end
|
40
53
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bruce
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/ploy/command/client.rb
|
69
69
|
- lib/ploy/command/help.rb
|
70
70
|
- lib/ploy/command/install.rb
|
71
|
+
- lib/ploy/command/list.rb
|
71
72
|
- lib/ploy/command/oracle.rb
|
72
73
|
- lib/ploy/command/publish.rb
|
73
74
|
- lib/ploy/common.rb
|