travis-conditions 1.0.10 → 1.0.11
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/CHANGELOG.md +6 -0
- data/Gemfile.lock +12 -12
- data/lib/travis/conditions/v1/eval.rb +4 -2
- data/lib/travis/conditions/version.rb +1 -1
- data/spec/v1/conditions_spec.rb +14 -0
- data/spec/v1/data_spec.rb +6 -0
- data/spec/v1/eval_spec.rb +20 -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: 1f5550042752d66fdf3b72b0d9c0990e3f09c954
|
|
4
|
+
data.tar.gz: a408b3f617cf6754abb579856f26ba2de9487da5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e0ce5f91ec4bc825d987df57411f07313dca588042fc3bace4f8bd0ca6f8954851c74ed76356c720a27676bc4cc08382b5ac710e1ecaacbee8c71e93c12e86d0
|
|
7
|
+
data.tar.gz: dab76f7f8f8188b684c7e245370c5862b1585e6df00deef89b3131360af839f38e48ff757ee080884d0026c83a59643f2391d3cb6fa976015eb20becd2f26692
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
travis-conditions (1.0.
|
|
4
|
+
travis-conditions (1.0.10)
|
|
5
5
|
parslet (~> 1.8.2)
|
|
6
6
|
sh_vars (~> 1.0.2)
|
|
7
7
|
|
|
@@ -10,19 +10,19 @@ GEM
|
|
|
10
10
|
specs:
|
|
11
11
|
diff-lcs (1.3)
|
|
12
12
|
parslet (1.8.2)
|
|
13
|
-
rspec (3.
|
|
14
|
-
rspec-core (~> 3.
|
|
15
|
-
rspec-expectations (~> 3.
|
|
16
|
-
rspec-mocks (~> 3.
|
|
17
|
-
rspec-core (3.
|
|
18
|
-
rspec-support (~> 3.
|
|
19
|
-
rspec-expectations (3.
|
|
13
|
+
rspec (3.9.0)
|
|
14
|
+
rspec-core (~> 3.9.0)
|
|
15
|
+
rspec-expectations (~> 3.9.0)
|
|
16
|
+
rspec-mocks (~> 3.9.0)
|
|
17
|
+
rspec-core (3.9.1)
|
|
18
|
+
rspec-support (~> 3.9.1)
|
|
19
|
+
rspec-expectations (3.9.0)
|
|
20
20
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
21
|
-
rspec-support (~> 3.
|
|
22
|
-
rspec-mocks (3.
|
|
21
|
+
rspec-support (~> 3.9.0)
|
|
22
|
+
rspec-mocks (3.9.1)
|
|
23
23
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
24
|
-
rspec-support (~> 3.
|
|
25
|
-
rspec-support (3.
|
|
24
|
+
rspec-support (~> 3.9.0)
|
|
25
|
+
rspec-support (3.9.2)
|
|
26
26
|
sh_vars (1.0.2)
|
|
27
27
|
|
|
28
28
|
PLATFORMS
|
|
@@ -34,7 +34,8 @@ module Travis
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def match(lft, rgt)
|
|
37
|
-
evl(lft)
|
|
37
|
+
lft, rgt = evl(lft), evl(rgt)
|
|
38
|
+
lft && rgt && lft =~ rgt
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
def not_match(lft, rgt)
|
|
@@ -63,7 +64,8 @@ module Travis
|
|
|
63
64
|
end
|
|
64
65
|
|
|
65
66
|
def reg(expr)
|
|
66
|
-
|
|
67
|
+
str = evl(expr)
|
|
68
|
+
Regexp.new(str) if str
|
|
67
69
|
end
|
|
68
70
|
|
|
69
71
|
def var(name)
|
data/spec/v1/conditions_spec.rb
CHANGED
|
@@ -54,4 +54,18 @@ describe Travis::Conditions::V1, 'real conditions' do
|
|
|
54
54
|
subject { described_class.eval(cond, data) }
|
|
55
55
|
it { should be true }
|
|
56
56
|
end
|
|
57
|
+
|
|
58
|
+
describe 'env vars as hashes' do
|
|
59
|
+
let(:cond) { 'repo = env(SLUG)' }
|
|
60
|
+
let(:data) { { repo: 'owner/name', env: [SLUG: 'owner/name'] } }
|
|
61
|
+
subject { described_class.eval(cond, data) }
|
|
62
|
+
it { should be true }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
describe 'missing env var' do
|
|
66
|
+
let(:cond) { 'branch =~ env(PATTERN)' }
|
|
67
|
+
let(:data) { { branch: 'master', env: [] } }
|
|
68
|
+
subject { described_class.eval(cond, data) }
|
|
69
|
+
it { should be false }
|
|
70
|
+
end
|
|
57
71
|
end
|
data/spec/v1/data_spec.rb
CHANGED
|
@@ -69,6 +69,12 @@ describe Travis::Conditions::V1::Data do
|
|
|
69
69
|
it { expect(subject.env(:FOO)).to eq 'foo' }
|
|
70
70
|
it { expect(subject.env('FOO')).to eq 'foo' }
|
|
71
71
|
end
|
|
72
|
+
|
|
73
|
+
describe 'with several vars' do
|
|
74
|
+
let(:env) { [{ FOO: 'foo' }, { BAR: 'bar' }] }
|
|
75
|
+
it { expect(subject.env(:BAR)).to eq 'bar' }
|
|
76
|
+
it { expect(subject.env('BAR')).to eq 'bar' }
|
|
77
|
+
end
|
|
72
78
|
end
|
|
73
79
|
|
|
74
80
|
describe 'given a double quoted string' do
|
data/spec/v1/eval_spec.rb
CHANGED
|
@@ -173,6 +173,26 @@ describe Travis::Conditions::V1, 'eval' do
|
|
|
173
173
|
let(:str) { 'env(foo) =~ concat("^", env(foo), "$")' }
|
|
174
174
|
it { should be true }
|
|
175
175
|
end
|
|
176
|
+
|
|
177
|
+
context do
|
|
178
|
+
let(:str) { 'env(missing) =~ str' }
|
|
179
|
+
it { should be false }
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
context do
|
|
183
|
+
let(:str) { 'str =~ env(missing)' }
|
|
184
|
+
it { should be false }
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
context do
|
|
188
|
+
let(:str) { 'env(missing) =~ ^.*$' }
|
|
189
|
+
it { should be false }
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
context do
|
|
193
|
+
let(:str) { '^.*$ =~ env(missing)' }
|
|
194
|
+
it { should be false }
|
|
195
|
+
end
|
|
176
196
|
end
|
|
177
197
|
|
|
178
198
|
describe 'in' do
|
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.11
|
|
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-
|
|
11
|
+
date: 2020-03-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: sh_vars
|