volley 0.1.21 → 0.1.23
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-version +1 -0
- data/CHANGELOG.md +7 -0
- data/conf/common.volleyfile +126 -6
- data/lib/volley/dsl/argument.rb +11 -4
- data/lib/volley/dsl/plan.rb +2 -2
- data/lib/volley/publisher/amazons3.rb +23 -6
- data/lib/volley/publisher/local.rb +16 -4
- data/lib/volley/version.rb +1 -1
- data/spec/publisher_spec.rb +23 -8
- metadata +5 -4
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-1.9.3-p286@volley
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.1.22:
|
4
|
+
* add support for deleting branches and versions
|
5
|
+
* ruby version file
|
6
|
+
|
7
|
+
## v0.1.21:
|
8
|
+
* use common regex for descriptor checks and processing
|
9
|
+
|
3
10
|
## v0.1.20:
|
4
11
|
* better support for publisher#release and volley:released plan. should now be able to see which version a release is from
|
5
12
|
|
data/conf/common.volleyfile
CHANGED
@@ -15,7 +15,7 @@ project :volley do
|
|
15
15
|
Volley::Log.info "SCM:"
|
16
16
|
Volley::Log.info ".. branch: #{source.branch} revision: #{source.revision}" if source
|
17
17
|
Volley::Log.info "Projects/Plans:"
|
18
|
-
Volley::Dsl::Project.projects.reject { |k, _|
|
18
|
+
Volley::Dsl::Project.projects.reject { |k, _| [:volley, :release, :project, :branch, :version].include?(k) }.each do |p, project|
|
19
19
|
h = project.plans
|
20
20
|
next unless h.count > 0
|
21
21
|
h.keys.each do |pl|
|
@@ -28,10 +28,10 @@ project :volley do
|
|
28
28
|
plan :list, :remote => false do
|
29
29
|
default do
|
30
30
|
Volley::Dsl::Project.projects.each do |p, project|
|
31
|
-
Volley::Log.info "project: #{p}"
|
32
31
|
project.plans.each do |pl, plan|
|
33
|
-
Volley::Log.info "
|
32
|
+
Volley::Log.info "#{p}:#{pl} #{plan.usage}"
|
34
33
|
end
|
34
|
+
Volley::Log.info ""
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -69,7 +69,7 @@ project :volley do
|
|
69
69
|
default do
|
70
70
|
(project, branch, version) = args.descriptor.get
|
71
71
|
|
72
|
-
pub
|
72
|
+
pub = Volley::Dsl.publisher
|
73
73
|
data = []
|
74
74
|
if args.all
|
75
75
|
data = pub.all.keys.reject { |e| e =~ /latest$/ }
|
@@ -162,7 +162,127 @@ project :volley do
|
|
162
162
|
plan :exists, :remote => false do
|
163
163
|
default do
|
164
164
|
(project, branch, version) = args.descriptor.get
|
165
|
-
pub
|
165
|
+
pub = Volley::Dsl.publisher
|
166
|
+
if project && branch && version != "latest"
|
167
|
+
if pub.exists?(project, branch, version)
|
168
|
+
Volley::Log.warn "#{args.descriptor} exists"
|
169
|
+
else
|
170
|
+
Volley::Log.warn "#{args.descriptor} does not exist"
|
171
|
+
raise "#{args.descriptor} does not exist"
|
172
|
+
end
|
173
|
+
else
|
174
|
+
Volley::Log.error "must specify full descriptor"
|
175
|
+
stop
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
project :release do
|
182
|
+
plan :create do
|
183
|
+
argument :version, required: true
|
184
|
+
|
185
|
+
default do
|
186
|
+
pub = Volley::Dsl.publisher
|
187
|
+
desc = args.descriptor
|
188
|
+
to = args.version
|
189
|
+
old = desc.to_s
|
190
|
+
new = "#{desc.project}@release:#{to}"
|
191
|
+
pub.release(old, new)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
plan :list, remote: false do
|
196
|
+
argument :project, required: true
|
197
|
+
default do
|
198
|
+
p = args.project
|
199
|
+
pub = Volley::Dsl.publisher
|
200
|
+
r = pub.latest_release(p)
|
201
|
+
list = pub.versions(p, "release")
|
202
|
+
list.each do |v|
|
203
|
+
f = pub.released_from(p, v) || "unknown" rescue "unknown"
|
204
|
+
puts " #{v} <= #{f}"
|
205
|
+
end
|
206
|
+
|
207
|
+
puts "latest '#{p}' release: #{r}"
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
project :project do
|
213
|
+
plan :list, remote: false do
|
214
|
+
default do
|
215
|
+
pub = Volley::Dsl.publisher
|
216
|
+
pub.projects.each do |p|
|
217
|
+
Volley::Log.warn p
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
plan :remove, remote: false do
|
222
|
+
argument :name, required: true
|
223
|
+
#argument :force, default: false, convert: :boolean
|
224
|
+
default do
|
225
|
+
pub = Volley::Dsl.publisher
|
226
|
+
if args.force
|
227
|
+
Volley::Log.debug "removing project: #{args.name}"
|
228
|
+
pub.delete_project(args.name)
|
229
|
+
else
|
230
|
+
Volley::Log.warn "this process cannot be undone, if you are sure, run the same command with -F"
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
project :branch do
|
237
|
+
plan :list, remote: false do
|
238
|
+
argument :project, required: true
|
239
|
+
default do
|
240
|
+
Volley::Dsl.publisher.branches(args.project).each do |b|
|
241
|
+
Volley::Log.warn "#{args.project}@#{b}"
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
245
|
+
plan :remove do
|
246
|
+
default do
|
247
|
+
pub = Volley::Dsl.publisher
|
248
|
+
p = args.descriptor.project
|
249
|
+
b = args.descriptor.branch
|
250
|
+
if args.force
|
251
|
+
Volley::Log.debug "removing branch: #{p}@#{b}"
|
252
|
+
pub.delete_branch(p, b)
|
253
|
+
else
|
254
|
+
Volley::Log.warn "this process cannot be undone, if you are sure, run the same command with -F"
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
project :version do
|
261
|
+
plan :list do
|
262
|
+
default do
|
263
|
+
p = args.descriptor.project
|
264
|
+
b = args.descriptor.branch
|
265
|
+
Volley::Dsl.publisher.versions(p, b).each do |v|
|
266
|
+
Volley::Log.warn "#{p}@#{b}:#{v}"
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
plan :remove do
|
271
|
+
default do
|
272
|
+
pub = Volley::Dsl.publisher
|
273
|
+
(p, b, v) = args.descriptor.get
|
274
|
+
if args.force
|
275
|
+
Volley::Log.debug "removing version: #{p}@#{b}:#{v}"
|
276
|
+
pub.delete_version(p, b, v)
|
277
|
+
else
|
278
|
+
Volley::Log.warn "this process cannot be undone, if you are sure, run the same command with -F"
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
plan :exists do
|
283
|
+
default do
|
284
|
+
(project, branch, version) = args.descriptor.get
|
285
|
+
pub = Volley::Dsl.publisher
|
166
286
|
if project && branch && version != "latest"
|
167
287
|
if pub.exists?(project, branch, version)
|
168
288
|
Volley::Log.warn "#{args.descriptor} exists"
|
@@ -176,4 +296,4 @@ project :volley do
|
|
176
296
|
end
|
177
297
|
end
|
178
298
|
end
|
179
|
-
end
|
299
|
+
end
|
data/lib/volley/dsl/argument.rb
CHANGED
@@ -75,10 +75,17 @@ module Volley
|
|
75
75
|
#end
|
76
76
|
|
77
77
|
def usage
|
78
|
+
return if (@name == :descriptor && !@required) || @name == :force
|
79
|
+
n = @name
|
78
80
|
v = @choices || @convert || "string"
|
79
|
-
|
80
|
-
|
81
|
-
|
81
|
+
d = @default ? " (#@default)" : ""
|
82
|
+
n = "#{n}=#{v}#{d}"
|
83
|
+
if required
|
84
|
+
n = "<#{n}>"
|
85
|
+
else
|
86
|
+
n = "[#{n}]"
|
87
|
+
end
|
88
|
+
n
|
82
89
|
end
|
83
90
|
|
84
91
|
def boolean(value)
|
@@ -93,4 +100,4 @@ module Volley
|
|
93
100
|
end
|
94
101
|
end
|
95
102
|
end
|
96
|
-
end
|
103
|
+
end
|
data/lib/volley/dsl/plan.rb
CHANGED
@@ -141,7 +141,7 @@ module Volley
|
|
141
141
|
end
|
142
142
|
rescue => e
|
143
143
|
Volley::Log.debug "failed to get version? #{v.inspect} : #{e.message}"
|
144
|
-
Volley::Log.debug e
|
144
|
+
#Volley::Log.debug e
|
145
145
|
v
|
146
146
|
end
|
147
147
|
end
|
@@ -261,4 +261,4 @@ module Volley
|
|
261
261
|
end
|
262
262
|
end
|
263
263
|
end
|
264
|
-
end
|
264
|
+
end
|
@@ -76,10 +76,29 @@ module Volley
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def delete_project(project)
|
79
|
-
Volley::Log.
|
79
|
+
Volley::Log.debug "delete_project #{project}"
|
80
|
+
delete_files("#{project}/")
|
81
|
+
end
|
82
|
+
|
83
|
+
def delete_branch(project, branch)
|
84
|
+
Volley::Log.debug "delete_branch #{project} #{branch}"
|
85
|
+
delete_files("#{project}/#{branch}/")
|
86
|
+
end
|
87
|
+
|
88
|
+
def delete_version(project, branch, version)
|
89
|
+
Volley::Log.debug "delete_version #{project} #{branch} #{version}"
|
90
|
+
delete_files("#{project}/#{branch}/#{version}/")
|
91
|
+
end
|
92
|
+
|
93
|
+
protected
|
94
|
+
|
95
|
+
def delete_files(pattern)
|
96
|
+
Volley::Log.debug "delete_files #{pattern}"
|
80
97
|
dir = @connection.directories.get(@bucket)
|
81
|
-
|
82
|
-
|
98
|
+
list = []
|
99
|
+
dir.files.each {|e| list << e if e.key =~ /^#{pattern}/}
|
100
|
+
list.each do |f|
|
101
|
+
Volley::Log.debug "- #{f.key}"
|
83
102
|
f.destroy
|
84
103
|
end
|
85
104
|
true
|
@@ -89,8 +108,6 @@ module Volley
|
|
89
108
|
false
|
90
109
|
end
|
91
110
|
|
92
|
-
protected
|
93
|
-
|
94
111
|
def load_configuration
|
95
112
|
@key = requires(:aws_access_key_id)
|
96
113
|
@secret = requires(:aws_secret_access_key)
|
@@ -156,4 +173,4 @@ module Volley
|
|
156
173
|
end
|
157
174
|
end
|
158
175
|
end
|
159
|
-
end
|
176
|
+
end
|
@@ -48,15 +48,27 @@ module Volley
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def delete_project(project)
|
51
|
-
|
51
|
+
delete_files("#{project}")
|
52
|
+
end
|
53
|
+
|
54
|
+
def delete_branch(project, branch)
|
55
|
+
delete_files("#{project}/#{branch}")
|
56
|
+
end
|
57
|
+
|
58
|
+
def delete_version(project, branch, version)
|
59
|
+
delete_files("#{project}/#{branch}/#{version}")
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def delete_files(path)
|
65
|
+
FileUtils.rm_rf("#@directory/#{path}")
|
52
66
|
true
|
53
67
|
rescue => e
|
54
68
|
Volley::Log.error "error deleting project: #{e.message} at #{e.backtrace.first}"
|
55
69
|
false
|
56
70
|
end
|
57
71
|
|
58
|
-
private
|
59
|
-
|
60
72
|
def load_configuration
|
61
73
|
@directory = requires(:directory)
|
62
74
|
@debug = optional(:debug, false)
|
@@ -90,4 +102,4 @@ module Volley
|
|
90
102
|
end
|
91
103
|
end
|
92
104
|
end
|
93
|
-
end
|
105
|
+
end
|
data/lib/volley/version.rb
CHANGED
data/spec/publisher_spec.rb
CHANGED
@@ -8,15 +8,12 @@ Volley::Log.console_disable
|
|
8
8
|
|
9
9
|
shared_examples_for Volley::Publisher::Base do
|
10
10
|
before(:all) do
|
11
|
-
@
|
12
|
-
@local = "/opt/volley"
|
13
|
-
FileUtils.mkdir_p(@remote)
|
11
|
+
@local = "/opt/volley"
|
14
12
|
FileUtils.mkdir_p(@local)
|
15
|
-
|
13
|
+
%x{rm -rf #@local/*}
|
16
14
|
end
|
17
15
|
|
18
16
|
after(:all) do
|
19
|
-
FileUtils.rm_rf(@remote)
|
20
17
|
FileUtils.rm_rf(@local)
|
21
18
|
end
|
22
19
|
|
@@ -74,13 +71,21 @@ shared_examples_for Volley::Publisher::Base do
|
|
74
71
|
|
75
72
|
it "should be able to force publish a duplicate artifact" do
|
76
73
|
Dir.chdir("#{root}/test/")
|
77
|
-
o
|
74
|
+
o = @pub.force
|
78
75
|
@pub.force = true
|
79
76
|
expect(@pub.push("spec", "trunk", "1", "./trunk-1.tgz")).to eq(true)
|
80
77
|
@pub.force = o
|
81
78
|
Dir.chdir(root)
|
82
79
|
end
|
83
80
|
|
81
|
+
it "should be able to delete a version" do
|
82
|
+
expect(@pub.delete_version("spec", "trunk", "1")).to eq(true)
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should be able to delete a branch" do
|
86
|
+
expect(@pub.delete_branch("spec", "trunk")).to eq(true)
|
87
|
+
end
|
88
|
+
|
84
89
|
it "should be able to delete a project" do
|
85
90
|
expect(@pub.delete_project("spec")).to eq(true)
|
86
91
|
end
|
@@ -89,17 +94,27 @@ end
|
|
89
94
|
describe Volley::Publisher::Local do
|
90
95
|
it_behaves_like Volley::Publisher::Base
|
91
96
|
|
97
|
+
before(:all) do
|
98
|
+
@remote = "#{root}/test/publisher/remote"
|
99
|
+
FileUtils.mkdir_p(@remote)
|
100
|
+
%x{rm -rf #@remote/*}
|
101
|
+
end
|
102
|
+
|
92
103
|
before(:each) do
|
93
104
|
@pub = Volley::Publisher::Local.new(:directory => @remote)
|
94
105
|
end
|
106
|
+
|
107
|
+
after(:all) do
|
108
|
+
FileUtils.rm_rf(@remote)
|
109
|
+
end
|
95
110
|
end
|
96
111
|
|
97
112
|
describe Volley::Publisher::Amazons3 do
|
98
113
|
it_behaves_like Volley::Publisher::Base
|
99
114
|
|
100
115
|
before(:each) do
|
101
|
-
@pub = Volley::Publisher::Amazons3.new(:aws_access_key_id
|
116
|
+
@pub = Volley::Publisher::Amazons3.new(:aws_access_key_id => "AKIAIWUGNGSUZWW5XVCQ",
|
102
117
|
:aws_secret_access_key => "NOggEVauweMiJDWyRIlgikEAtlwnFAzd8ZSL13Lt",
|
103
118
|
:bucket => "inqcloud-volley-test")
|
104
119
|
end
|
105
|
-
end
|
120
|
+
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.23
|
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-05-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: clamp
|
@@ -133,6 +133,7 @@ extra_rdoc_files: []
|
|
133
133
|
files:
|
134
134
|
- .gitignore
|
135
135
|
- .rspec
|
136
|
+
- .ruby-version
|
136
137
|
- CHANGELOG.md
|
137
138
|
- Gemfile
|
138
139
|
- LICENSE
|
@@ -199,7 +200,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
200
|
version: '0'
|
200
201
|
segments:
|
201
202
|
- 0
|
202
|
-
hash:
|
203
|
+
hash: 2007725385198134767
|
203
204
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
205
|
none: false
|
205
206
|
requirements:
|
@@ -208,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
209
|
version: '0'
|
209
210
|
segments:
|
210
211
|
- 0
|
211
|
-
hash:
|
212
|
+
hash: 2007725385198134767
|
212
213
|
requirements: []
|
213
214
|
rubyforge_project:
|
214
215
|
rubygems_version: 1.8.24
|