travis-conditions 1.0.12 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/travis/conditions/v1/data.rb +2 -2
- data/lib/travis/conditions/v1/eval.rb +1 -1
- data/lib/travis/conditions/v1/parser.rb +1 -1
- data/lib/travis/conditions/version.rb +1 -1
- data/spec/v1/conditions_spec.rb +14 -0
- data/spec/v1/parser_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 508161e7fcdb5f6b5fa7f6b62d286e8e86b5e9bc
|
4
|
+
data.tar.gz: eef0be00cbef1f64ef60679949a835307697a988
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aaa3cbd52975af87be2348c3778bcfa91c8e8dc71b7713bb3d91ffbcff8e8d372a9f9eb72aedf8b9c8bec6810e8b350f166d429b2bc29f1ac5d3d3370704933f
|
7
|
+
data.tar.gz: 8041e836d7fd63a78c8f4fcdb217b9ce88f8264538c4b72caaca56de341edbfacc5876f18ca220c6b05c75cfb6e0976ab6af74d4432f44af20393f9e05c45b33
|
data/CHANGELOG.md
CHANGED
@@ -9,11 +9,11 @@ module Travis
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def [](key)
|
12
|
-
data[key
|
12
|
+
data[key&.to_sym]
|
13
13
|
end
|
14
14
|
|
15
15
|
def env(key)
|
16
|
-
value = data.fetch(:env, {})[key
|
16
|
+
value = data.fetch(:env, {})[key&.to_sym]
|
17
17
|
value = value.gsub(/^(["'])(.*)\1$/, '\2') if value.respond_to?(:gsub)
|
18
18
|
value
|
19
19
|
end
|
@@ -54,7 +54,7 @@ module Travis
|
|
54
54
|
include Boolean, Helper
|
55
55
|
|
56
56
|
VAR = /type|repo|head_repo|os|dist|group|sudo|language|sender|fork|
|
57
|
-
branch|head_branch|tag|commit_message/
|
57
|
+
branch|head_branch|tag|commit_message/x
|
58
58
|
|
59
59
|
PRED = /present|blank|true|false/i
|
60
60
|
FUNC = /env|concat/i
|
data/spec/v1/conditions_spec.rb
CHANGED
@@ -62,10 +62,24 @@ describe Travis::Conditions::V1, 'real conditions' do
|
|
62
62
|
it { should be true }
|
63
63
|
end
|
64
64
|
|
65
|
+
describe 'env vars as hashes' do
|
66
|
+
let(:cond) { "repo = env(REPO)" }
|
67
|
+
let(:data) { { repo: 'owner/name', env: [REPO: 'owner/name'] } }
|
68
|
+
subject { described_class.eval(cond, data) }
|
69
|
+
it { should be true }
|
70
|
+
end
|
71
|
+
|
65
72
|
describe 'missing env var' do
|
66
73
|
let(:cond) { 'branch =~ env(PATTERN)' }
|
67
74
|
let(:data) { { branch: 'master', env: [] } }
|
68
75
|
subject { described_class.eval(cond, data) }
|
69
76
|
it { should be false }
|
70
77
|
end
|
78
|
+
|
79
|
+
describe 'missing argument' do
|
80
|
+
let(:cond) { 'branch = env()' }
|
81
|
+
let(:data) { { branch: 'master' } }
|
82
|
+
subject { described_class.eval(cond, data) }
|
83
|
+
it { should be false }
|
84
|
+
end
|
71
85
|
end
|
data/spec/v1/parser_spec.rb
CHANGED
@@ -24,6 +24,11 @@ describe Travis::Conditions::V1::Parser do
|
|
24
24
|
[:call, :env, [[:val, 'FOO']]]
|
25
25
|
end
|
26
26
|
|
27
|
+
it 'env()' do
|
28
|
+
should eq \
|
29
|
+
[:call, :env, []]
|
30
|
+
end
|
31
|
+
|
27
32
|
# one operand
|
28
33
|
|
29
34
|
it '1=1' do
|
@@ -476,6 +481,10 @@ describe Travis::Conditions::V1::Parser do
|
|
476
481
|
[:eq, [:var, :type], [:val, 'buz']]]]
|
477
482
|
end
|
478
483
|
|
484
|
+
it '= foo' do
|
485
|
+
expect { subject }.to raise_error(Travis::Conditions::ParseError)
|
486
|
+
end
|
487
|
+
|
479
488
|
it 'branch = $FOO' do
|
480
489
|
expect { subject }.to raise_error(Travis::Conditions::ParseError)
|
481
490
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: travis-conditions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis CI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sh_vars
|