travis-lint 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
data/lib/travis/lint/linter.rb
CHANGED
@@ -81,11 +81,54 @@ module Travis
|
|
81
81
|
hsh[:rvm].is_a?(Array) && hsh[:rvm].include?("1.8.6")
|
82
82
|
end
|
83
83
|
|
84
|
+
DOCS_URL = "Travis CI documentation at http://bit.ly/travis-ci-environment"
|
85
|
+
|
86
|
+
validator_for :ruby, :rvm, "Detected unsupported Ruby versions. For an up-to-date list of supported Rubies, see #{DOCS_URL}" do |hsh|
|
87
|
+
("ruby" == hsh[:language].to_s.downcase) && hsh[:rvm].is_a?(Array) && !known_ruby_versions?(hsh[:rvm])
|
88
|
+
end
|
89
|
+
|
90
|
+
validator_for :node_js, :node_js, "Detected unsupported Node.js versions. For an up-to-date list of supported Node.js versions, see #{DOCS_URL}" do |hsh|
|
91
|
+
("node_js" == hsh[:language].to_s.downcase) && hsh[:node_js].is_a?(Array) && !known_node_js_versions?(hsh[:node_js])
|
92
|
+
end
|
93
|
+
|
94
|
+
validator_for :php, :php, "Detected unsupported PHP versions. For an up-to-date list of supported PHP versions, see #{DOCS_URL}" do |hsh|
|
95
|
+
("php" == hsh[:language].to_s.downcase) && hsh[:php].is_a?(Array) && !known_php_versions?(hsh[:php])
|
96
|
+
end
|
97
|
+
|
84
98
|
|
85
99
|
|
86
100
|
validator_for :ruby, :language, "Language is set to Ruby but node_js key is present. Ruby builder will ignore node_js key." do |hsh|
|
87
101
|
hsh[:language].to_s.downcase == "ruby" && ! blank?(hsh[:node_js])
|
88
102
|
end
|
103
|
+
|
104
|
+
|
105
|
+
KNOWN_RUBY_VERSIONS = %w(1.8.7 ruby-1.8.7 1.9.2 ruby-1.9.2 1.9.3 ruby-1.9.3 ruby-head jruby jruby-18mode jruby-19mode rbx rbx-18mode rbx-19mode jruby-head ree ree-1.8.7)
|
106
|
+
KNOWN_NODE_VERSIONS = %w(0.4 0.6 0.7)
|
107
|
+
KNOWN_PHP_VERSIONS = %w(5.2 5.3 5.3.2 5.3.8 5.4)
|
108
|
+
|
109
|
+
protected
|
110
|
+
|
111
|
+
def self.known_ruby_versions?(ary)
|
112
|
+
ary = ary.map(&:to_s)
|
113
|
+
|
114
|
+
unknown = ary - KNOWN_RUBY_VERSIONS
|
115
|
+
unknown.empty?
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.known_node_js_versions?(ary)
|
119
|
+
ary = ary.map(&:to_s)
|
120
|
+
|
121
|
+
unknown = ary - KNOWN_NODE_VERSIONS
|
122
|
+
unknown.empty?
|
123
|
+
end
|
124
|
+
|
125
|
+
def self.known_php_versions?(ary)
|
126
|
+
ary = ary.map(&:to_s)
|
127
|
+
|
128
|
+
unknown = ary - KNOWN_PHP_VERSIONS
|
129
|
+
unknown.empty?
|
130
|
+
end
|
131
|
+
|
89
132
|
end
|
90
133
|
end
|
91
134
|
end
|
data/lib/travis/lint/version.rb
CHANGED
data/spec/travis_lint_spec.rb
CHANGED
@@ -105,6 +105,56 @@ describe "A .travis.yml" do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
|
108
|
+
let(:docs) { "Travis CI documentation at http://bit.ly/travis-ci-environment" }
|
109
|
+
|
110
|
+
|
111
|
+
context "and uses an unsupported Ruby version" do
|
112
|
+
let(:unsupported_rubies) do
|
113
|
+
{ :key => :rvm, :issue => "Detected unsupported Ruby versions. For an up-to-date list of supported Rubies, see #{docs}" }
|
114
|
+
end
|
115
|
+
|
116
|
+
let(:travis_yml) do
|
117
|
+
{ :language => "ruby", :rvm => ["neoruby", "goruby", "bonanzaruby"] }
|
118
|
+
end
|
119
|
+
|
120
|
+
it "is invalid" do
|
121
|
+
Travis::Lint::Linter.validate(travis_yml).should include(unsupported_rubies)
|
122
|
+
Travis::Lint::Linter.valid?(content_of_sample_file("uses_unsupported_rubies.yml")).should be_false
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
context "and uses an unsupported Node.js version" do
|
128
|
+
let(:unsupported_nodejs) do
|
129
|
+
{ :key => :node_js, :issue => "Detected unsupported Node.js versions. For an up-to-date list of supported Node.js versions, see #{docs}" }
|
130
|
+
end
|
131
|
+
|
132
|
+
let(:travis_yml) do
|
133
|
+
{ :language => "node_js", :node_js => ["100.0", "0.5"] }
|
134
|
+
end
|
135
|
+
|
136
|
+
it "is invalid" do
|
137
|
+
Travis::Lint::Linter.validate(travis_yml).should include(unsupported_nodejs)
|
138
|
+
Travis::Lint::Linter.valid?(content_of_sample_file("uses_unsupported_nodejs.yml")).should be_false
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
context "and uses an unsupported PHP version" do
|
143
|
+
let(:unsupported_php) do
|
144
|
+
{ :key => :php, :issue => "Detected unsupported PHP versions. For an up-to-date list of supported PHP versions, see #{docs}" }
|
145
|
+
end
|
146
|
+
|
147
|
+
let(:travis_yml) do
|
148
|
+
{ :language => "php", :php => ["100.0", "0.5"] }
|
149
|
+
end
|
150
|
+
|
151
|
+
it "is invalid" do
|
152
|
+
Travis::Lint::Linter.validate(travis_yml).should include(unsupported_php)
|
153
|
+
Travis::Lint::Linter.valid?(content_of_sample_file("uses_unsupported_php.yml")).should be_false
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
|
108
158
|
context "that specifies Ruby as the language but tries to set node_js version" do
|
109
159
|
let(:travis_yml) do
|
110
160
|
{ :language => "ruby", :rvm => ["1.9.3"], :node_js => ["0.6"] }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: travis-lint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael S. Klishin
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-02-
|
19
|
+
date: 2012-02-17 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: hashr
|
@@ -79,6 +79,9 @@ files:
|
|
79
79
|
- spec/files/uses_jruby_instead_of_jruby_in_specific_mode.yml
|
80
80
|
- spec/files/uses_old_rbx_aliases.yml
|
81
81
|
- spec/files/uses_ruby_as_language_but_tries_to_switch_nodejs.yml
|
82
|
+
- spec/files/uses_unsupported_nodejs.yml
|
83
|
+
- spec/files/uses_unsupported_php.yml
|
84
|
+
- spec/files/uses_unsupported_rubies.yml
|
82
85
|
- spec/spec_helper.rb
|
83
86
|
- spec/travis_lint_spec.rb
|
84
87
|
- travis-lint.gemspec
|
@@ -115,11 +118,5 @@ rubygems_version: 1.8.15
|
|
115
118
|
signing_key:
|
116
119
|
specification_version: 3
|
117
120
|
summary: Checks your .travis.yml for possible issues, deprecations and so on
|
118
|
-
test_files:
|
119
|
-
|
120
|
-
- spec/files/no_rvm_key.yml
|
121
|
-
- spec/files/uses_jruby_instead_of_jruby_in_specific_mode.yml
|
122
|
-
- spec/files/uses_old_rbx_aliases.yml
|
123
|
-
- spec/files/uses_ruby_as_language_but_tries_to_switch_nodejs.yml
|
124
|
-
- spec/spec_helper.rb
|
125
|
-
- spec/travis_lint_spec.rb
|
121
|
+
test_files: []
|
122
|
+
|