volley 0.1.0.alpha4 → 0.1.0.alpha5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -1
- data/.rspec +1 -0
- data/Gemfile +4 -1
- data/Rakefile +34 -0
- data/bin/volley +88 -40
- data/conf/common.volleyfile +12 -29
- data/features/publisher.feature +45 -0
- data/features/step_definitions/common_steps.rb +9 -0
- data/features/step_definitions/publisher_steps.rb +92 -0
- data/features/support/env.rb +19 -0
- data/init/Volleyfile +1 -104
- data/lib/volley/descriptor.rb +28 -0
- data/lib/volley/dsl/action.rb +31 -0
- data/lib/volley/dsl/argument.rb +96 -0
- data/lib/volley/dsl/file.rb +70 -0
- data/lib/volley/dsl/plan.rb +110 -235
- data/lib/volley/dsl/project.rb +10 -2
- data/lib/volley/dsl/pull_action.rb +50 -0
- data/lib/volley/dsl/push_action.rb +101 -0
- data/lib/volley/dsl/stage.rb +40 -0
- data/lib/volley/dsl.rb +7 -0
- data/lib/volley/log.rb +22 -8
- data/lib/volley/meta.rb +24 -0
- data/lib/volley/publisher/amazons3.rb +67 -66
- data/lib/volley/publisher/base.rb +81 -42
- data/lib/volley/publisher/exceptions.rb +7 -0
- data/lib/volley/publisher/local.rb +41 -27
- data/lib/volley/scm/base.rb +10 -0
- data/lib/volley.rb +38 -12
- data/spec/descriptor_spec.rb +39 -0
- data/spec/dsl_plan_spec.rb +103 -0
- data/spec/dsl_project_spec.rb +36 -0
- data/spec/dsl_volleyfile_spec.rb +21 -0
- data/spec/meta_spec.rb +26 -0
- data/spec/publisher_spec.rb +92 -0
- data/test/dsl/amazons3_publisher.volleyfile +6 -0
- data/test/dsl/local_publisher.volleyfile +4 -0
- data/test/dsl/log_console.volleyfile +2 -0
- data/test/dsl/log_file.volleyfile +2 -0
- data/test/dsl/simple.volleyfile +17 -0
- data/test/meta.yml +3 -0
- data/test/project/Rakefile +13 -0
- data/test/project/Volleyfile +18 -0
- data/test/trunk-1.tgz +0 -0
- data/volley.gemspec +2 -1
- metadata +67 -5
- data/lib/volley/config.rb +0 -8
- data/lib/volley/volley_file.rb +0 -45
@@ -3,8 +3,8 @@ module Volley
|
|
3
3
|
class Local < Base
|
4
4
|
|
5
5
|
def projects
|
6
|
-
|
7
|
-
|
6
|
+
l = Dir["#@directory/*"]
|
7
|
+
l.map {|e| e.gsub(/#@directory\//,"")}
|
8
8
|
end
|
9
9
|
|
10
10
|
def branches(pr)
|
@@ -12,7 +12,29 @@ module Volley
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def versions(pr, br)
|
15
|
-
Dir["#@directory/#{pr}/#{br}/*"].map
|
15
|
+
Dir["#@directory/#{pr}/#{br}/*"].map do |e|
|
16
|
+
e.gsub(/#@directory\/#{pr}\/#{br}\//,"")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def exists?(project, branch, version)
|
21
|
+
d = "#@directory/#{project}/#{branch}/#{version}"
|
22
|
+
File.directory?(d)
|
23
|
+
end
|
24
|
+
|
25
|
+
def contents(project, branch, version)
|
26
|
+
d = "#@directory/#{project}/#{branch}/#{version}"
|
27
|
+
Dir["#{d}/*"].map do |e|
|
28
|
+
e.gsub("#{d}/","")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def delete_project(project)
|
33
|
+
FileUtils.rm_rf("#@directory/#{project}")
|
34
|
+
true
|
35
|
+
rescue => e
|
36
|
+
Volley::Log.error "error deleting project: #{e.message} at #{e.backtrace.first}"
|
37
|
+
false
|
16
38
|
end
|
17
39
|
|
18
40
|
private
|
@@ -23,37 +45,29 @@ module Volley
|
|
23
45
|
@debug = optional(:debug, false)
|
24
46
|
end
|
25
47
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def push_file(local, path, content = nil)
|
31
|
-
Volley::Log.debug "content=#{content.inspect}"
|
32
|
-
local = File.basename(local) if local =~ /^\//
|
33
|
-
dest = "#@directory/#{path}"
|
34
|
-
file = "#{dest}/#{local}"
|
35
|
-
Volley::Log.info".. -> #{dest}"
|
36
|
-
FileUtils.mkdir_p(File.dirname(file))
|
48
|
+
def push_file(dir, file, content = nil)
|
49
|
+
file = File.basename(file) if file =~ /^\//
|
50
|
+
dest = "#@directory/#{dir}/#{file}"
|
51
|
+
FileUtils.mkdir_p(File.dirname(dest))
|
37
52
|
content = content.read if content.is_a?(File)
|
38
53
|
if content
|
39
|
-
File.open(
|
54
|
+
File.open(dest, "w") {|f| f.write(content)}
|
40
55
|
else
|
41
|
-
FileUtils.copy(
|
56
|
+
FileUtils.copy(file, dest)
|
42
57
|
end
|
43
|
-
|
58
|
+
log "=> #{dest}"
|
59
|
+
dest
|
44
60
|
end
|
45
61
|
|
46
|
-
def pull_file(
|
47
|
-
remote = "#@directory/#{
|
48
|
-
|
49
|
-
if
|
50
|
-
FileUtils.mkdir_p(
|
51
|
-
|
52
|
-
|
53
|
-
Volley::Log.info".. <= #@local/#{path}/#{file}"
|
54
|
-
FileUtils.copy("#{remote}/#{file}", "#@local/#{path}")
|
62
|
+
def pull_file(dir, file, localdir=nil)
|
63
|
+
remote = "#@directory/#{dir}"
|
64
|
+
raise ArtifactMissing, "missing: #{remote}" unless File.exists?("#{remote}/#{file}")
|
65
|
+
if localdir
|
66
|
+
FileUtils.mkdir_p(localdir)
|
67
|
+
log "<= #@local/#{dir}/#{file}"
|
68
|
+
FileUtils.copy("#{remote}/#{file}", "#@local/#{dir}")
|
55
69
|
else
|
56
|
-
File.
|
70
|
+
File.read("#{remote}/#{file}")
|
57
71
|
end
|
58
72
|
end
|
59
73
|
end
|
data/lib/volley/scm/base.rb
CHANGED
data/lib/volley.rb
CHANGED
@@ -3,34 +3,59 @@ require "ostruct"
|
|
3
3
|
require "active_support/all"
|
4
4
|
|
5
5
|
require "volley/version"
|
6
|
-
require "volley/config"
|
7
6
|
require "volley/log"
|
8
|
-
require "volley/volley_file"
|
9
7
|
require "volley/publisher/base"
|
8
|
+
require "volley/publisher/exceptions"
|
9
|
+
require "volley/descriptor"
|
10
|
+
require "volley/meta"
|
10
11
|
|
11
12
|
require "volley/dsl"
|
12
13
|
|
13
14
|
module Volley
|
14
15
|
class << self
|
16
|
+
def config
|
17
|
+
@config ||= OpenStruct.new({:directory => "/opt/volley"})
|
18
|
+
end
|
19
|
+
|
20
|
+
def meta
|
21
|
+
@meta ||= Volley::Meta.new
|
22
|
+
end
|
23
|
+
|
24
|
+
def unload
|
25
|
+
Volley::Log.debug "Unload"
|
26
|
+
@config = nil
|
27
|
+
@meta = nil
|
28
|
+
Volley::Dsl::VolleyFile.unload
|
29
|
+
Volley::Dsl::Project.unload
|
30
|
+
end
|
31
|
+
|
15
32
|
def process(opts)
|
16
|
-
project =
|
33
|
+
project = nil
|
17
34
|
plan = opts[:plan]
|
18
|
-
|
19
|
-
|
20
|
-
args = opts[:args]
|
35
|
+
args = opts[:args] || []
|
36
|
+
desc = opts[:descriptor]
|
21
37
|
second = opts[:second]
|
22
38
|
|
39
|
+
(project, plan) = plan.split(/:/) if plan =~ /\:/
|
40
|
+
(project, _, _) = Volley::Descriptor.new(desc).get unless project
|
41
|
+
|
23
42
|
begin
|
24
|
-
Volley::Log.debug "PROCESS
|
43
|
+
Volley::Log.debug "PROCESS plan:#{plan} descriptor:#{desc} args:#{args}"
|
25
44
|
if Volley::Dsl.project?(project)
|
26
45
|
# we have the project locally
|
27
46
|
pr = Volley::Dsl.project(project)
|
28
47
|
if pr.plan?(plan)
|
29
48
|
# plan is defined
|
30
49
|
pl = pr.plan(plan)
|
31
|
-
args << "branch:#{branch}" if branch && args.select{|e| e =~ /^branch\:/}.count == 0
|
32
|
-
args << "version:#{version}" if version && args.select{|e| e =~ /^version\:/}.count == 0
|
33
|
-
|
50
|
+
#args << "branch:#{branch}" if branch && args.select{|e| e =~ /^branch\:/}.count == 0
|
51
|
+
#args << "version:#{version}" if version && args.select{|e| e =~ /^version\:/}.count == 0
|
52
|
+
args << "descriptor=#{desc}"
|
53
|
+
data = pl.call(:args => args)
|
54
|
+
|
55
|
+
if plan == "deploy"
|
56
|
+
Volley.meta[project] = data
|
57
|
+
end
|
58
|
+
Volley.meta.save
|
34
59
|
else
|
35
60
|
# plan is not defined
|
36
61
|
raise "could not find plan #{plan} in project #{project}"
|
@@ -43,7 +68,7 @@ module Volley
|
|
43
68
|
if pub.projects.include?(project)
|
44
69
|
vf = pub.volleyfile(opts)
|
45
70
|
Volley::Log.debug "downloaded volleyfile: #{vf}"
|
46
|
-
Volley::VolleyFile.load(vf)
|
71
|
+
Volley::Dsl::VolleyFile.load(vf)
|
47
72
|
process(:project => project, :plan => plan, :branch => branch, :version => version, :args => args, :second => true)
|
48
73
|
else
|
49
74
|
raise "project #{project} does not exist in configured publisher #{pub.class}"
|
@@ -55,10 +80,11 @@ module Volley
|
|
55
80
|
rescue => e
|
56
81
|
Volley::Log.error "error while processing: #{e.message}"
|
57
82
|
Volley::Log.debug e
|
83
|
+
raise e
|
58
84
|
end
|
59
85
|
|
60
86
|
#if Volley.config.debug
|
61
|
-
# ap Volley::Dsl::Project.
|
87
|
+
# ap Volley::Dsl::Project.project
|
62
88
|
#end
|
63
89
|
end
|
64
90
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'volley/descriptor'
|
2
|
+
|
3
|
+
describe Volley::Descriptor do
|
4
|
+
[
|
5
|
+
%w{spec@trunk:1 spec trunk 1},
|
6
|
+
%w{spec/trunk/1 spec trunk 1},
|
7
|
+
%w{spec-trunk-1 spec trunk 1},
|
8
|
+
%w{spec:trunk:1 spec trunk 1},
|
9
|
+
%w{spec\trunk\1 spec trunk 1},
|
10
|
+
%w{spec@trunk spec trunk latest},
|
11
|
+
%w{spec/trunk spec trunk latest},
|
12
|
+
%w{spec:trunk spec trunk latest},
|
13
|
+
%w{spec\trunk spec trunk latest},
|
14
|
+
].each do |a|
|
15
|
+
(desc, project, branch, version) = a
|
16
|
+
it "should handle format: '#{desc}'" do
|
17
|
+
d = Volley::Descriptor.new(desc)
|
18
|
+
expect(d).not_to be(nil)
|
19
|
+
expect(d.project).to eq(project)
|
20
|
+
expect(d.branch).to eq(branch)
|
21
|
+
expect(d.version).to eq(version)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
%w{
|
26
|
+
spec
|
27
|
+
spec:
|
28
|
+
spec~trunk
|
29
|
+
spec:trunk:1:blarg
|
30
|
+
}.each do |desc|
|
31
|
+
it "should not handle format: '#{desc}'" do
|
32
|
+
expect { Volley::Descriptor.new(desc) }.to raise_error(StandardError)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should allow partials when specified" do
|
37
|
+
expect { Volley::Descriptor.new("environment", :partial => true)}.not_to raise_exception
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'volley'
|
2
|
+
|
3
|
+
root = File.expand_path("../../", __FILE__)
|
4
|
+
|
5
|
+
describe Volley::Dsl::Plan do
|
6
|
+
before(:each) do
|
7
|
+
Volley.unload
|
8
|
+
@project = Volley::Dsl::Project.project(:spec) do
|
9
|
+
scm :git
|
10
|
+
plan :publish do
|
11
|
+
#nothing
|
12
|
+
end
|
13
|
+
plan :notremote do
|
14
|
+
remote false
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
@plan = @project.plan(:publish)
|
19
|
+
@notremote = @project.plan(:notremote)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should be able to define a plan" do
|
23
|
+
expect(@plan).not_to be(nil)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should be able to define an action" do
|
27
|
+
@plan.action :first do
|
28
|
+
#nothing
|
29
|
+
end
|
30
|
+
expect(@plan.stages.count).to eq(3)
|
31
|
+
expect(@plan.stages[:main].actions.count).to eq(1)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should be able to define an action in another stage" do
|
35
|
+
@plan.action :second, :post do
|
36
|
+
expect(@plan.stages.count).to eq(3)
|
37
|
+
expect(@plan.stages[:main].actions.count).to eq(1)
|
38
|
+
expect(@plan.stages[:post].actions.count).to eq(1)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should be able to access source" do
|
43
|
+
expect {@plan.source.branch}.not_to raise_exception
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should be able to access global config" do
|
47
|
+
Volley.config.blarg = true
|
48
|
+
expect do
|
49
|
+
raise "fail" unless @plan.config.blarg == true
|
50
|
+
end.not_to raise_exception
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should be able to load another Volleyfile" do
|
54
|
+
expect {@plan.load("#{root}/test/dsl/simple.volleyfile")}.not_to raise_exception
|
55
|
+
expect(Volley::Dsl.project(:test)).not_to be(nil)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should handle arguments" do
|
59
|
+
@plan.argument(:testarg)
|
60
|
+
expect(@plan.arguments.count).to eq(2) # descriptor and testarg
|
61
|
+
@plan.call(:args => ["descriptor=test@trunk/1","testarg=true"])
|
62
|
+
expect(@plan.args.testarg).to eq("true")
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should handle arguments (with remote false)" do
|
66
|
+
@notremote.argument(:testarg)
|
67
|
+
expect(@notremote.arguments.count).to eq(2) # descriptor and testarg
|
68
|
+
@notremote.call(:args => ["testarg=true"])
|
69
|
+
expect(@notremote.args.testarg).to eq("true")
|
70
|
+
end
|
71
|
+
|
72
|
+
# boolean as strings because we test conversion later
|
73
|
+
it "should handle argument defaults" do
|
74
|
+
@plan.argument(:testarg, :default => "false")
|
75
|
+
expect {@plan.call(:args => ["descriptor=test@trunk/2"])}.not_to raise_exception
|
76
|
+
expect(@plan.args.testarg).to eq("false")
|
77
|
+
end
|
78
|
+
|
79
|
+
# boolean as strings because we test conversion later
|
80
|
+
it "should handle arguments overriding defaults" do
|
81
|
+
@plan.argument(:testarg, :default => "false")
|
82
|
+
expect {@plan.call(:args => ["descriptor=test@trunk/3","testarg=true"])}.not_to raise_exception
|
83
|
+
expect(@plan.args.testarg).to eq("true")
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should fail if required arguments aren't specified" do
|
87
|
+
expect {@plan.call(:args => [])}.to raise_exception
|
88
|
+
end
|
89
|
+
|
90
|
+
[
|
91
|
+
["boolean", "true", true],
|
92
|
+
["descriptor", "test@trunk/5", Volley::Descriptor.new("test@trunk/5")],
|
93
|
+
["to_i", "1", 1],
|
94
|
+
["to_f", "1.12", 1.12],
|
95
|
+
].each do |arg|
|
96
|
+
(type, original, value) = arg
|
97
|
+
it "should handle converting argument: #{type}" do
|
98
|
+
@plan.argument(type, :convert => type.to_sym)
|
99
|
+
@plan.call(:args => ["descriptor=test@trunk/6","#{type}=#{original}"])
|
100
|
+
expect(@plan.args.send(type.to_sym)).to eq(value)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'volley'
|
2
|
+
|
3
|
+
root = File.expand_path("../../", __FILE__)
|
4
|
+
|
5
|
+
describe Volley::Dsl::Project do
|
6
|
+
before(:each) do
|
7
|
+
Volley.unload
|
8
|
+
@project = Volley::Dsl::Project.project(:spec) { }
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be able to define a project" do
|
12
|
+
expect(@project).not_to be(nil)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should be able to define a project with an SCM configuration" do
|
16
|
+
expect(@project.scm :git).not_to be(nil)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should not allow the same project name to used more than once" do
|
20
|
+
expect {Volley::Dsl::Project.project(:spec) { }}.to raise_exception
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be able to define a project with a plan" do
|
24
|
+
@project.plan(:publish) {}
|
25
|
+
plan = @project.plan(:publish)
|
26
|
+
expect(plan).not_to be(nil)
|
27
|
+
expect(plan.project).to eq(@project)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should be able to access global config" do
|
31
|
+
Volley.config.blarg = true
|
32
|
+
expect do
|
33
|
+
raise "fail" unless @project.config.blarg == true
|
34
|
+
end.not_to raise_exception
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'volley'
|
2
|
+
|
3
|
+
root = File.expand_path("../../", __FILE__)
|
4
|
+
|
5
|
+
describe Volley::Dsl::VolleyFile do
|
6
|
+
it "should be able to load a volleyfile" do
|
7
|
+
Volley::Dsl::VolleyFile.load("#{root}/test/dsl/simple.volleyfile")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should have a project called test" do
|
11
|
+
expect(Volley::Dsl.project("test")).not_to eq(nil)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should have a plan called publish" do
|
15
|
+
expect(Volley::Dsl.project("test").plan("publish")).not_to eq(nil)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should have a plan called deploy" do
|
19
|
+
expect(Volley::Dsl.project("test").plan("deploy")).not_to eq(nil)
|
20
|
+
end
|
21
|
+
end
|
data/spec/meta_spec.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'volley'
|
2
|
+
|
3
|
+
root = File.expand_path("../../", __FILE__)
|
4
|
+
|
5
|
+
describe Volley::Meta do
|
6
|
+
before(:each) do
|
7
|
+
@meta = Volley::Meta.new("#{root}/test/meta.yml")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be instantiated" do
|
11
|
+
expect(@meta).not_to be(nil)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should be able to get current version for project" do
|
15
|
+
expect(@meta["spec"]).to eq("trunk:2")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should be able to set new version for project" do
|
19
|
+
@meta["spec"] = "trunk:3"
|
20
|
+
expect(@meta["spec"]).to eq("trunk:3")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be able to set version for new project" do
|
24
|
+
expect {@meta["new"] = "blarg:1"}.not_to raise_exception
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'volley/publisher/local'
|
2
|
+
require 'volley/publisher/amazons3'
|
3
|
+
|
4
|
+
root = File.expand_path("../../", __FILE__)
|
5
|
+
|
6
|
+
Volley::Log.add(:debug, "#{root}/log/volley.log")
|
7
|
+
Volley::Log.console_disable
|
8
|
+
|
9
|
+
shared_examples_for Volley::Publisher::Base do
|
10
|
+
before(:all) do
|
11
|
+
@remote = "#{root}/test/publisher/remote"
|
12
|
+
@local = "#{root}/test/publisher/local"
|
13
|
+
FileUtils.mkdir_p(@remote)
|
14
|
+
FileUtils.mkdir_p(@local)
|
15
|
+
[@local, @remote].each { |d| %x{rm -rf #{d}/*} }
|
16
|
+
end
|
17
|
+
|
18
|
+
after(:all) do
|
19
|
+
FileUtils.rm_rf(@remote)
|
20
|
+
FileUtils.rm_rf(@local)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be able to publish artifacts" do
|
24
|
+
Dir.chdir("#{root}/test/")
|
25
|
+
expect(@pub.push("spec", "trunk", "1", "./trunk-1.tgz")).to eq(true)
|
26
|
+
expect(@pub.push("spec", "trunk", "2", "./trunk-1.tgz")).to eq(true)
|
27
|
+
expect(@pub.push("spec", "staging", "1", "./trunk-1.tgz")).to eq(true)
|
28
|
+
Dir.chdir(root)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should be able to retrieve an artifact" do
|
32
|
+
expect(@pub.pull("spec", "trunk", "1")).to eq("#@local/spec/trunk/1/trunk-1.tgz")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should fail to retrieve a missing artifact" do
|
36
|
+
expect{ @pub.pull("spec", "trunk", "15")}.to raise_error(Volley::Publisher::ArtifactMissing)
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should be able to tell me the list of projects" do
|
40
|
+
expect(@pub.projects).to match_array(%w{spec})
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should be able to tell me the list of branches" do
|
44
|
+
expect(@pub.branches("spec")).to match_array(%w{trunk staging})
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should be able to tell me the list of versions" do
|
48
|
+
expect(@pub.versions("spec", "trunk")).to match_array(%w{1 2 latest})
|
49
|
+
end
|
50
|
+
|
51
|
+
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})
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should be able to get a remote volleyfile" do
|
56
|
+
Dir.chdir("#{root}/test/project")
|
57
|
+
expect(@pub.push("spec","trunk","3","Volleyfile")).to eq(true)
|
58
|
+
Dir.chdir(root)
|
59
|
+
expect(@pub.volleyfile("spec","trunk","3")).to match(/#@local\/Volleyfile-.*-.*/)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should be able to tell me the latest of a project and branch" do
|
63
|
+
expect(@pub.latest("spec", "trunk")).to eq("spec/trunk/3")
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should throw an exeception when trying to publish a duplicate artifact" do
|
67
|
+
expect { @pub.push("spec", "trunk", "1", "./trunk-1.tgz") }.to raise_error(StandardError)
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should be able to delete a project" do
|
71
|
+
expect(@pub.delete_project("spec")).to eq(true)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe Volley::Publisher::Local do
|
76
|
+
it_behaves_like Volley::Publisher::Base
|
77
|
+
|
78
|
+
before(:each) do
|
79
|
+
@pub = Volley::Publisher::Local.new(:directory => @remote, :local => @local)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe Volley::Publisher::Amazons3 do
|
84
|
+
it_behaves_like Volley::Publisher::Base
|
85
|
+
|
86
|
+
before(:each) do
|
87
|
+
@pub = Volley::Publisher::Amazons3.new(:aws_access_key_id => "AKIAIWUGNGSUZWW5XVCQ",
|
88
|
+
:aws_secret_access_key => "NOggEVauweMiJDWyRIlgikEAtlwnFAzd8ZSL13Lt",
|
89
|
+
:bucket => "inqcloud-volley-test",
|
90
|
+
:local => @local)
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
project :test do
|
2
|
+
plan :publish do
|
3
|
+
action :build do
|
4
|
+
FileUtils.rm_f("file")
|
5
|
+
File.open("file", "w") {|f| f.write("#{project}/#{branch}/#{version}")}
|
6
|
+
end
|
7
|
+
push do
|
8
|
+
["file"]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
plan :deploy do
|
13
|
+
pull do |dir|
|
14
|
+
File.read("#{dir}/file")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/test/meta.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
project :test do
|
2
|
+
plan :publish do
|
3
|
+
action :build do
|
4
|
+
FileUtils.rm_f("file")
|
5
|
+
ver = "#{project.name}/#{branch}/#{version}"
|
6
|
+
File.open("file", "w") {|f| f.write(ver)}
|
7
|
+
end
|
8
|
+
push do
|
9
|
+
["file"]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
plan :deploy do
|
14
|
+
pull do |dir|
|
15
|
+
File.read("#{dir}/file")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/test/trunk-1.tgz
ADDED
Binary file
|
data/volley.gemspec
CHANGED
@@ -13,11 +13,12 @@ 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}.alpha5"
|
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
24
|
end
|