volley 0.1.18 → 0.1.19
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/CHANGELOG.md +3 -0
- data/bin/volley +1 -1
- data/conf/common.volleyfile +50 -0
- data/lib/volley/descriptor.rb +1 -1
- data/lib/volley/dsl/plan.rb +1 -1
- data/lib/volley/dsl/push_action.rb +4 -1
- data/lib/volley/publisher/amazons3.rb +2 -2
- data/lib/volley/publisher/base.rb +23 -0
- data/lib/volley/publisher/local.rb +2 -2
- data/lib/volley/version.rb +1 -1
- data/spec/descriptor_spec.rb +1 -0
- data/spec/publisher_spec.rb +17 -6
- data/volley.gemspec +2 -3
- metadata +5 -21
data/CHANGELOG.md
CHANGED
data/bin/volley
CHANGED
@@ -112,7 +112,7 @@ module Volley
|
|
112
112
|
rescue Docopt::Exit => e
|
113
113
|
Volley::Log.info e.message
|
114
114
|
rescue => e
|
115
|
-
Volley::Log.error "error: #{e
|
115
|
+
Volley::Log.error "error: '#{e.message}' at #{e.backtrace.first}"
|
116
116
|
Volley::Log.debug e
|
117
117
|
exit 1
|
118
118
|
end
|
data/conf/common.volleyfile
CHANGED
@@ -46,6 +46,17 @@ project :volley do
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
plan :released, remote: false do
|
50
|
+
argument :project, required: true
|
51
|
+
default do
|
52
|
+
p = args.project
|
53
|
+
pub = Volley::Dsl.publisher
|
54
|
+
r = pub.latest_release(p)
|
55
|
+
|
56
|
+
puts "latest '#{p}' release: #{r}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
49
60
|
plan :versions, :remote => false do
|
50
61
|
argument :all, :convert => :boolean, :default => false
|
51
62
|
argument :output, :default => "list", :convert => :to_sym, :choices => ["json", "xml", "list"]
|
@@ -120,6 +131,45 @@ project :volley do
|
|
120
131
|
end
|
121
132
|
end
|
122
133
|
|
134
|
+
plan :release do
|
135
|
+
argument :version, required: true
|
136
|
+
localfile = nil
|
137
|
+
reldesc = nil
|
138
|
+
tmpdir = "/var/tmp/volley-%d-%d-%05d" % [Time.now.to_i, $$, rand(99999)]
|
139
|
+
pub = Volley::Dsl.publisher
|
140
|
+
|
141
|
+
action :mktmp do
|
142
|
+
FileUtils.mkdir_p(tmpdir)
|
143
|
+
Dir.chdir(tmpdir)
|
144
|
+
end
|
145
|
+
action :download do
|
146
|
+
desc = args.descriptor
|
147
|
+
to = args.version
|
148
|
+
reldesc = Descriptor.new("#{desc.project}@release:#{to}")
|
149
|
+
puts "#{desc} => #{reldesc}"
|
150
|
+
(p, b, v) = desc.get
|
151
|
+
localfile = pub.pull(p, b, v)
|
152
|
+
log "downloaded: #{localfile}"
|
153
|
+
end
|
154
|
+
action :release do
|
155
|
+
(p, b, v) = reldesc.get
|
156
|
+
pub.release(tmpdir, localfile, p, b, v)
|
157
|
+
end
|
158
|
+
action :cleanup do
|
159
|
+
FileUtils.remove_entry_secure(tmpdir)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
plan :download do
|
164
|
+
default do
|
165
|
+
desc = args.descriptor
|
166
|
+
pub = Volley::Dsl.publisher
|
167
|
+
(p, b, v) = desc.get
|
168
|
+
f = pub.pull(p, b, v)
|
169
|
+
log "downloaded: #{f}"
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
123
173
|
plan :exists, :remote => false do
|
124
174
|
default do
|
125
175
|
(project, branch, version) = args.descriptor.get
|
data/lib/volley/descriptor.rb
CHANGED
@@ -13,7 +13,7 @@ module Volley
|
|
13
13
|
@branch = nil
|
14
14
|
@version = nil
|
15
15
|
|
16
|
-
list = desc.split(/[
|
16
|
+
list = desc.split(/[\@\:\/\\\-]/)
|
17
17
|
raise "error parsing descriptor: #{desc}" if (list.count < 2 || list.count > 4) && !@options[:partial]
|
18
18
|
|
19
19
|
(@project, @branch, @version, @after) = list
|
data/lib/volley/dsl/plan.rb
CHANGED
@@ -67,7 +67,7 @@ module Volley
|
|
67
67
|
rescue ExecutionStopped => e
|
68
68
|
Volley::Log.debug "stopping execution at #{e.backtrace.first}"
|
69
69
|
rescue => e
|
70
|
-
|
70
|
+
Volley::Log.debug "plan#call error: #{e.message} at #{e.backtrace.first}"
|
71
71
|
raise e
|
72
72
|
end
|
73
73
|
[branch, version].join(":")
|
@@ -8,6 +8,9 @@ module Volley
|
|
8
8
|
@stage = options.delete(:stage)
|
9
9
|
@plan = options.delete(:plan)
|
10
10
|
@options = {
|
11
|
+
project: nil,
|
12
|
+
branch: nil,
|
13
|
+
version: nil,
|
11
14
|
}.merge(options)
|
12
15
|
raise "stage instance must be set" unless @stage
|
13
16
|
raise "plan instance must be set" unless @plan
|
@@ -104,7 +107,7 @@ module Volley
|
|
104
107
|
|
105
108
|
@plan.action :push, :post do
|
106
109
|
publisher = Volley::Dsl.publisher
|
107
|
-
publisher.push(project.name, branch, version, attributes.artifact)
|
110
|
+
publisher.push(options[:project] || project.name, options[:branch] || branch, options[:version] || version, attributes.artifact)
|
108
111
|
end
|
109
112
|
end
|
110
113
|
end
|
@@ -22,7 +22,7 @@ module Volley
|
|
22
22
|
pr = project.to_s
|
23
23
|
r = files[:desc][pr].keys || [] rescue []
|
24
24
|
Volley::Log.info "could not find #{pr}" unless r.count > 0
|
25
|
-
r
|
25
|
+
r.reject {|e| ["latest_release"].include?(e)}
|
26
26
|
rescue => e
|
27
27
|
Volley::Log.warn "error getting branch list from publisher: #{e.message}"
|
28
28
|
[]
|
@@ -33,7 +33,7 @@ module Volley
|
|
33
33
|
br = branch.to_s
|
34
34
|
r = files[:desc][pr][br].keys || [] rescue []
|
35
35
|
Volley::Log.info "could not find #{pr}@#{br}" unless r.count > 0
|
36
|
-
r.reject { |e|
|
36
|
+
r.reject { |e| ["","latest","latest_release"].include?(e) }
|
37
37
|
rescue => e
|
38
38
|
Volley::Log.warn "error getting version list from publisher: #{e.message}"
|
39
39
|
[]
|
@@ -78,6 +78,10 @@ module Volley
|
|
78
78
|
latest(project, branch).split("/").last
|
79
79
|
end
|
80
80
|
|
81
|
+
def latest_release(project)
|
82
|
+
pull_file(project, "latest_release")
|
83
|
+
end
|
84
|
+
|
81
85
|
def volleyfile(project, branch, version="latest")
|
82
86
|
d = dir(project, branch, version)
|
83
87
|
contents = pull_file(d, "Volleyfile")
|
@@ -121,6 +125,25 @@ module Volley
|
|
121
125
|
"#@local/#{dir}/#{file}"
|
122
126
|
end
|
123
127
|
|
128
|
+
def release(tmpdir, local, p, b, v)
|
129
|
+
Dir.chdir(tmpdir) do
|
130
|
+
packed = "#{b}-#{v}.tgz"
|
131
|
+
dest = dir(p, b, v)
|
132
|
+
|
133
|
+
system("tar xfz #{local}")
|
134
|
+
|
135
|
+
files = Dir["**"]
|
136
|
+
|
137
|
+
system("tar cfz #{packed} #{files.join(" ")}")
|
138
|
+
push_file(dest, packed, File.open(packed))
|
139
|
+
push_file(dest, "Volleyfile", File.open("Volleyfile")) if File.exists?("Volleyfile")
|
140
|
+
push_file(dir(p, b), "latest", "#{p}/#{b}/#{v}")
|
141
|
+
push_file(p, "latest_release", "#{p}/#{b}/#{v}")
|
142
|
+
end
|
143
|
+
|
144
|
+
true
|
145
|
+
end
|
146
|
+
|
124
147
|
protected
|
125
148
|
|
126
149
|
def me
|
@@ -12,13 +12,13 @@ module Volley
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def branches(pr)
|
15
|
-
Dir["#@directory/#{pr}/*"].map {|e| e.gsub(/#@directory\/#{pr}\//,"")}
|
15
|
+
Dir["#@directory/#{pr}/*"].map {|e| e.gsub(/#@directory\/#{pr}\//,"")}.reject {|e| ["latest_release"].include?(e)}
|
16
16
|
end
|
17
17
|
|
18
18
|
def versions(pr, br)
|
19
19
|
Dir["#@directory/#{pr}/#{br}/*"].map do |e|
|
20
20
|
e.gsub(/#@directory\/#{pr}\/#{br}\//,"")
|
21
|
-
end.reject {|e|
|
21
|
+
end.reject { |e| ["","latest","latest_release"].include?(e) }
|
22
22
|
end
|
23
23
|
|
24
24
|
def exists?(project, branch, version)
|
data/lib/volley/version.rb
CHANGED
data/spec/descriptor_spec.rb
CHANGED
data/spec/publisher_spec.rb
CHANGED
@@ -33,7 +33,18 @@ shared_examples_for Volley::Publisher::Base do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should fail to retrieve a missing artifact" do
|
36
|
-
expect{ @pub.pull("spec", "trunk", "15")}.to raise_error(Volley::Publisher::ArtifactMissing)
|
36
|
+
expect { @pub.pull("spec", "trunk", "15") }.to raise_error(Volley::Publisher::ArtifactMissing)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should be able to release an artifact" do
|
40
|
+
tmpdir = "#{Dir.pwd}/test/tmp"
|
41
|
+
FileUtils.mkdir_p(tmpdir)
|
42
|
+
Dir.chdir(tmpdir) do
|
43
|
+
local = @pub.pull("spec", "trunk", "1")
|
44
|
+
expect(@pub.release(tmpdir, local, "spec", "release", "v1.0")).to be(true)
|
45
|
+
expect(@pub.versions("spec", "release")).to match_array(%w{v1.0})
|
46
|
+
end
|
47
|
+
FileUtils.remove_entry_secure(tmpdir)
|
37
48
|
end
|
38
49
|
|
39
50
|
it "should be able to tell me the list of projects" do
|
@@ -41,7 +52,7 @@ shared_examples_for Volley::Publisher::Base do
|
|
41
52
|
end
|
42
53
|
|
43
54
|
it "should be able to tell me the list of branches" do
|
44
|
-
expect(@pub.branches("spec")).to match_array(%w{trunk staging})
|
55
|
+
expect(@pub.branches("spec")).to match_array(%w{release trunk staging})
|
45
56
|
end
|
46
57
|
|
47
58
|
it "should be able to tell me the list of versions" do
|
@@ -49,14 +60,14 @@ shared_examples_for Volley::Publisher::Base do
|
|
49
60
|
end
|
50
61
|
|
51
62
|
it "should be able to tell me the list of files" do
|
52
|
-
expect(@pub.contents("spec","trunk","2")).to match_array(%w{trunk-1.tgz})
|
63
|
+
expect(@pub.contents("spec", "trunk", "2")).to match_array(%w{trunk-1.tgz})
|
53
64
|
end
|
54
65
|
|
55
66
|
it "should be able to get a remote volleyfile" do
|
56
67
|
Dir.chdir("#{root}/test/project")
|
57
|
-
expect(@pub.push("spec","trunk","3","Volleyfile")).to eq(true)
|
68
|
+
expect(@pub.push("spec", "trunk", "3", "Volleyfile")).to eq(true)
|
58
69
|
Dir.chdir(root)
|
59
|
-
expect(@pub.volleyfile("spec","trunk","3")).to match(/#@local\/Volleyfile-.*-.*/)
|
70
|
+
expect(@pub.volleyfile("spec", "trunk", "3")).to match(/#@local\/Volleyfile-.*-.*/)
|
60
71
|
end
|
61
72
|
|
62
73
|
it "should be able to tell me the latest of a project and branch" do
|
@@ -69,7 +80,7 @@ shared_examples_for Volley::Publisher::Base do
|
|
69
80
|
|
70
81
|
it "should be able to force publish a duplicate artifact" do
|
71
82
|
Dir.chdir("#{root}/test/")
|
72
|
-
o
|
83
|
+
o = @pub.force
|
73
84
|
@pub.force = true
|
74
85
|
expect(@pub.push("spec", "trunk", "1", "./trunk-1.tgz")).to eq(true)
|
75
86
|
@pub.force = o
|
data/volley.gemspec
CHANGED
@@ -13,14 +13,13 @@ 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 =
|
16
|
+
gem.version = Volley::Version::STRING
|
17
17
|
|
18
18
|
gem.add_dependency "clamp"
|
19
19
|
gem.add_dependency "fog"
|
20
20
|
gem.add_dependency "activesupport"
|
21
21
|
gem.add_dependency "mixlib-shellout"
|
22
22
|
gem.add_dependency "yell"
|
23
|
-
gem.add_dependency "docopt"
|
23
|
+
gem.add_dependency "docopt"
|
24
24
|
gem.add_dependency "daemons"
|
25
|
-
gem.add_dependency "awesome_print"
|
26
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: volley
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.19
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: clamp
|
@@ -93,22 +93,6 @@ dependencies:
|
|
93
93
|
version: '0'
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: docopt
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - '='
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: 0.5.0
|
102
|
-
type: :runtime
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - '='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: 0.5.0
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: daemons
|
112
96
|
requirement: !ruby/object:Gem::Requirement
|
113
97
|
none: false
|
114
98
|
requirements:
|
@@ -124,7 +108,7 @@ dependencies:
|
|
124
108
|
- !ruby/object:Gem::Version
|
125
109
|
version: '0'
|
126
110
|
- !ruby/object:Gem::Dependency
|
127
|
-
name:
|
111
|
+
name: daemons
|
128
112
|
requirement: !ruby/object:Gem::Requirement
|
129
113
|
none: false
|
130
114
|
requirements:
|
@@ -215,7 +199,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
215
199
|
version: '0'
|
216
200
|
segments:
|
217
201
|
- 0
|
218
|
-
hash:
|
202
|
+
hash: 974353220657797386
|
219
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
204
|
none: false
|
221
205
|
requirements:
|
@@ -224,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
208
|
version: '0'
|
225
209
|
segments:
|
226
210
|
- 0
|
227
|
-
hash:
|
211
|
+
hash: 974353220657797386
|
228
212
|
requirements: []
|
229
213
|
rubyforge_project:
|
230
214
|
rubygems_version: 1.8.24
|