travis-yaml 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -8
- data/Gemfile +3 -6
- data/Gemfile.lock +20 -50
- data/README.md +97 -2
- data/SPEC.md +116 -33
- data/lib/travis/yaml.rb +6 -3
- data/lib/travis/yaml/matrix.rb +12 -17
- data/lib/travis/yaml/nodes.rb +4 -0
- data/lib/travis/yaml/nodes/addons.rb +44 -0
- data/lib/travis/yaml/nodes/android.rb +7 -0
- data/lib/travis/yaml/nodes/cache.rb +5 -3
- data/lib/travis/yaml/nodes/deploy_conditions.rb +2 -1
- data/lib/travis/yaml/nodes/deploy_entry.rb +46 -0
- data/lib/travis/yaml/nodes/dist.rb +6 -0
- data/lib/travis/yaml/nodes/env.rb +1 -1
- data/lib/travis/yaml/nodes/group.rb +6 -0
- data/lib/travis/yaml/nodes/language.rb +3 -2
- data/lib/travis/yaml/nodes/language_specific.rb +2 -2
- data/lib/travis/yaml/nodes/mapping.rb +39 -10
- data/lib/travis/yaml/nodes/node.rb +58 -1
- data/lib/travis/yaml/nodes/notifications.rb +10 -6
- data/lib/travis/yaml/nodes/open_mapping.rb +1 -1
- data/lib/travis/yaml/nodes/os.rb +1 -1
- data/lib/travis/yaml/nodes/os_entry.rb +7 -5
- data/lib/travis/yaml/nodes/root.rb +28 -4
- data/lib/travis/yaml/nodes/scalar.rb +16 -1
- data/lib/travis/yaml/nodes/sequence.rb +38 -0
- data/lib/travis/yaml/nodes/version.rb +13 -0
- data/lib/travis/yaml/nodes/version_list.rb +4 -0
- data/lib/travis/yaml/parser/psych.rb +11 -5
- data/lib/travis/yaml/secure_string.rb +35 -2
- data/lib/travis/yaml/serializer.rb +17 -0
- data/lib/travis/yaml/serializer/generic.rb +114 -0
- data/lib/travis/yaml/serializer/json.rb +72 -0
- data/lib/travis/yaml/serializer/legacy.rb +32 -0
- data/lib/travis/yaml/serializer/ruby.rb +13 -0
- data/lib/travis/yaml/serializer/yaml.rb +41 -0
- data/lib/travis/yaml/version.rb +1 -1
- data/play/spec.rb +24 -17
- data/spec/matrix_spec.rb +57 -0
- data/spec/nodes/addons_spec.rb +63 -0
- data/spec/nodes/cache_spec.rb +4 -4
- data/spec/nodes/deploy_spec.rb +12 -0
- data/spec/nodes/dist_spec.rb +11 -0
- data/spec/nodes/env_spec.rb +48 -0
- data/spec/nodes/git_spec.rb +1 -1
- data/spec/nodes/group_spec.rb +11 -0
- data/spec/nodes/node_js_spec.rb +14 -0
- data/spec/nodes/notifications_spec.rb +7 -0
- data/spec/nodes/os_spec.rb +13 -0
- data/spec/nodes/root_spec.rb +36 -0
- data/spec/nodes/secure_spec.rb +145 -0
- data/spec/parser/psych_spec.rb +6 -0
- data/spec/parser/ruby_spec.rb +1 -1
- data/spec/serializer/json_spec.rb +30 -0
- data/spec/serializer/legacy_spec.rb +47 -0
- data/spec/serializer/ruby_spec.rb +21 -0
- data/spec/serializer/yaml_spec.rb +47 -0
- data/spec/support/coverage.rb +9 -9
- data/spec/yaml_spec.rb +23 -0
- data/travis-yaml.gemspec +2 -3
- metadata +42 -22
- data/config.ru +0 -2
- data/play/weblint.rb +0 -296
data/spec/nodes/os_spec.rb
CHANGED
@@ -25,4 +25,17 @@ describe Travis::Yaml::Nodes::OS do
|
|
25
25
|
expect(config.os.warnings).to include('dropping "linux", does not support "objective-c"')
|
26
26
|
expect(config.os.warnings).to include('no suitable operating system given for "objective-c", using "osx"')
|
27
27
|
end
|
28
|
+
|
29
|
+
specify 'complains about jdk on osx' do
|
30
|
+
config = Travis::Yaml.parse(os: :osx, language: :java, jdk: :default)
|
31
|
+
expect(config.os) .to be == ['osx']
|
32
|
+
expect(config.language) .to be == 'java'
|
33
|
+
expect(config.jdk) .to be_nil
|
34
|
+
expect(config.warnings).to include('dropping "jdk" section: currently not supported on "osx"')
|
35
|
+
end
|
36
|
+
|
37
|
+
specify 'does not complain about the default os' do
|
38
|
+
config = Travis::Yaml.parse(language: 'objective-c')
|
39
|
+
expect(config.warnings).to be_empty
|
40
|
+
end
|
28
41
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
describe Travis::Yaml::Nodes::Root do
|
2
|
+
let :warnings do
|
3
|
+
subject.warnings
|
4
|
+
end
|
5
|
+
|
6
|
+
describe "from YAML" do
|
7
|
+
context "sudo" do
|
8
|
+
subject :yaml do
|
9
|
+
Travis::Yaml.parse <<-YAML.gsub(/^ {10}/, '')
|
10
|
+
language: ruby
|
11
|
+
sudo: false
|
12
|
+
YAML
|
13
|
+
end
|
14
|
+
|
15
|
+
specify "gives no warnings" do
|
16
|
+
expect(warnings).to be_empty
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "double entry" do
|
21
|
+
subject :yaml do
|
22
|
+
Travis::Yaml.parse <<-YAML.gsub(/^ {10}/, '')
|
23
|
+
addons:
|
24
|
+
postgresql: "9.3"
|
25
|
+
addons:
|
26
|
+
code_climate:
|
27
|
+
api_token: "foobar"
|
28
|
+
YAML
|
29
|
+
end
|
30
|
+
|
31
|
+
specify "warns about double entries" do
|
32
|
+
expect(warnings).to include('has multiple "addons" entries, keeping last entry')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
describe Travis::Yaml::SecureString do
|
2
|
+
context 'encrypted value with secure mapping' do
|
3
|
+
subject(:config) { Travis::Yaml.load 'env: { secure: "foo" }' }
|
4
|
+
it { should be_encrypted }
|
5
|
+
it { should_not be_decrypted }
|
6
|
+
|
7
|
+
context 'its value' do
|
8
|
+
subject(:value) { config.env.matrix.first.value }
|
9
|
+
it { should be_a(Travis::Yaml::SecureString) }
|
10
|
+
it { should be_encrypted }
|
11
|
+
it { should_not be_decrypted }
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'after decryption' do
|
15
|
+
before { config.decrypt { |v| v.upcase } }
|
16
|
+
it { should be_encrypted }
|
17
|
+
it { should be_decrypted }
|
18
|
+
|
19
|
+
context 'its value' do
|
20
|
+
subject(:value) { config.env.matrix.first.value }
|
21
|
+
it { should be_encrypted }
|
22
|
+
it { should be_decrypted }
|
23
|
+
|
24
|
+
specify 'correct encrypted and decrypted value' do
|
25
|
+
expect(value.encrypted_string).to be == 'foo'
|
26
|
+
expect(value.decrypted_string).to be == 'FOO'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'encrypted value with secure tag' do
|
33
|
+
subject(:config) { Travis::Yaml.load 'env: !secure "foo"' }
|
34
|
+
it { should be_encrypted }
|
35
|
+
it { should_not be_decrypted }
|
36
|
+
|
37
|
+
context 'its value' do
|
38
|
+
subject(:value) { config.env.matrix.first.value }
|
39
|
+
it { should be_a(Travis::Yaml::SecureString) }
|
40
|
+
it { should be_encrypted }
|
41
|
+
it { should_not be_decrypted }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'encrypted value with encrypted tag' do
|
46
|
+
subject(:config) { Travis::Yaml.load 'env: !encrypted "foo"' }
|
47
|
+
it { should be_encrypted }
|
48
|
+
it { should_not be_decrypted }
|
49
|
+
|
50
|
+
context 'its value' do
|
51
|
+
subject(:value) { config.env.matrix.first.value }
|
52
|
+
it { should be_a(Travis::Yaml::SecureString) }
|
53
|
+
it { should be_encrypted }
|
54
|
+
it { should_not be_decrypted }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'encrypted value with decrypted tag' do
|
59
|
+
subject(:config) { Travis::Yaml.load 'env: !decrypted "foo"' }
|
60
|
+
it { should_not be_encrypted }
|
61
|
+
it { should be_decrypted }
|
62
|
+
|
63
|
+
context 'its value' do
|
64
|
+
subject(:value) { config.env.matrix.first.value }
|
65
|
+
it { should be_a(Travis::Yaml::SecureString) }
|
66
|
+
it { should_not be_encrypted }
|
67
|
+
it { should be_decrypted }
|
68
|
+
end
|
69
|
+
|
70
|
+
context 'after encryption' do
|
71
|
+
before { config.encrypt { |v| v.upcase } }
|
72
|
+
it { should be_encrypted }
|
73
|
+
it { should be_decrypted }
|
74
|
+
|
75
|
+
context 'its value' do
|
76
|
+
subject(:value) { config.env.matrix.first.value }
|
77
|
+
it { should be_encrypted }
|
78
|
+
it { should be_decrypted }
|
79
|
+
|
80
|
+
specify 'correct encrypted and decrypted value' do
|
81
|
+
expect(value.encrypted_string).to be == 'FOO'
|
82
|
+
expect(value.decrypted_string).to be == 'foo'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context 'encrypted value in secure mapping with decrypted tag' do
|
89
|
+
subject(:config) { Travis::Yaml.load 'env: { secure: !decrypted "foo" }' }
|
90
|
+
it { should_not be_encrypted }
|
91
|
+
it { should be_decrypted }
|
92
|
+
|
93
|
+
context 'its value' do
|
94
|
+
subject(:value) { config.env.matrix.first.value }
|
95
|
+
it { should be_a(Travis::Yaml::SecureString) }
|
96
|
+
it { should_not be_encrypted }
|
97
|
+
it { should be_decrypted }
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
specify 'in an unexpected place' do
|
102
|
+
config = Travis::Yaml.load('language: { secure: ruby }')
|
103
|
+
expect(config.warnings).to include('dropping "language" section: "secure" not supported, dropping "ruby"')
|
104
|
+
end
|
105
|
+
|
106
|
+
specify 'secure cannot be a key in an open mapping' do
|
107
|
+
config = Travis::Yaml.load <<-YAML.gsub(/^ /, "")
|
108
|
+
language: python
|
109
|
+
python:
|
110
|
+
- 2.7
|
111
|
+
|
112
|
+
deploy:
|
113
|
+
provider: heroku
|
114
|
+
strategy: git
|
115
|
+
api_key:
|
116
|
+
secure:
|
117
|
+
secure: |-
|
118
|
+
SECRET HERE
|
119
|
+
YAML
|
120
|
+
|
121
|
+
deploy = config.deploy.first
|
122
|
+
expect(deploy[:secure]).to be_nil
|
123
|
+
expect(deploy.warnings).to include('unexpected key "secure", dropping')
|
124
|
+
end
|
125
|
+
|
126
|
+
specify 'secure cannot be nested' do
|
127
|
+
config = Travis::Yaml.load <<-YAML.gsub(/^ /, "")
|
128
|
+
language: python
|
129
|
+
python:
|
130
|
+
- 2.7
|
131
|
+
|
132
|
+
deploy:
|
133
|
+
provider: heroku
|
134
|
+
strategy: git
|
135
|
+
api_key:
|
136
|
+
secure:
|
137
|
+
secure: |-
|
138
|
+
SECRET HERE
|
139
|
+
YAML
|
140
|
+
|
141
|
+
deploy = config.deploy.first
|
142
|
+
expect(deploy[:api_key]).to be_nil
|
143
|
+
expect(deploy.warnings).to include('dropping "api_key" section: secret value needs to be a string')
|
144
|
+
end
|
145
|
+
end
|
data/spec/parser/ruby_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
describe Travis::Yaml::Parser::Ruby do
|
2
|
-
subject {
|
2
|
+
subject { Travis::Yaml::Parser::Ruby }
|
3
3
|
let(:secure_string) { Travis::Yaml::SecureString.new("") }
|
4
4
|
let(:input) {{ ruby: ['2.0.0', :jruby, 10, 4.2, Time.now, false, nil, secure_string, Object.new] }}
|
5
5
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
describe Travis::Yaml::Serializer::Json do
|
2
|
+
subject(:config) { Travis::Yaml.parse('env: [{ secure: "foo" }, "bar"]') }
|
3
|
+
|
4
|
+
example "serializes json" do
|
5
|
+
expect(config.serialize(:json)).to be == '{"env":{"matrix":[{"secure":"foo"},"bar"]},"language":"ruby","os":["linux"]}'
|
6
|
+
end
|
7
|
+
|
8
|
+
example "does work properly with symbol keys option" do
|
9
|
+
expect(config.serialize(:json, symbol_keys: true)).to be == '{"env":{"matrix":[{"secure":"foo"},"bar"]},"language":"ruby","os":["linux"]}'
|
10
|
+
end
|
11
|
+
|
12
|
+
example "serializes pretty json" do
|
13
|
+
expect(config.serialize(:json, pretty: true)).to be ==
|
14
|
+
"{\n \"env\": {\n \"matrix\": [\n {\"secure\": \"foo\"},\n \"bar\"\n ]\n },\n \"language\": \"ruby\",\n \"os\": [ \"linux\" ]\n}"
|
15
|
+
end
|
16
|
+
|
17
|
+
example "complains about decrypted values missing" do
|
18
|
+
expect { config.serialize(:json, secure: :decrypted) }.to raise_error(ArgumentError, 'secure option is set decrypted, but a secure value is not decrypted')
|
19
|
+
end
|
20
|
+
|
21
|
+
example "serializes decrypted values" do
|
22
|
+
config.decrypt { |*| "x" }
|
23
|
+
expect(config.serialize(:json, secure: :encrypted)).to be == '{"env":{"matrix":[{"secure":"foo"},"bar"]},"language":"ruby","os":["linux"]}'
|
24
|
+
expect(config.serialize(:json, secure: :decrypted)).to be == '{"env":{"matrix":["x","bar"]},"language":"ruby","os":["linux"]}'
|
25
|
+
end
|
26
|
+
|
27
|
+
example "is exposed via to_json" do
|
28
|
+
expect(config.serialize(:json)).to be == config.to_json
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
describe Travis::Yaml::Serializer::Legacy do
|
2
|
+
subject(:config) { Travis::Yaml.parse('env: [{ secure: "foo" }, "bar"]') }
|
3
|
+
|
4
|
+
example "serializes to legacy ruby" do
|
5
|
+
expect(config.serialize(:legacy)).to be == {
|
6
|
+
"env"=>{"matrix"=>[{"secure"=>"foo"}, "bar"]},
|
7
|
+
"language"=>"ruby", "os"=>["linux"],
|
8
|
+
".result"=>"configured",
|
9
|
+
".result_warnings"=>[[[], "missing key \"language\", defaulting to \"ruby\""]]
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
example "serializes to legacy ruby" do
|
14
|
+
expect(config.serialize(:legacy, symbol_keys: true)).to be == {
|
15
|
+
:env=>{:matrix=>[{:secure=>"foo"}, "bar"]},
|
16
|
+
:language=>"ruby", :os=>["linux"],
|
17
|
+
:".result"=>"configured",
|
18
|
+
:".result_warnings"=>[[[], "missing key \"language\", defaulting to \"ruby\""]]
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
example "complains about decrypted values missing" do
|
23
|
+
expect { config.serialize(:legacy, secure: :decrypted) }.to raise_error(ArgumentError, 'secure option is set decrypted, but a secure value is not decrypted')
|
24
|
+
end
|
25
|
+
|
26
|
+
example "serializes decrypted values" do
|
27
|
+
config.decrypt { |*| "x" }
|
28
|
+
|
29
|
+
expect(config.serialize(:legacy, secure: :encrypted)).to be == {
|
30
|
+
"env"=>{"matrix"=>[{"secure"=>"foo"}, "bar"]},
|
31
|
+
"language"=>"ruby", "os"=>["linux"],
|
32
|
+
".result"=>"configured",
|
33
|
+
".result_warnings"=>[[[], "missing key \"language\", defaulting to \"ruby\""]]
|
34
|
+
}
|
35
|
+
|
36
|
+
expect(config.serialize(:legacy, secure: :decrypted)).to be == {
|
37
|
+
"env"=>{"matrix"=>["x", "bar"]},
|
38
|
+
"language"=>"ruby", "os"=>["linux"],
|
39
|
+
".result"=>"configured",
|
40
|
+
".result_warnings"=>[[[], "missing key \"language\", defaulting to \"ruby\""]]
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
example "is exposed via to_legacy_ruby" do
|
45
|
+
expect(config.serialize(:legacy)).to be == config.to_legacy_ruby
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
describe Travis::Yaml::Serializer::Ruby do
|
2
|
+
subject(:config) { Travis::Yaml.parse('env: [{ secure: "foo" }, "bar"]') }
|
3
|
+
|
4
|
+
example "serializes to ruby objects" do
|
5
|
+
expect(config.serialize(:ruby)).to be == {
|
6
|
+
"env"=>{"matrix"=>[Travis::Yaml::SecureString.new("foo"), "bar"]},
|
7
|
+
"language"=>"ruby", "os"=>["linux"]
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
example "serializes symbol keys" do
|
12
|
+
expect(config.serialize(:ruby, symbol_keys: true)).to be == {
|
13
|
+
env: { matrix: [Travis::Yaml::SecureString.new("foo"), "bar"]},
|
14
|
+
language: "ruby", os: ["linux"]
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
example "is exposed via to_ruby" do
|
19
|
+
expect(config.serialize(:ruby)).to be == config.to_ruby
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
describe Travis::Yaml::Serializer::Yaml do
|
2
|
+
subject(:config) { Travis::Yaml.parse('env: [{ secure: "foo" }, "bar"]') }
|
3
|
+
|
4
|
+
example "serializes json" do
|
5
|
+
expect(config.serialize(:yaml).gsub("'", "")).to be ==
|
6
|
+
"---\nenv:\n matrix:\n - !encrypted foo\n - bar\nlanguage: ruby\nos:\n- linux\n"
|
7
|
+
end
|
8
|
+
|
9
|
+
example "complains about decrypted values missing" do
|
10
|
+
expect { config.serialize(:yaml, secure: :decrypted) }.to raise_error(ArgumentError,
|
11
|
+
'secure option is set decrypted, but a secure value is not decrypted')
|
12
|
+
end
|
13
|
+
|
14
|
+
example "serializes decrypted values" do
|
15
|
+
config.decrypt { |*| "x" }
|
16
|
+
|
17
|
+
expect(config.serialize(:yaml, secure: :encrypted).gsub("'", "")).to be ==
|
18
|
+
"---\nenv:\n matrix:\n - !encrypted foo\n - bar\nlanguage: ruby\nos:\n- linux\n"
|
19
|
+
|
20
|
+
expect(config.serialize(:yaml, secure: :decrypted).gsub("'", "")).to be ==
|
21
|
+
"---\nenv:\n matrix:\n - !decrypted x\n - bar\nlanguage: ruby\nos:\n- linux\n"
|
22
|
+
end
|
23
|
+
|
24
|
+
example "avoid tags" do
|
25
|
+
config.decrypt { |*| "x" }
|
26
|
+
|
27
|
+
expect(config.serialize(:yaml, secure: :encrypted, avoid_tags: true).gsub("'", "")).to be ==
|
28
|
+
"---\nenv:\n matrix:\n - secure: foo\n - bar\nlanguage: ruby\nos:\n- linux\n"
|
29
|
+
|
30
|
+
expect(config.serialize(:yaml, secure: :decrypted, avoid_tags: true).gsub("'", "")).to be ==
|
31
|
+
"---\nenv:\n matrix:\n - x\n - bar\nlanguage: ruby\nos:\n- linux\n"
|
32
|
+
end
|
33
|
+
|
34
|
+
example "indentation" do
|
35
|
+
expect(config.serialize(:yaml, indentation: 3).gsub("'", "")).to be ==
|
36
|
+
"---\nenv:\n matrix:\n - !encrypted foo\n - bar\nlanguage: ruby\nos:\n- linux\n"
|
37
|
+
end
|
38
|
+
|
39
|
+
example "symbol keys" do
|
40
|
+
expect(config.serialize(:yaml, symbol_keys: true).gsub("'", "")).to be ==
|
41
|
+
"---\n:env:\n :matrix:\n - !encrypted foo\n - bar\n:language: ruby\n:os:\n- linux\n"
|
42
|
+
end
|
43
|
+
|
44
|
+
example "is exposed via to_yaml" do
|
45
|
+
expect(config.serialize(:yaml)).to be == config.to_yaml
|
46
|
+
end
|
47
|
+
end
|
data/spec/support/coverage.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
1
|
+
unless defined? RUBY_ENGINE and RUBY_ENGINE == 'jruby'
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
|
2
4
|
|
3
|
-
SimpleCov.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
add_filter "/spec/"
|
10
|
-
add_group 'Library', 'lib'
|
5
|
+
SimpleCov.start do
|
6
|
+
project_name 'travis-yaml'
|
7
|
+
coverage_dir '.coverage'
|
8
|
+
add_filter '/spec/'
|
9
|
+
add_group 'Library', 'lib'
|
10
|
+
end
|
11
11
|
end
|
data/spec/yaml_spec.rb
CHANGED
@@ -5,6 +5,13 @@ describe Travis::Yaml do
|
|
5
5
|
Travis::Yaml.parse! ""
|
6
6
|
end
|
7
7
|
|
8
|
+
specify :parse do
|
9
|
+
config = Travis::Yaml.parse('env: { secure: foo }') do |yaml|
|
10
|
+
yaml.decrypt { |value| value }
|
11
|
+
end
|
12
|
+
expect(config).to be_decrypted
|
13
|
+
end
|
14
|
+
|
8
15
|
describe :new do
|
9
16
|
specify 'with block' do
|
10
17
|
config = Travis::Yaml.new { |c| c.language = 'php' }
|
@@ -23,4 +30,20 @@ describe Travis::Yaml do
|
|
23
30
|
config = Travis::Yaml.parse(rvm: ['jruby', '2.0.0'], language: :ruby)
|
24
31
|
expect(config.inspect).to be == '#<Travis::Yaml:{"ruby"=>["jruby", "2.0.0"], "language"=>"ruby", "os"=>"linux"}>'
|
25
32
|
end
|
33
|
+
|
34
|
+
context :with_value do
|
35
|
+
subject(:config) { Travis::Yaml.parse(rvm: ['jruby', '2.0.0'], language: :ruby) }
|
36
|
+
|
37
|
+
example "with_value for language" do
|
38
|
+
changed = config.with_value(language: :php)
|
39
|
+
expect(changed.language) .to be == "php"
|
40
|
+
expect(config.language) .to be == "ruby"
|
41
|
+
end
|
42
|
+
|
43
|
+
example "with_value for rvm" do
|
44
|
+
changed = config.with_value(rvm: :jruby)
|
45
|
+
expect(changed.rvm) .to be == "jruby"
|
46
|
+
expect(config.rvm) .to be == ['jruby', '2.0.0']
|
47
|
+
end
|
48
|
+
end
|
26
49
|
end
|
data/travis-yaml.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.email = "contact@travis-ci.com"
|
9
9
|
s.homepage = "https://github.com/travis-ci/travis-yaml"
|
10
10
|
s.summary = %q{parses your .travis.yml}
|
11
|
-
s.description = %q{parses and validates your .travis.yml, fast
|
11
|
+
s.description = %q{parses and validates your .travis.yml, fast and secure}
|
12
12
|
s.license = 'MIT'
|
13
13
|
s.files = `git ls-files`.split("\n")
|
14
14
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -16,8 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.require_path = 'lib'
|
17
17
|
s.required_ruby_version = '>= 1.9.3'
|
18
18
|
|
19
|
-
s.
|
20
|
-
s.add_development_dependency 'rspec', '~> 3.0.0.beta'
|
19
|
+
s.add_development_dependency 'rspec', '~> 3.0'
|
21
20
|
s.add_development_dependency 'rake'
|
22
21
|
s.add_development_dependency 'simplecov'
|
23
22
|
s.add_development_dependency 'safe_yaml', '~> 1.0.1'
|
metadata
CHANGED
@@ -1,43 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: travis-yaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis CI GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: psych
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rspec
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.0
|
19
|
+
version: '3.0'
|
34
20
|
type: :development
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
24
|
- - "~>"
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: 3.0
|
26
|
+
version: '3.0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: rake
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,7 +66,7 @@ dependencies:
|
|
80
66
|
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: 1.0.1
|
83
|
-
description: parses and validates your .travis.yml, fast
|
69
|
+
description: parses and validates your .travis.yml, fast and secure
|
84
70
|
email: contact@travis-ci.com
|
85
71
|
executables: []
|
86
72
|
extensions: []
|
@@ -96,10 +82,11 @@ files:
|
|
96
82
|
- Rakefile
|
97
83
|
- SPEC.md
|
98
84
|
- bench/parser_bench.rb
|
99
|
-
- config.ru
|
100
85
|
- lib/travis/yaml.rb
|
101
86
|
- lib/travis/yaml/matrix.rb
|
102
87
|
- lib/travis/yaml/nodes.rb
|
88
|
+
- lib/travis/yaml/nodes/addons.rb
|
89
|
+
- lib/travis/yaml/nodes/android.rb
|
103
90
|
- lib/travis/yaml/nodes/branches.rb
|
104
91
|
- lib/travis/yaml/nodes/bundler_args.rb
|
105
92
|
- lib/travis/yaml/nodes/cache.rb
|
@@ -108,9 +95,11 @@ files:
|
|
108
95
|
- lib/travis/yaml/nodes/deploy.rb
|
109
96
|
- lib/travis/yaml/nodes/deploy_conditions.rb
|
110
97
|
- lib/travis/yaml/nodes/deploy_entry.rb
|
98
|
+
- lib/travis/yaml/nodes/dist.rb
|
111
99
|
- lib/travis/yaml/nodes/env.rb
|
112
100
|
- lib/travis/yaml/nodes/fixed_value.rb
|
113
101
|
- lib/travis/yaml/nodes/git.rb
|
102
|
+
- lib/travis/yaml/nodes/group.rb
|
114
103
|
- lib/travis/yaml/nodes/jdk.rb
|
115
104
|
- lib/travis/yaml/nodes/language.rb
|
116
105
|
- lib/travis/yaml/nodes/language_specific.rb
|
@@ -134,26 +123,44 @@ files:
|
|
134
123
|
- lib/travis/yaml/parser/psych.rb
|
135
124
|
- lib/travis/yaml/parser/ruby.rb
|
136
125
|
- lib/travis/yaml/secure_string.rb
|
126
|
+
- lib/travis/yaml/serializer.rb
|
127
|
+
- lib/travis/yaml/serializer/generic.rb
|
128
|
+
- lib/travis/yaml/serializer/json.rb
|
129
|
+
- lib/travis/yaml/serializer/legacy.rb
|
130
|
+
- lib/travis/yaml/serializer/ruby.rb
|
131
|
+
- lib/travis/yaml/serializer/yaml.rb
|
137
132
|
- lib/travis/yaml/version.rb
|
138
133
|
- play/lint.rb
|
139
134
|
- play/spec.rb
|
140
|
-
-
|
135
|
+
- spec/matrix_spec.rb
|
141
136
|
- spec/nodes/.rb
|
137
|
+
- spec/nodes/addons_spec.rb
|
142
138
|
- spec/nodes/branches_spec.rb
|
143
139
|
- spec/nodes/bundler_args_spec.rb
|
144
140
|
- spec/nodes/cache_spec.rb
|
145
141
|
- spec/nodes/compiler_spec.rb
|
146
142
|
- spec/nodes/deploy_spec.rb
|
143
|
+
- spec/nodes/dist_spec.rb
|
144
|
+
- spec/nodes/env_spec.rb
|
147
145
|
- spec/nodes/git_spec.rb
|
146
|
+
- spec/nodes/group_spec.rb
|
148
147
|
- spec/nodes/jdk_spec.rb
|
149
148
|
- spec/nodes/language_spec.rb
|
149
|
+
- spec/nodes/node_js_spec.rb
|
150
150
|
- spec/nodes/notifications_spec.rb
|
151
151
|
- spec/nodes/os_spec.rb
|
152
|
+
- spec/nodes/root_spec.rb
|
152
153
|
- spec/nodes/ruby_spec.rb
|
154
|
+
- spec/nodes/secure_spec.rb
|
153
155
|
- spec/nodes/stage_spec.rb
|
154
156
|
- spec/nodes/virtual_env_spec.rb
|
155
157
|
- spec/parser/dummy_spec.rb
|
158
|
+
- spec/parser/psych_spec.rb
|
156
159
|
- spec/parser/ruby_spec.rb
|
160
|
+
- spec/serializer/json_spec.rb
|
161
|
+
- spec/serializer/legacy_spec.rb
|
162
|
+
- spec/serializer/ruby_spec.rb
|
163
|
+
- spec/serializer/yaml_spec.rb
|
157
164
|
- spec/support.rb
|
158
165
|
- spec/support/coverage.rb
|
159
166
|
- spec/support/environment.rb
|
@@ -179,27 +186,40 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
186
|
version: '0'
|
180
187
|
requirements: []
|
181
188
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.
|
189
|
+
rubygems_version: 2.4.4
|
183
190
|
signing_key:
|
184
191
|
specification_version: 4
|
185
192
|
summary: parses your .travis.yml
|
186
193
|
test_files:
|
194
|
+
- spec/matrix_spec.rb
|
187
195
|
- spec/nodes/.rb
|
196
|
+
- spec/nodes/addons_spec.rb
|
188
197
|
- spec/nodes/branches_spec.rb
|
189
198
|
- spec/nodes/bundler_args_spec.rb
|
190
199
|
- spec/nodes/cache_spec.rb
|
191
200
|
- spec/nodes/compiler_spec.rb
|
192
201
|
- spec/nodes/deploy_spec.rb
|
202
|
+
- spec/nodes/dist_spec.rb
|
203
|
+
- spec/nodes/env_spec.rb
|
193
204
|
- spec/nodes/git_spec.rb
|
205
|
+
- spec/nodes/group_spec.rb
|
194
206
|
- spec/nodes/jdk_spec.rb
|
195
207
|
- spec/nodes/language_spec.rb
|
208
|
+
- spec/nodes/node_js_spec.rb
|
196
209
|
- spec/nodes/notifications_spec.rb
|
197
210
|
- spec/nodes/os_spec.rb
|
211
|
+
- spec/nodes/root_spec.rb
|
198
212
|
- spec/nodes/ruby_spec.rb
|
213
|
+
- spec/nodes/secure_spec.rb
|
199
214
|
- spec/nodes/stage_spec.rb
|
200
215
|
- spec/nodes/virtual_env_spec.rb
|
201
216
|
- spec/parser/dummy_spec.rb
|
217
|
+
- spec/parser/psych_spec.rb
|
202
218
|
- spec/parser/ruby_spec.rb
|
219
|
+
- spec/serializer/json_spec.rb
|
220
|
+
- spec/serializer/legacy_spec.rb
|
221
|
+
- spec/serializer/ruby_spec.rb
|
222
|
+
- spec/serializer/yaml_spec.rb
|
203
223
|
- spec/support.rb
|
204
224
|
- spec/support/coverage.rb
|
205
225
|
- spec/support/environment.rb
|