vx-builder 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73e96e0bf3f8cc5311180c68c24f8ce2b91b2cb5
4
- data.tar.gz: de07a671e32eaecfca0ffc59bebcf0334ae673ad
3
+ metadata.gz: dfbe290e0979d13dc2247256846a0a7bbb4cffa3
4
+ data.tar.gz: 0ef71474e8232fcc4891dc752d4f28790d1652fb
5
5
  SHA512:
6
- metadata.gz: 4391e8339e7f1250acddf347442cfcbfe64bc6f04523f4edfe8805120cfec41a69ad127e59ec1c49e493bb52e0a5e461da2aec82c6eccd00452af0b63e2e784b
7
- data.tar.gz: a8b3b91466510b7bfc586a3993e1a40478a8338c4c3f45b4e7c6ad77ed1ce99720d606eba264b1a73986f8fe24398a68f77926cb4fdfd66f1560417400d6946f
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: Common::TaggedLogging.new(Logger.new STDOUT),
15
- webdav_cache_url: nil,
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
- WebdavCache = Struct.new(:app) do
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 config.webdav_cache_url
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.webdav_fetch_url = urls
42
- env.webdav_push_url = url_for(env, branch)
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 = env.task.name.dup + "/" + branch
47
+ name = branch
48
48
 
49
49
  key = env.cache_key.join("-").gsub(/[^a-z0-9_\-.]/, '-')
50
- "#{config.webdav_cache_url}/#{name}/#{key}.tgz"
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.webdav_fetch_url.join(" ")
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.webdav_push_url
76
- env.after_script << "#{casher_cmd} push #{env.webdav_push_url}"
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
 
@@ -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 :WebdavCache, File.expand_path("../script/webdav_cache", __FILE__)
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::WebdavCache
18
+ use Builder::Script::Cache
19
19
  use Builder::Script::Services
20
20
  use Builder::Script::Env
21
21
  use Builder::Script::Prepare
@@ -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 = name
9
- @src = src
10
- @sha = sha
11
- @deploy_key = options[:deploy_key]
12
- @branch = options[:branch]
13
- @pull_request_id = options[: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
@@ -1,5 +1,5 @@
1
1
  module Vx
2
2
  module Builder
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -2,6 +2,5 @@ require 'spec_helper'
2
2
 
3
3
  describe Vx::Builder::Configuration do
4
4
  its(:logger) { should be }
5
- its(:webdav_cache_url) { should be_nil }
6
5
  its(:casher_ruby) { should be }
7
6
  end
@@ -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
@@ -6,7 +6,8 @@ def create(name, options = {})
6
6
  'src',
7
7
  'sha',
8
8
  deploy_key: 'deploy_key',
9
- branch: 'master'
9
+ branch: 'master',
10
+ cache_url_prefix: "http://localhost"
10
11
  )
11
12
  when :source
12
13
  Vx::Builder::Source.from_yaml(fixture("travis.yml"))
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.3
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-18 00:00:00.000000000 Z
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