vx-builder 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vx/builder/configuration.rb +2 -3
- data/lib/vx/builder/script/{webdav_cache.rb → cache.rb} +9 -9
- data/lib/vx/builder/script.rb +2 -2
- data/lib/vx/builder/task.rb +9 -7
- data/lib/vx/builder/version.rb +1 -1
- data/spec/lib/builder/configuration_spec.rb +0 -1
- data/spec/lib/builder/task_spec.rb +3 -1
- data/spec/support/create.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfbe290e0979d13dc2247256846a0a7bbb4cffa3
|
4
|
+
data.tar.gz: 0ef71474e8232fcc4891dc752d4f28790d1652fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aab68e031514142fb618bb6dfd7a7125e900c36ea67021d2a550417251fd62241c93e4b119ecca3123ed62c6f7b58bab918b5449371e96b4c6ee8ee45798df0e
|
7
|
+
data.tar.gz: 790cc4d61325fba00d62b8fddafb752b2737fb076bd11c455a21a9e8eb5f35c35b275a5faab9669284910e77c9be262fa17339072916b1ecf84a963fc7a1d1f4
|
@@ -11,9 +11,8 @@ module Vx
|
|
11
11
|
self.env_namespace = 'vx'
|
12
12
|
self.raise_missing_keys = true
|
13
13
|
|
14
|
-
define logger:
|
15
|
-
|
16
|
-
casher_ruby: "/usr/local/rbenv/versions/1.9.3-p484/bin/ruby"
|
14
|
+
define logger: Common::TaggedLogging.new(Logger.new STDOUT),
|
15
|
+
casher_ruby: "/usr/local/rbenv/versions/1.9.3-p484/bin/ruby"
|
17
16
|
|
18
17
|
end
|
19
18
|
end
|
@@ -2,7 +2,7 @@ module Vx
|
|
2
2
|
module Builder
|
3
3
|
class Script
|
4
4
|
|
5
|
-
|
5
|
+
Cache = Struct.new(:app) do
|
6
6
|
|
7
7
|
include Helper::Config
|
8
8
|
include Helper::Logger
|
@@ -13,7 +13,7 @@ module Vx
|
|
13
13
|
def call(env)
|
14
14
|
rs = app.call env
|
15
15
|
|
16
|
-
if
|
16
|
+
if env.task.cache_url_prefix
|
17
17
|
assign_url_to_env(env)
|
18
18
|
prepare(env)
|
19
19
|
fetch(env)
|
@@ -38,16 +38,16 @@ module Vx
|
|
38
38
|
end
|
39
39
|
urls << url_for(env, 'master')
|
40
40
|
|
41
|
-
env.
|
42
|
-
env.
|
41
|
+
env.cache_fetch_url = urls
|
42
|
+
env.cache_push_url = url_for(env, branch)
|
43
43
|
env
|
44
44
|
end
|
45
45
|
|
46
46
|
def url_for(env, branch)
|
47
|
-
name =
|
47
|
+
name = branch
|
48
48
|
|
49
49
|
key = env.cache_key.join("-").gsub(/[^a-z0-9_\-.]/, '-')
|
50
|
-
"#{
|
50
|
+
"#{env.task.cache_url_prefix}/#{name}/#{key}.tgz"
|
51
51
|
end
|
52
52
|
|
53
53
|
def prepare(env)
|
@@ -62,7 +62,7 @@ module Vx
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def fetch(env)
|
65
|
-
urls = env.
|
65
|
+
urls = env.cache_fetch_url.join(" ")
|
66
66
|
env.init << "#{casher_cmd} fetch #{urls} || true"
|
67
67
|
end
|
68
68
|
|
@@ -72,8 +72,8 @@ module Vx
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def push(env)
|
75
|
-
if env.
|
76
|
-
env.after_script << "#{casher_cmd} push #{env.
|
75
|
+
if env.cache_push_url
|
76
|
+
env.after_script << "#{casher_cmd} push #{env.cache_push_url}"
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
data/lib/vx/builder/script.rb
CHANGED
@@ -9,13 +9,13 @@ module Vx
|
|
9
9
|
autoload :Script, File.expand_path("../script/script", __FILE__)
|
10
10
|
autoload :Prepare, File.expand_path("../script/prepare", __FILE__)
|
11
11
|
autoload :Databases, File.expand_path("../script/databases", __FILE__)
|
12
|
-
autoload :
|
12
|
+
autoload :Cache, File.expand_path("../script/cache", __FILE__)
|
13
13
|
autoload :Services, File.expand_path("../script/services", __FILE__)
|
14
14
|
|
15
15
|
include Common::Helper::Middlewares
|
16
16
|
|
17
17
|
middlewares do
|
18
|
-
use Builder::Script::
|
18
|
+
use Builder::Script::Cache
|
19
19
|
use Builder::Script::Services
|
20
20
|
use Builder::Script::Env
|
21
21
|
use Builder::Script::Prepare
|
data/lib/vx/builder/task.rb
CHANGED
@@ -2,15 +2,17 @@ module Vx
|
|
2
2
|
module Builder
|
3
3
|
class Task
|
4
4
|
|
5
|
-
attr_reader :name, :src, :sha, :deploy_key, :branch, :pull_request_id
|
5
|
+
attr_reader :name, :src, :sha, :deploy_key, :branch, :pull_request_id,
|
6
|
+
:cache_url_prefix
|
6
7
|
|
7
8
|
def initialize(name, src, sha, options = {})
|
8
|
-
@name
|
9
|
-
@src
|
10
|
-
@sha
|
11
|
-
@deploy_key
|
12
|
-
@branch
|
13
|
-
@pull_request_id
|
9
|
+
@name = name
|
10
|
+
@src = src
|
11
|
+
@sha = sha
|
12
|
+
@deploy_key = options[:deploy_key]
|
13
|
+
@branch = options[:branch]
|
14
|
+
@pull_request_id = options[:pull_request_id]
|
15
|
+
@cache_url_prefix = options[:cache_url_prefix]
|
14
16
|
|
15
17
|
validate!
|
16
18
|
end
|
data/lib/vx/builder/version.rb
CHANGED
@@ -8,7 +8,8 @@ describe Vx::Builder::Task do
|
|
8
8
|
'source',
|
9
9
|
'sha',
|
10
10
|
deploy_key: 'deploy_key',
|
11
|
-
pull_request_id: '1'
|
11
|
+
pull_request_id: '1',
|
12
|
+
cache_url_prefix: 'cache_url'
|
12
13
|
)
|
13
14
|
}
|
14
15
|
|
@@ -20,6 +21,7 @@ describe Vx::Builder::Task do
|
|
20
21
|
let(:sha) { should eq 'sha' }
|
21
22
|
let(:deploy_key) { should eq 'deploy_key' }
|
22
23
|
let(:pull_request_id) { should eq '1' }
|
24
|
+
let(:cache_url_prefix){ should eq 'cache_url' }
|
23
25
|
end
|
24
26
|
|
25
27
|
end
|
data/spec/support/create.rb
CHANGED
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.0.
|
4
|
+
version: 0.0.4
|
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-01-
|
11
|
+
date: 2014-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vx-common
|
@@ -128,12 +128,12 @@ files:
|
|
128
128
|
- lib/vx/builder/helper/logger.rb
|
129
129
|
- lib/vx/builder/helper/trace_sh_command.rb
|
130
130
|
- lib/vx/builder/script.rb
|
131
|
+
- lib/vx/builder/script/cache.rb
|
131
132
|
- lib/vx/builder/script/env.rb
|
132
133
|
- lib/vx/builder/script/prepare.rb
|
133
134
|
- lib/vx/builder/script/ruby.rb
|
134
135
|
- lib/vx/builder/script/script.rb
|
135
136
|
- lib/vx/builder/script/services.rb
|
136
|
-
- lib/vx/builder/script/webdav_cache.rb
|
137
137
|
- lib/vx/builder/source.rb
|
138
138
|
- lib/vx/builder/source/constants.rb
|
139
139
|
- lib/vx/builder/source/matrix.rb
|