volley 0.1.0.alpha10 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/volley +5 -1
- data/conf/common.volleyfile +4 -7
- data/lib/volley/dsl/action.rb +3 -3
- data/lib/volley/dsl/plan.rb +35 -34
- data/lib/volley/dsl/push_action.rb +3 -4
- data/lib/volley/dsl/stage.rb +0 -1
- data/lib/volley/dsl/volley_action.rb +36 -0
- data/lib/volley/meta.rb +4 -0
- data/lib/volley/publisher/amazons3.rb +26 -18
- data/lib/volley/version.rb +2 -1
- data/lib/volley.rb +3 -2
- data/volley.gemspec +1 -1
- metadata +6 -5
data/bin/volley
CHANGED
@@ -93,8 +93,12 @@ module Volley
|
|
93
93
|
Volley::Log.debug "key:value: #{kvs.join(",")}"
|
94
94
|
end
|
95
95
|
|
96
|
-
Volley::Log.info "processing '#{plan}' plan for '#{desc}'"
|
96
|
+
#Volley::Log.info "processing '#{plan}' plan for '#{desc}'"
|
97
97
|
Volley.process(plan, desc, args)
|
98
|
+
rescue Interrupt
|
99
|
+
Volley::Log.info "interrupted"
|
100
|
+
rescue SystemExit
|
101
|
+
Volley::Log.info "exited"
|
98
102
|
rescue => e
|
99
103
|
Volley::Log.error "error: #{e.message} at #{e.backtrace.first}"
|
100
104
|
if debug
|
data/conf/common.volleyfile
CHANGED
@@ -65,14 +65,11 @@ project :volley do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
|
-
plan :remote do
|
68
|
+
plan :meta, :remote => false do
|
69
69
|
default do
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
vf = pub.volleyfile(:project => pr, :branch => br, :version => vr)
|
74
|
-
load vf
|
75
|
-
volley :project => "volley", :plan => "list"
|
70
|
+
Volley.meta.projects.each do |k, v|
|
71
|
+
puts "#{k} => #{v}"
|
72
|
+
end
|
76
73
|
end
|
77
74
|
end
|
78
75
|
end
|
data/lib/volley/dsl/action.rb
CHANGED
@@ -16,15 +16,15 @@ module Volley
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def call
|
19
|
-
Volley::Log.debug "
|
19
|
+
Volley::Log.debug "## #{project.name}:#{@plan.name}[#{@stage}]##@name"
|
20
20
|
self.instance_eval &@block if @block
|
21
21
|
end
|
22
22
|
|
23
|
-
delegate :project, :args, :files, :file, :attributes, :log, :arguments, :argv, :branch, :version, :action,
|
23
|
+
delegate :project, :args, :files, :file, :attributes, :log, :arguments, :argv, :branch, :version, :action, :volley,
|
24
24
|
:to => :plan
|
25
25
|
|
26
26
|
def command(cmd)
|
27
|
-
|
27
|
+
plan.shellout(cmd)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
data/lib/volley/dsl/plan.rb
CHANGED
@@ -4,6 +4,7 @@ module Volley
|
|
4
4
|
module Dsl
|
5
5
|
class Plan
|
6
6
|
attr_accessor :argv
|
7
|
+
attr_reader :name
|
7
8
|
attr_reader :project
|
8
9
|
attr_reader :stages
|
9
10
|
attr_reader :arguments
|
@@ -46,15 +47,15 @@ module Volley
|
|
46
47
|
|
47
48
|
def call(options={ })
|
48
49
|
@mode = @name.to_s =~ /deploy/i ? :deploy : :publish
|
49
|
-
Volley::Log.debug "## #{@project.name}
|
50
|
+
Volley::Log.debug "## #{@project.name}:#@name (#@mode)"
|
50
51
|
@origargs = options[:args]
|
51
52
|
data = @origargs
|
52
53
|
|
53
54
|
process_arguments(data)
|
54
55
|
|
55
56
|
raise "descriptor must be specified" if @attributes.remote && !args.descriptor
|
56
|
-
|
57
|
-
|
57
|
+
|
58
|
+
Volley::Log.info ">> #{@project.name}:#@name"
|
58
59
|
|
59
60
|
run_actions
|
60
61
|
[branch, version].join(":")
|
@@ -101,7 +102,9 @@ module Volley
|
|
101
102
|
end
|
102
103
|
|
103
104
|
def branch
|
104
|
-
|
105
|
+
return args.descriptor.branch if args.descriptor
|
106
|
+
return source.branch if publishing?
|
107
|
+
nil
|
105
108
|
end
|
106
109
|
|
107
110
|
def version
|
@@ -146,29 +149,12 @@ module Volley
|
|
146
149
|
argument :output, :attr => true, :default => tf, :convert => :boolean
|
147
150
|
end
|
148
151
|
|
149
|
-
def default(&block)
|
150
|
-
action(:default, :main, &block)
|
151
|
-
end
|
152
|
-
|
153
152
|
def action(name, stage=:main, &block)
|
154
153
|
@stages[stage].action(name, :plan => self, :stage => stage, &block)
|
155
|
-
#n = name.to_sym
|
156
|
-
#@actions[stage] << { :name => n, :stage => stage, :block => block }
|
157
154
|
end
|
158
155
|
|
159
|
-
def
|
160
|
-
|
161
|
-
end
|
162
|
-
|
163
|
-
def files(*list)
|
164
|
-
list = [*list].flatten
|
165
|
-
if @files.count > 0 && list.count > 0
|
166
|
-
Volley::Log.warn "overriding file list"
|
167
|
-
Volley::Log.debug "files: #{@files.inspect}"
|
168
|
-
Volley::Log.debug "new: #{list.inspect}"
|
169
|
-
end
|
170
|
-
@files = list if list.count > 0
|
171
|
-
@files
|
156
|
+
def default(&block)
|
157
|
+
action(:default, :main, &block)
|
172
158
|
end
|
173
159
|
|
174
160
|
def push(&block)
|
@@ -179,22 +165,38 @@ module Volley
|
|
179
165
|
Volley::Dsl::PullAction.new(:pull_dummy, :plan => self, :stage => :main, &block)
|
180
166
|
end
|
181
167
|
|
182
|
-
def volley(
|
168
|
+
def volley(plan, options={}, &block)
|
183
169
|
o = {
|
184
|
-
:
|
185
|
-
:plan
|
186
|
-
|
170
|
+
:run => plan,
|
171
|
+
:plan => self,
|
172
|
+
:stage => :main,
|
173
|
+
:descriptor => args.descriptor,
|
174
|
+
:args => {},
|
175
|
+
}.merge(options)
|
176
|
+
@stages[:main].add Volley::Dsl::VolleyAction.new("volley-#{plan}", o)
|
177
|
+
end
|
187
178
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
179
|
+
def file(file)
|
180
|
+
@files << file
|
181
|
+
end
|
182
|
+
|
183
|
+
def files(*list)
|
184
|
+
list = [*list].flatten
|
185
|
+
list.each {|e| file e} if list.count > 0
|
186
|
+
#if @files.count > 0 && list.count > 0
|
187
|
+
# Volley::Log.warn "overriding file list"
|
188
|
+
# Volley::Log.debug "files: #{@files.inspect}"
|
189
|
+
# Volley::Log.debug "new: #{list.inspect}"
|
190
|
+
#end
|
191
|
+
#@files = list if list.count > 0
|
192
|
+
#@files
|
193
|
+
@files
|
192
194
|
end
|
193
195
|
|
194
196
|
def command(*args)
|
195
197
|
name = args.join(" ").parameterize.to_sym
|
196
198
|
action name do
|
197
|
-
shellout(*args)
|
199
|
+
plan.shellout(*args)
|
198
200
|
end
|
199
201
|
end
|
200
202
|
|
@@ -215,11 +217,10 @@ module Volley
|
|
215
217
|
|
216
218
|
private
|
217
219
|
def process_arguments(raw)
|
218
|
-
Volley::Log.debug ".. process arguments: #{raw.inspect}"
|
219
220
|
@argv = raw
|
220
221
|
raw.each do |k, v|
|
221
222
|
if @arguments[k.to_sym]
|
222
|
-
Volley::Log.debug "..
|
223
|
+
Volley::Log.debug ".. argument: #{k} = #{v}"
|
223
224
|
@arguments[k.to_sym].value = v
|
224
225
|
end
|
225
226
|
end
|
@@ -12,10 +12,10 @@ module Volley
|
|
12
12
|
raise "stage instance must be set" unless @stage
|
13
13
|
raise "plan instance must be set" unless @plan
|
14
14
|
|
15
|
-
@plan.action :files, :
|
15
|
+
@plan.action :files, :main do
|
16
16
|
raise "branch(#{branch}) and version(#{version}) must be specified" unless branch && version
|
17
17
|
|
18
|
-
list = yield
|
18
|
+
list = yield if block
|
19
19
|
list = [*list].flatten
|
20
20
|
# use #exists? so it can work for directories
|
21
21
|
notfound = list.reject { |f| File.exists?(f) }
|
@@ -32,8 +32,8 @@ module Volley
|
|
32
32
|
Dir.mkdir(path)
|
33
33
|
dir = Dir.pwd
|
34
34
|
|
35
|
+
Volley::Log.debug ".. files: #{files.inspect}"
|
35
36
|
files.each do |art|
|
36
|
-
Volley::Log.debug "art:#{art}"
|
37
37
|
next unless art
|
38
38
|
if art =~ /^\// && art !~ /^#{dir}/
|
39
39
|
# file is full path and not in current directory
|
@@ -47,7 +47,6 @@ module Volley
|
|
47
47
|
end
|
48
48
|
|
49
49
|
begin
|
50
|
-
Volley::Log.debug "pack file: #{source} => #{dest}"
|
51
50
|
FileUtils.mkdir_p(File.dirname(dest))
|
52
51
|
if File.directory?(source)
|
53
52
|
FileUtils.cp_r(source, dest)
|
data/lib/volley/dsl/stage.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
require "volley/dsl/action"
|
2
|
+
|
3
|
+
module Volley
|
4
|
+
module Dsl
|
5
|
+
class VolleyAction < Action
|
6
|
+
def initialize(name, options={}, &block)
|
7
|
+
@name = name.to_sym
|
8
|
+
@stage = options.delete(:stage)
|
9
|
+
@plan = options.delete(:plan)
|
10
|
+
@run = options.delete(:run)
|
11
|
+
@desc = options.delete(:descriptor)
|
12
|
+
@desc ||= @plan.args.descriptor
|
13
|
+
@args = options.delete(:args)
|
14
|
+
|
15
|
+
@options = {
|
16
|
+
}.merge(options)
|
17
|
+
|
18
|
+
raise "stage instance must be set" unless @stage
|
19
|
+
raise "plan instance must be set" unless @plan
|
20
|
+
|
21
|
+
@block = Proc.new do
|
22
|
+
desc = @desc || @plan.args.descriptor
|
23
|
+
plan = @run
|
24
|
+
(runpr, plan) = plan.split(/\:/) if @run =~ /\:/
|
25
|
+
(project, branch, version) = desc.get
|
26
|
+
Volley.process("#{runpr}:#{plan}", "#{runpr}@#{branch}:#{version}", :args => args)
|
27
|
+
end
|
28
|
+
|
29
|
+
#@plan.action "volley-#@run" do
|
30
|
+
# puts "volley run #@run #@desc"
|
31
|
+
# Volley.process(@run, @desc.to_s, :args => args)
|
32
|
+
#end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/volley/meta.rb
CHANGED
@@ -10,28 +10,36 @@ module Volley
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def projects
|
13
|
-
files[:desc].keys
|
13
|
+
r = files[:desc].keys || [] rescue []
|
14
|
+
Volley::Log.info "could not find projects" unless r.count > 0
|
15
|
+
r
|
14
16
|
rescue => e
|
15
17
|
Volley::Log.warn "error getting project list from publisher: #{e.message} at #{e.backtrace.first}"
|
16
18
|
[]
|
17
19
|
end
|
18
20
|
|
19
21
|
def branches(pr)
|
20
|
-
files[:desc][pr].keys
|
22
|
+
r = files[:desc][pr].keys || [] rescue []
|
23
|
+
Volley::Log.info "could not find #{pr}" unless r.count > 0
|
24
|
+
r
|
21
25
|
rescue => e
|
22
26
|
Volley::Log.warn "error getting branch list from publisher: #{e.message}"
|
23
27
|
[]
|
24
28
|
end
|
25
29
|
|
26
30
|
def versions(pr, br)
|
27
|
-
files[:desc][pr][br].keys
|
31
|
+
r = files[:desc][pr][br].keys || [] rescue []
|
32
|
+
Volley::Log.info "could not find #{pr}@#{br}" unless r.count > 0
|
33
|
+
r
|
28
34
|
rescue => e
|
29
35
|
Volley::Log.warn "error getting version list from publisher: #{e.message}"
|
30
36
|
[]
|
31
37
|
end
|
32
38
|
|
33
39
|
def contents(pr, br, vr)
|
34
|
-
files[:desc][pr][br][vr].map {|e| e.gsub("#{pr}/#{br}/#{vr}/","")}
|
40
|
+
r = files[:desc][pr][br][vr].map {|e| e.gsub("#{pr}/#{br}/#{vr}/","")} || [] rescue []
|
41
|
+
Volley::Log.info "could not find #{pr}@#{br}:#{vr}" unless r.count > 0
|
42
|
+
r
|
35
43
|
rescue => e
|
36
44
|
Volley::Log.warn "error getting contents list from publisher: #{e.message}"
|
37
45
|
[]
|
@@ -44,7 +52,7 @@ module Volley
|
|
44
52
|
def delete_project(project)
|
45
53
|
Volley::Log.info "delete_project #{project}"
|
46
54
|
dir = @connection.directories.get(@bucket)
|
47
|
-
dir.files.select{|e| e.key =~ /^#{project}\//}.each do |f|
|
55
|
+
dir.files.select { |e| e.key =~ /^#{project}\// }.each do |f|
|
48
56
|
Volley::Log.info "- #{f.key}"
|
49
57
|
f.destroy
|
50
58
|
end
|
@@ -58,9 +66,9 @@ module Volley
|
|
58
66
|
protected
|
59
67
|
|
60
68
|
def load_configuration
|
61
|
-
@key
|
62
|
-
@secret
|
63
|
-
@bucket
|
69
|
+
@key = requires(:aws_access_key_id)
|
70
|
+
@secret = requires(:aws_secret_access_key)
|
71
|
+
@bucket = requires(:bucket)
|
64
72
|
connect
|
65
73
|
end
|
66
74
|
|
@@ -68,14 +76,14 @@ module Volley
|
|
68
76
|
file = File.basename(file)
|
69
77
|
dest = "#{dir}/#{file}"
|
70
78
|
#log "-> #@bucket/#{path}"
|
71
|
-
f
|
79
|
+
f = root.files.create(:key => dest, :body => contents, :public => true)
|
72
80
|
log "=> #{f.public_url.gsub("%2F", "/")}"
|
73
81
|
dest
|
74
82
|
end
|
75
83
|
|
76
84
|
def pull_file(dir, file, localdir=nil)
|
77
85
|
remote = "#{dir}/#{file}"
|
78
|
-
f
|
86
|
+
f = root.files.get(remote)
|
79
87
|
raise ArtifactMissing, "missing: #{remote}" unless f
|
80
88
|
|
81
89
|
contents = f.body
|
@@ -103,16 +111,16 @@ module Volley
|
|
103
111
|
end
|
104
112
|
|
105
113
|
def files
|
106
|
-
hash = {:desc => {}, :all => {}, :latest => {}}
|
107
|
-
@connection.directories.get(@bucket).files.collect{|e| e.key}.each do |e|
|
108
|
-
(pr, br, vr)
|
109
|
-
hash[:desc][pr]
|
110
|
-
hash[:desc][pr][br]
|
114
|
+
hash = { :desc => { }, :all => { }, :latest => { } }
|
115
|
+
@connection.directories.get(@bucket).files.collect { |e| e.key }.each do |e|
|
116
|
+
(pr, br, vr) = e.split(/\//)
|
117
|
+
hash[:desc][pr] ||= { }
|
118
|
+
hash[:desc][pr][br] ||= { }
|
111
119
|
hash[:desc][pr][br][vr] ||= []
|
112
120
|
hash[:desc][pr][br][vr] << e
|
113
|
-
hash[:all]
|
114
|
-
hash[:latest] ||= {}
|
115
|
-
v
|
121
|
+
hash[:all] ||= { }
|
122
|
+
hash[:latest] ||= { }
|
123
|
+
v = "#{pr}/#{br}/#{vr}"
|
116
124
|
#hash[:latest]["#{pr}/#{br}"] ||= latest(pr, br)
|
117
125
|
hash[:all][v] = hash["latest"] == v
|
118
126
|
end
|
data/lib/volley/version.rb
CHANGED
data/lib/volley.rb
CHANGED
@@ -45,7 +45,8 @@ module Volley
|
|
45
45
|
# plan is defined
|
46
46
|
|
47
47
|
if plan == "deploy" && Volley.meta.check(project, branch, version) && !args[:force]
|
48
|
-
|
48
|
+
Volley::Log.info "project #{project} is already #{branch}:#{version}"
|
49
|
+
return
|
49
50
|
end
|
50
51
|
|
51
52
|
args[:descriptor] = desc
|
@@ -73,7 +74,7 @@ module Volley
|
|
73
74
|
Volley::Log.debug "downloaded volleyfile: #{vf}"
|
74
75
|
Volley::Dsl::VolleyFile.load(vf)
|
75
76
|
args[:second] = true
|
76
|
-
process("#{project}:#{plan}",
|
77
|
+
process("#{project}:#{plan}", "#{project}@#{branch}:#{version}", args)
|
77
78
|
else
|
78
79
|
raise "project #{project} does not exist in configured publisher #{pub.class}"
|
79
80
|
end
|
data/volley.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
14
|
gem.name = "volley"
|
15
15
|
gem.require_paths = ["lib"]
|
16
|
-
gem.version = "#{Volley::Version::STRING}
|
16
|
+
gem.version = "#{Volley::Version::STRING}"
|
17
17
|
|
18
18
|
gem.add_dependency "clamp"
|
19
19
|
gem.add_dependency "fog"
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: volley
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Shawn Catanzarite
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: clamp
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/volley/dsl/pull_action.rb
|
141
141
|
- lib/volley/dsl/push_action.rb
|
142
142
|
- lib/volley/dsl/stage.rb
|
143
|
+
- lib/volley/dsl/volley_action.rb
|
143
144
|
- lib/volley/log.rb
|
144
145
|
- lib/volley/meta.rb
|
145
146
|
- lib/volley/publisher/amazons3.rb
|
@@ -181,9 +182,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
183
|
none: false
|
183
184
|
requirements:
|
184
|
-
- - ! '
|
185
|
+
- - ! '>='
|
185
186
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
187
|
+
version: '0'
|
187
188
|
requirements: []
|
188
189
|
rubyforge_project:
|
189
190
|
rubygems_version: 1.8.21
|