vx-builder 0.2.2 → 0.3.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.
- checksums.yaml +4 -4
- data/lib/vx/builder.rb +15 -2
- data/lib/vx/builder/build_configuration.rb +12 -13
- data/lib/vx/builder/build_configuration/deploy.rb +10 -17
- data/lib/vx/builder/build_configuration/deploy/base.rb +64 -0
- data/lib/vx/builder/build_configuration/deploy/shell.rb +21 -0
- data/lib/vx/builder/build_configuration/env.rb +11 -4
- data/lib/vx/builder/deploy_builder.rb +59 -0
- data/lib/vx/builder/{matrix.rb → matrix_builder.rb} +8 -20
- data/lib/vx/builder/script_builder.rb +127 -0
- data/lib/vx/builder/script_builder/base.rb +59 -0
- data/lib/vx/builder/{script/base.rb → script_builder/base.rb-e} +13 -10
- data/lib/vx/builder/{script/artifacts.rb → script_builder/cache.rb} +13 -30
- data/lib/vx/builder/{script/cache.rb → script_builder/cache.rb-e} +0 -0
- data/lib/vx/builder/script_builder/clojure.rb +34 -0
- data/lib/vx/builder/{script/clojure.rb → script_builder/clojure.rb-e} +0 -0
- data/lib/vx/builder/script_builder/deploy.rb +34 -0
- data/lib/vx/builder/script_builder/deploy.rb-e +34 -0
- data/lib/vx/builder/script_builder/env.rb +39 -0
- data/lib/vx/builder/{script/env.rb → script_builder/env.rb-e} +0 -0
- data/lib/vx/builder/script_builder/java.rb +31 -0
- data/lib/vx/builder/{script/java.rb → script_builder/java.rb-e} +0 -0
- data/lib/vx/builder/script_builder/prepare.rb +72 -0
- data/lib/vx/builder/{script/prepare.rb → script_builder/prepare.rb-e} +0 -0
- data/lib/vx/builder/script_builder/ruby.rb +80 -0
- data/lib/vx/builder/{script/ruby.rb → script_builder/ruby.rb-e} +0 -0
- data/lib/vx/builder/script_builder/scala.rb +50 -0
- data/lib/vx/builder/{script/scala.rb → script_builder/scala.rb-e} +0 -0
- data/lib/vx/builder/script_builder/script.rb +32 -0
- data/lib/vx/builder/script_builder/script.rb-e +32 -0
- data/lib/vx/builder/script_builder/services.rb +26 -0
- data/lib/vx/builder/{script/services.rb → script_builder/services.rb-e} +0 -0
- data/lib/vx/builder/task.rb +1 -7
- data/lib/vx/builder/version.rb +1 -1
- data/spec/fixtures/integration/ruby/deploy/config.yml +6 -2
- data/spec/fixtures/integration/ruby/deploy/d.after_script.sh +1 -1
- data/spec/fixtures/integration/ruby/deploy/d.before_script.sh +3 -1
- data/spec/fixtures/integration/ruby/deploy/d.script.sh +6 -2
- data/spec/fixtures/integration/ruby/matrix/config.yml +4 -1
- data/spec/fixtures/integration/ruby/matrix/d.after_script.sh +1 -1
- data/spec/fixtures/integration/ruby/matrix/d.before_script.sh +1 -1
- data/spec/fixtures/integration/ruby/matrix/d.script.sh +6 -2
- data/spec/fixtures/travis.yml +2 -7
- data/spec/integration/ruby_spec.rb +14 -19
- data/spec/lib/builder/build_configuration/cache_spec.rb +35 -0
- data/spec/lib/builder/build_configuration/deploy/base_spec.rb +33 -0
- data/spec/lib/builder/build_configuration/deploy/shell_spec.rb +61 -0
- data/spec/lib/builder/build_configuration/deploy_spec.rb +50 -0
- data/spec/lib/builder/build_configuration/env_spec.rb +43 -0
- data/spec/lib/builder/build_configuration_spec.rb +4 -124
- data/spec/lib/builder/deploy_builder_spec.rb +82 -0
- data/spec/lib/builder/{matrix_spec.rb → matrix_builder_spec.rb} +9 -67
- data/spec/lib/builder/{script → script_builder}/cache_spec.rb +1 -1
- data/spec/lib/builder/{script → script_builder}/clojure_spec.rb +1 -1
- data/spec/lib/builder/{script → script_builder}/env_spec.rb +1 -1
- data/spec/lib/builder/{script → script_builder}/java_spec.rb +1 -1
- data/spec/lib/builder/{script → script_builder}/prepare_spec.rb +2 -2
- data/spec/lib/builder/{script → script_builder}/ruby_spec.rb +1 -1
- data/spec/lib/builder/{script → script_builder}/scala_spec.rb +1 -1
- data/spec/lib/builder/{script_spec.rb → script_builder_spec.rb} +1 -1
- data/spec/lib/builder/task_spec.rb +0 -2
- data/spec/support/create.rb +24 -11
- metadata +59 -38
- data/lib/vx/builder/build_configuration/artifacts.rb +0 -68
- data/lib/vx/builder/build_configuration/deploy/provider.rb +0 -58
- data/lib/vx/builder/script.rb +0 -145
- data/lib/vx/builder/script/deploy.rb +0 -40
- data/lib/vx/builder/script/script.rb +0 -39
- data/spec/lib/builder/script/artifacts_spec.rb +0 -18
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'tmpdir'
|
3
3
|
require 'fileutils'
|
4
4
|
|
5
|
-
describe Vx::Builder::
|
5
|
+
describe Vx::Builder::ScriptBuilder::Prepare do
|
6
6
|
let(:app) { ->(_) { 0 } }
|
7
7
|
let(:script) { described_class.new app }
|
8
8
|
let(:env) { create :env }
|
@@ -15,7 +15,7 @@ describe Vx::Builder::Script::Prepare do
|
|
15
15
|
|
16
16
|
it { should eq 0 }
|
17
17
|
|
18
|
-
context "run it" do
|
18
|
+
context "run it", git: true do
|
19
19
|
let(:command) { create :command_from_env, env: env }
|
20
20
|
before { run }
|
21
21
|
|
@@ -10,11 +10,9 @@ describe Vx::Builder::Task do
|
|
10
10
|
its(:sha) { should eq 'b665f90239563c030f1b280a434b3d84daeda1bd' }
|
11
11
|
its(:deploy_key) { should be }
|
12
12
|
its(:cache_url_prefix){ should eq 'http://example.com' }
|
13
|
-
its(:artifacts_url_prefix){ should eq 'http://example.com' }
|
14
13
|
its(:job_id) { should eq 1 }
|
15
14
|
its(:build_id) { should eq 12 }
|
16
15
|
its(:pull_request_id) { should eq 1 }
|
17
|
-
its(:deploy?) { should be_true }
|
18
16
|
end
|
19
17
|
|
20
18
|
end
|
data/spec/support/create.rb
CHANGED
@@ -8,17 +8,15 @@ def create(name, options = {})
|
|
8
8
|
when :task
|
9
9
|
msg = create(:message)
|
10
10
|
Vx::Builder::Task.new(
|
11
|
-
job_id:
|
12
|
-
build_id:
|
13
|
-
name:
|
14
|
-
src:
|
15
|
-
sha:
|
16
|
-
deploy_key:
|
17
|
-
branch:
|
18
|
-
cache_url_prefix:
|
19
|
-
|
20
|
-
pull_request_id: options[:pull_request_id],
|
21
|
-
deploy: options[:deploy]
|
11
|
+
job_id: 1,
|
12
|
+
build_id: 12,
|
13
|
+
name: 'name',
|
14
|
+
src: msg.src,
|
15
|
+
sha: msg.sha,
|
16
|
+
deploy_key: msg.deploy_key,
|
17
|
+
branch: msg.branch,
|
18
|
+
cache_url_prefix: "http://example.com",
|
19
|
+
pull_request_id: options[:pull_request_id]
|
22
20
|
)
|
23
21
|
|
24
22
|
when :source
|
@@ -49,5 +47,20 @@ def create(name, options = {})
|
|
49
47
|
a = ["set -e"]
|
50
48
|
a += env.init
|
51
49
|
a.join("\n")
|
50
|
+
|
51
|
+
when :build_configuration_with_matrix_values
|
52
|
+
attributes = {
|
53
|
+
"env" => %w{ FOO=1 BAR=2 },
|
54
|
+
"rvm" => %w{ 1.8.7 1.9.3 2.0.0 },
|
55
|
+
"scala" => %w{ 2.9.2 2.10.1 },
|
56
|
+
"before_script" => "echo before_script",
|
57
|
+
"before_install" => "echo before_install",
|
58
|
+
"script" => "echo script",
|
59
|
+
}.merge(options)
|
60
|
+
Vx::Builder::BuildConfiguration.new attributes
|
61
|
+
|
62
|
+
when :matrix_builder
|
63
|
+
Vx::Builder::MatrixBuilder.new create(:build_configuration_with_matrix_values, options)
|
52
64
|
end
|
65
|
+
|
53
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vx-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Galinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vx-common
|
@@ -124,28 +124,39 @@ files:
|
|
124
124
|
- Rakefile
|
125
125
|
- lib/vx/builder.rb
|
126
126
|
- lib/vx/builder/build_configuration.rb
|
127
|
-
- lib/vx/builder/build_configuration/artifacts.rb
|
128
127
|
- lib/vx/builder/build_configuration/cache.rb
|
129
128
|
- lib/vx/builder/build_configuration/deploy.rb
|
130
|
-
- lib/vx/builder/build_configuration/deploy/
|
129
|
+
- lib/vx/builder/build_configuration/deploy/base.rb
|
130
|
+
- lib/vx/builder/build_configuration/deploy/shell.rb
|
131
131
|
- lib/vx/builder/build_configuration/env.rb
|
132
132
|
- lib/vx/builder/configuration.rb
|
133
|
+
- lib/vx/builder/deploy_builder.rb
|
133
134
|
- lib/vx/builder/helper/config.rb
|
134
135
|
- lib/vx/builder/helper/trace_sh_command.rb
|
135
|
-
- lib/vx/builder/
|
136
|
-
- lib/vx/builder/
|
137
|
-
- lib/vx/builder/
|
138
|
-
- lib/vx/builder/
|
139
|
-
- lib/vx/builder/
|
140
|
-
- lib/vx/builder/
|
141
|
-
- lib/vx/builder/
|
142
|
-
- lib/vx/builder/
|
143
|
-
- lib/vx/builder/
|
144
|
-
- lib/vx/builder/
|
145
|
-
- lib/vx/builder/
|
146
|
-
- lib/vx/builder/
|
147
|
-
- lib/vx/builder/
|
148
|
-
- lib/vx/builder/
|
136
|
+
- lib/vx/builder/matrix_builder.rb
|
137
|
+
- lib/vx/builder/script_builder.rb
|
138
|
+
- lib/vx/builder/script_builder/base.rb
|
139
|
+
- lib/vx/builder/script_builder/base.rb-e
|
140
|
+
- lib/vx/builder/script_builder/cache.rb
|
141
|
+
- lib/vx/builder/script_builder/cache.rb-e
|
142
|
+
- lib/vx/builder/script_builder/clojure.rb
|
143
|
+
- lib/vx/builder/script_builder/clojure.rb-e
|
144
|
+
- lib/vx/builder/script_builder/deploy.rb
|
145
|
+
- lib/vx/builder/script_builder/deploy.rb-e
|
146
|
+
- lib/vx/builder/script_builder/env.rb
|
147
|
+
- lib/vx/builder/script_builder/env.rb-e
|
148
|
+
- lib/vx/builder/script_builder/java.rb
|
149
|
+
- lib/vx/builder/script_builder/java.rb-e
|
150
|
+
- lib/vx/builder/script_builder/prepare.rb
|
151
|
+
- lib/vx/builder/script_builder/prepare.rb-e
|
152
|
+
- lib/vx/builder/script_builder/ruby.rb
|
153
|
+
- lib/vx/builder/script_builder/ruby.rb-e
|
154
|
+
- lib/vx/builder/script_builder/scala.rb
|
155
|
+
- lib/vx/builder/script_builder/scala.rb-e
|
156
|
+
- lib/vx/builder/script_builder/script.rb
|
157
|
+
- lib/vx/builder/script_builder/script.rb-e
|
158
|
+
- lib/vx/builder/script_builder/services.rb
|
159
|
+
- lib/vx/builder/script_builder/services.rb-e
|
149
160
|
- lib/vx/builder/task.rb
|
150
161
|
- lib/vx/builder/version.rb
|
151
162
|
- spec/fixtures/clojure.yml
|
@@ -172,18 +183,23 @@ files:
|
|
172
183
|
- spec/fixtures/travis_bug_1.yml
|
173
184
|
- spec/fixtures/travis_bug_2.yml
|
174
185
|
- spec/integration/ruby_spec.rb
|
186
|
+
- spec/lib/builder/build_configuration/cache_spec.rb
|
187
|
+
- spec/lib/builder/build_configuration/deploy/base_spec.rb
|
188
|
+
- spec/lib/builder/build_configuration/deploy/shell_spec.rb
|
189
|
+
- spec/lib/builder/build_configuration/deploy_spec.rb
|
190
|
+
- spec/lib/builder/build_configuration/env_spec.rb
|
175
191
|
- spec/lib/builder/build_configuration_spec.rb
|
176
192
|
- spec/lib/builder/configuration_spec.rb
|
177
|
-
- spec/lib/builder/
|
178
|
-
- spec/lib/builder/
|
179
|
-
- spec/lib/builder/
|
180
|
-
- spec/lib/builder/
|
181
|
-
- spec/lib/builder/
|
182
|
-
- spec/lib/builder/
|
183
|
-
- spec/lib/builder/
|
184
|
-
- spec/lib/builder/
|
185
|
-
- spec/lib/builder/
|
186
|
-
- spec/lib/builder/
|
193
|
+
- spec/lib/builder/deploy_builder_spec.rb
|
194
|
+
- spec/lib/builder/matrix_builder_spec.rb
|
195
|
+
- spec/lib/builder/script_builder/cache_spec.rb
|
196
|
+
- spec/lib/builder/script_builder/clojure_spec.rb
|
197
|
+
- spec/lib/builder/script_builder/env_spec.rb
|
198
|
+
- spec/lib/builder/script_builder/java_spec.rb
|
199
|
+
- spec/lib/builder/script_builder/prepare_spec.rb
|
200
|
+
- spec/lib/builder/script_builder/ruby_spec.rb
|
201
|
+
- spec/lib/builder/script_builder/scala_spec.rb
|
202
|
+
- spec/lib/builder/script_builder_spec.rb
|
187
203
|
- spec/lib/builder/task_spec.rb
|
188
204
|
- spec/lib/builder_spec.rb
|
189
205
|
- spec/spec_helper.rb
|
@@ -239,18 +255,23 @@ test_files:
|
|
239
255
|
- spec/fixtures/travis_bug_1.yml
|
240
256
|
- spec/fixtures/travis_bug_2.yml
|
241
257
|
- spec/integration/ruby_spec.rb
|
258
|
+
- spec/lib/builder/build_configuration/cache_spec.rb
|
259
|
+
- spec/lib/builder/build_configuration/deploy/base_spec.rb
|
260
|
+
- spec/lib/builder/build_configuration/deploy/shell_spec.rb
|
261
|
+
- spec/lib/builder/build_configuration/deploy_spec.rb
|
262
|
+
- spec/lib/builder/build_configuration/env_spec.rb
|
242
263
|
- spec/lib/builder/build_configuration_spec.rb
|
243
264
|
- spec/lib/builder/configuration_spec.rb
|
244
|
-
- spec/lib/builder/
|
245
|
-
- spec/lib/builder/
|
246
|
-
- spec/lib/builder/
|
247
|
-
- spec/lib/builder/
|
248
|
-
- spec/lib/builder/
|
249
|
-
- spec/lib/builder/
|
250
|
-
- spec/lib/builder/
|
251
|
-
- spec/lib/builder/
|
252
|
-
- spec/lib/builder/
|
253
|
-
- spec/lib/builder/
|
265
|
+
- spec/lib/builder/deploy_builder_spec.rb
|
266
|
+
- spec/lib/builder/matrix_builder_spec.rb
|
267
|
+
- spec/lib/builder/script_builder/cache_spec.rb
|
268
|
+
- spec/lib/builder/script_builder/clojure_spec.rb
|
269
|
+
- spec/lib/builder/script_builder/env_spec.rb
|
270
|
+
- spec/lib/builder/script_builder/java_spec.rb
|
271
|
+
- spec/lib/builder/script_builder/prepare_spec.rb
|
272
|
+
- spec/lib/builder/script_builder/ruby_spec.rb
|
273
|
+
- spec/lib/builder/script_builder/scala_spec.rb
|
274
|
+
- spec/lib/builder/script_builder_spec.rb
|
254
275
|
- spec/lib/builder/task_spec.rb
|
255
276
|
- spec/lib/builder_spec.rb
|
256
277
|
- spec/spec_helper.rb
|
@@ -1,68 +0,0 @@
|
|
1
|
-
module Vx
|
2
|
-
module Builder
|
3
|
-
class BuildConfiguration
|
4
|
-
class Artifacts
|
5
|
-
|
6
|
-
attr_reader :attributes
|
7
|
-
|
8
|
-
def initialize(new_env)
|
9
|
-
normalize_attributes(new_env)
|
10
|
-
end
|
11
|
-
|
12
|
-
def attributes
|
13
|
-
@attributes
|
14
|
-
end
|
15
|
-
|
16
|
-
def files
|
17
|
-
@files
|
18
|
-
end
|
19
|
-
|
20
|
-
def prefix
|
21
|
-
@options[:prefix]
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def normalize_attributes(new_env)
|
27
|
-
attrs =
|
28
|
-
case new_env
|
29
|
-
when Array
|
30
|
-
new_env
|
31
|
-
else
|
32
|
-
Array(new_env)
|
33
|
-
end
|
34
|
-
|
35
|
-
extract_options_and_normalize_items(attrs)
|
36
|
-
end
|
37
|
-
|
38
|
-
def extract_options_and_normalize_items(new_env)
|
39
|
-
opts = {}
|
40
|
-
@attributes = []
|
41
|
-
@files = []
|
42
|
-
env = new_env.inject([]) do |a, e|
|
43
|
-
if e.is_a?(Hash)
|
44
|
-
opts = e
|
45
|
-
@attributes.push e
|
46
|
-
else
|
47
|
-
a.push e.to_s.gsub(/^\.*(\/)/, '')
|
48
|
-
@attributes.push a.last
|
49
|
-
@files.push a.last
|
50
|
-
end
|
51
|
-
a
|
52
|
-
end
|
53
|
-
|
54
|
-
if opts && opts["prefix"]
|
55
|
-
@options = { prefix: opts["prefix"] }
|
56
|
-
else
|
57
|
-
@options = {}
|
58
|
-
end
|
59
|
-
|
60
|
-
[opts, env]
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
@@ -1,58 +0,0 @@
|
|
1
|
-
module Vx
|
2
|
-
module Builder
|
3
|
-
class BuildConfiguration
|
4
|
-
class Deploy
|
5
|
-
|
6
|
-
class Provider
|
7
|
-
|
8
|
-
attr_reader :name, :options, :on
|
9
|
-
|
10
|
-
def initialize(new_attributes)
|
11
|
-
normalize new_attributes.dup
|
12
|
-
end
|
13
|
-
|
14
|
-
def branch?(branch)
|
15
|
-
return true if on.empty?
|
16
|
-
on.include?(branch)
|
17
|
-
end
|
18
|
-
|
19
|
-
def to_hash
|
20
|
-
options.merge(
|
21
|
-
"provider" => @name,
|
22
|
-
"branch" => on
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
|
-
def shell?
|
27
|
-
@name == 'shell'
|
28
|
-
end
|
29
|
-
|
30
|
-
def command
|
31
|
-
Array(options["command"])
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def normalize(new_attributes)
|
37
|
-
@name = new_attributes.delete("provider")
|
38
|
-
@on = new_attributes.delete("branch")
|
39
|
-
@options = new_attributes
|
40
|
-
|
41
|
-
@on =
|
42
|
-
case @on
|
43
|
-
when String
|
44
|
-
[@on]
|
45
|
-
when Array
|
46
|
-
@on.map(&:to_s)
|
47
|
-
else
|
48
|
-
[]
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
data/lib/vx/builder/script.rb
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
require 'vx/common'
|
2
|
-
|
3
|
-
module Vx
|
4
|
-
module Builder
|
5
|
-
class Script
|
6
|
-
|
7
|
-
autoload :Base, File.expand_path("../script/base", __FILE__)
|
8
|
-
autoload :Env, File.expand_path("../script/env", __FILE__)
|
9
|
-
autoload :Ruby, File.expand_path("../script/ruby", __FILE__)
|
10
|
-
autoload :Java, File.expand_path("../script/java", __FILE__)
|
11
|
-
autoload :Scala, File.expand_path("../script/scala", __FILE__)
|
12
|
-
autoload :Clojure, File.expand_path("../script/clojure", __FILE__)
|
13
|
-
autoload :Script, File.expand_path("../script/script", __FILE__)
|
14
|
-
autoload :Prepare, File.expand_path("../script/prepare", __FILE__)
|
15
|
-
autoload :Databases, File.expand_path("../script/databases", __FILE__)
|
16
|
-
autoload :Cache, File.expand_path("../script/cache", __FILE__)
|
17
|
-
autoload :Services, File.expand_path("../script/services", __FILE__)
|
18
|
-
autoload :Artifacts, File.expand_path("../script/artifacts", __FILE__)
|
19
|
-
autoload :Deploy, File.expand_path("../script/deploy", __FILE__)
|
20
|
-
|
21
|
-
include Common::Helper::Middlewares
|
22
|
-
|
23
|
-
middlewares do
|
24
|
-
use Builder::Script::Cache
|
25
|
-
use Builder::Script::Artifacts
|
26
|
-
use Builder::Script::Env
|
27
|
-
use Builder::Script::Services
|
28
|
-
use Builder::Script::Prepare
|
29
|
-
use Builder::Script::Java
|
30
|
-
use Builder::Script::Scala
|
31
|
-
use Builder::Script::Clojure
|
32
|
-
use Builder::Script::Ruby
|
33
|
-
use Builder::Script::Deploy
|
34
|
-
use Builder::Script::Script
|
35
|
-
end
|
36
|
-
|
37
|
-
attr_reader :source, :task
|
38
|
-
|
39
|
-
def initialize(task, source)
|
40
|
-
@source = source
|
41
|
-
@task = task
|
42
|
-
end
|
43
|
-
|
44
|
-
def image
|
45
|
-
source.image.first
|
46
|
-
end
|
47
|
-
|
48
|
-
def to_before_script
|
49
|
-
a = []
|
50
|
-
a << "\n# init"
|
51
|
-
a += env.init
|
52
|
-
|
53
|
-
a << "\n# before install"
|
54
|
-
a += env.before_install
|
55
|
-
|
56
|
-
a << "\n# announce"
|
57
|
-
a += env.announce
|
58
|
-
|
59
|
-
a << "\n# install"
|
60
|
-
a += env.install
|
61
|
-
|
62
|
-
if deploy?
|
63
|
-
a << "\n# before deploy"
|
64
|
-
else
|
65
|
-
a << "\n# before script"
|
66
|
-
end
|
67
|
-
a += env.before_script
|
68
|
-
|
69
|
-
a.join("\n")
|
70
|
-
end
|
71
|
-
|
72
|
-
def to_after_script
|
73
|
-
a = []
|
74
|
-
a << "\n# after script init"
|
75
|
-
a += env.after_script_init
|
76
|
-
|
77
|
-
if deploy?
|
78
|
-
a << "\n# after deploy"
|
79
|
-
else
|
80
|
-
a << "\n# after script"
|
81
|
-
end
|
82
|
-
a += env.after_script
|
83
|
-
a.join("\n")
|
84
|
-
end
|
85
|
-
|
86
|
-
def to_script
|
87
|
-
a = []
|
88
|
-
if deploy?
|
89
|
-
a << "\n# deploy"
|
90
|
-
a += env.deploy
|
91
|
-
else
|
92
|
-
a << "\n# script"
|
93
|
-
a += env.script
|
94
|
-
|
95
|
-
a << "\n# after success"
|
96
|
-
a += env.after_success
|
97
|
-
end
|
98
|
-
|
99
|
-
a.join("\n")
|
100
|
-
end
|
101
|
-
|
102
|
-
def deploy?
|
103
|
-
task.deploy?
|
104
|
-
end
|
105
|
-
|
106
|
-
private
|
107
|
-
|
108
|
-
def env
|
109
|
-
@env ||= run_middlewares(default_env) {|_| _ }
|
110
|
-
end
|
111
|
-
|
112
|
-
def default_env
|
113
|
-
OpenStruct.new(
|
114
|
-
# initialization, repo does not exists
|
115
|
-
init: [],
|
116
|
-
|
117
|
-
# before instalation, using for system setup
|
118
|
-
before_install: [],
|
119
|
-
|
120
|
-
# instalation, using for application setup
|
121
|
-
install: [],
|
122
|
-
|
123
|
-
# announce software and services version
|
124
|
-
announce: [],
|
125
|
-
|
126
|
-
before_script: [],
|
127
|
-
script: [],
|
128
|
-
after_success: [],
|
129
|
-
|
130
|
-
after_script_init: [],
|
131
|
-
after_script: [],
|
132
|
-
|
133
|
-
before_deploy: [],
|
134
|
-
deploy: [],
|
135
|
-
|
136
|
-
source: source,
|
137
|
-
task: task,
|
138
|
-
cache_key: [],
|
139
|
-
cached_directories: []
|
140
|
-
)
|
141
|
-
end
|
142
|
-
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|