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 CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.1.18:
4
+ * 'volley:exists' plan to check for artifact in publisher
5
+
3
6
  ## v0.1.17:
4
7
  * fix problem with passing arguments through volley action
5
8
  * unable to get version is not a fatal error in most cases
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} #{e.message} at #{e.backtrace.first}"
115
+ Volley::Log.error "error: '#{e.message}' at #{e.backtrace.first}"
116
116
  Volley::Log.debug e
117
117
  exit 1
118
118
  end
@@ -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
@@ -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
@@ -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
- puts "plan#call error: #{e.message} at #{e.backtrace.first}"
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| e == "latest" || 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| e == "latest" || e == ""}
21
+ end.reject { |e| ["","latest","latest_release"].include?(e) }
22
22
  end
23
23
 
24
24
  def exists?(project, branch, version)
@@ -3,7 +3,7 @@ unless defined?(Volley::Version)
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- TINY = 18
6
+ TINY = 19
7
7
  TAG = nil
8
8
  STRING = [MAJOR, MINOR, TINY, TAG].compact.join('.')
9
9
  end
@@ -31,6 +31,7 @@ describe Volley::Descriptor do
31
31
  spec
32
32
  spec:
33
33
  spec~trunk
34
+ spec.trunk.1
34
35
  }.each do |desc|
35
36
  it "should not handle format: '#{desc}'" do
36
37
  expect { Volley::Descriptor.new(desc) }.to raise_error(StandardError)
@@ -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 = @pub.force
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 = "#{Volley::Version::STRING}"
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", '0.5.0'
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.18
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-01-09 00:00:00.000000000 Z
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: awesome_print
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: -4434554969566022621
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: -4434554969566022621
211
+ hash: 974353220657797386
228
212
  requirements: []
229
213
  rubyforge_project:
230
214
  rubygems_version: 1.8.24