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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -8
  3. data/Gemfile +3 -6
  4. data/Gemfile.lock +20 -50
  5. data/README.md +97 -2
  6. data/SPEC.md +116 -33
  7. data/lib/travis/yaml.rb +6 -3
  8. data/lib/travis/yaml/matrix.rb +12 -17
  9. data/lib/travis/yaml/nodes.rb +4 -0
  10. data/lib/travis/yaml/nodes/addons.rb +44 -0
  11. data/lib/travis/yaml/nodes/android.rb +7 -0
  12. data/lib/travis/yaml/nodes/cache.rb +5 -3
  13. data/lib/travis/yaml/nodes/deploy_conditions.rb +2 -1
  14. data/lib/travis/yaml/nodes/deploy_entry.rb +46 -0
  15. data/lib/travis/yaml/nodes/dist.rb +6 -0
  16. data/lib/travis/yaml/nodes/env.rb +1 -1
  17. data/lib/travis/yaml/nodes/group.rb +6 -0
  18. data/lib/travis/yaml/nodes/language.rb +3 -2
  19. data/lib/travis/yaml/nodes/language_specific.rb +2 -2
  20. data/lib/travis/yaml/nodes/mapping.rb +39 -10
  21. data/lib/travis/yaml/nodes/node.rb +58 -1
  22. data/lib/travis/yaml/nodes/notifications.rb +10 -6
  23. data/lib/travis/yaml/nodes/open_mapping.rb +1 -1
  24. data/lib/travis/yaml/nodes/os.rb +1 -1
  25. data/lib/travis/yaml/nodes/os_entry.rb +7 -5
  26. data/lib/travis/yaml/nodes/root.rb +28 -4
  27. data/lib/travis/yaml/nodes/scalar.rb +16 -1
  28. data/lib/travis/yaml/nodes/sequence.rb +38 -0
  29. data/lib/travis/yaml/nodes/version.rb +13 -0
  30. data/lib/travis/yaml/nodes/version_list.rb +4 -0
  31. data/lib/travis/yaml/parser/psych.rb +11 -5
  32. data/lib/travis/yaml/secure_string.rb +35 -2
  33. data/lib/travis/yaml/serializer.rb +17 -0
  34. data/lib/travis/yaml/serializer/generic.rb +114 -0
  35. data/lib/travis/yaml/serializer/json.rb +72 -0
  36. data/lib/travis/yaml/serializer/legacy.rb +32 -0
  37. data/lib/travis/yaml/serializer/ruby.rb +13 -0
  38. data/lib/travis/yaml/serializer/yaml.rb +41 -0
  39. data/lib/travis/yaml/version.rb +1 -1
  40. data/play/spec.rb +24 -17
  41. data/spec/matrix_spec.rb +57 -0
  42. data/spec/nodes/addons_spec.rb +63 -0
  43. data/spec/nodes/cache_spec.rb +4 -4
  44. data/spec/nodes/deploy_spec.rb +12 -0
  45. data/spec/nodes/dist_spec.rb +11 -0
  46. data/spec/nodes/env_spec.rb +48 -0
  47. data/spec/nodes/git_spec.rb +1 -1
  48. data/spec/nodes/group_spec.rb +11 -0
  49. data/spec/nodes/node_js_spec.rb +14 -0
  50. data/spec/nodes/notifications_spec.rb +7 -0
  51. data/spec/nodes/os_spec.rb +13 -0
  52. data/spec/nodes/root_spec.rb +36 -0
  53. data/spec/nodes/secure_spec.rb +145 -0
  54. data/spec/parser/psych_spec.rb +6 -0
  55. data/spec/parser/ruby_spec.rb +1 -1
  56. data/spec/serializer/json_spec.rb +30 -0
  57. data/spec/serializer/legacy_spec.rb +47 -0
  58. data/spec/serializer/ruby_spec.rb +21 -0
  59. data/spec/serializer/yaml_spec.rb +47 -0
  60. data/spec/support/coverage.rb +9 -9
  61. data/spec/yaml_spec.rb +23 -0
  62. data/travis-yaml.gemspec +2 -3
  63. metadata +42 -22
  64. data/config.ru +0 -2
  65. data/play/weblint.rb +0 -296
data/config.ru DELETED
@@ -1,2 +0,0 @@
1
- require_relative './play/weblint'
2
- run Sinatra::Application
@@ -1,296 +0,0 @@
1
- require 'bundler/setup'
2
- require 'travis/yaml'
3
- require 'sinatra'
4
- require 'slim'
5
- require 'gh'
6
-
7
- configure :production do
8
- GH.set token: ENV.fetch('GITHUB_TOKEN')
9
- end
10
-
11
- get '/' do
12
- slim ""
13
- end
14
-
15
- get '/style.css' do
16
- sass :style
17
- end
18
-
19
- post '/' do
20
- redirect to(params[:repo]) if params[:repo]
21
- show_result
22
- end
23
-
24
- get '/gist/:id' do
25
- file = params[:file] || '.travis.yml'
26
- params[:yml] = GH["/gists/#{params[:id]}"]['files'][file]['content']
27
- show_result
28
- end
29
-
30
- get '/:owner/:name' do
31
- params[:repo] = request.path_info[1..-1]
32
- show_result
33
- end
34
-
35
- error GH::Error, NoMethodError do
36
- halt 400, slim("ul.result\n li failed to fetch <b class='error'>.travis.yml</b>")
37
- end
38
-
39
- helpers do
40
- def show_result
41
- halt 400, 'needs repo or yml' unless params[:repo] or params[:yml]
42
- branch = params[:branch] || 'master'
43
- params[:yml] ||= GH["/repos/#{params[:repo]}/contents/.travis.yml?ref=#{branch}"]['content'].to_s.unpack('m').first
44
- @result = Travis::Yaml.parse(params[:yml])
45
- @matrix = Travis::Yaml::Matrix.new(@result)
46
- slim :result
47
- end
48
- end
49
-
50
- __END__
51
-
52
- @@ result
53
-
54
- - if @result.nested_warnings.empty?
55
- p.result Hooray, your .travis.yml seems to be solid!
56
- - else
57
- ul.result
58
- - @result.nested_warnings.each do |key, warning|
59
- li
60
- - if key.any?
61
- | in <b class="error">#{key.join('.')}</b> section:
62
- = " "
63
- == slim('= error', {}, error: warning).gsub(/&quot;(.+?)&quot;/, '<b class="error">\1</b>')
64
-
65
- - if @matrix.size > 1
66
- p.jobs It will generate #{@matrix.size} jobs:
67
- ul.jobs
68
- - @matrix.each do |job|
69
- li = job.matrix_attributes.map { |k,v| "%s=%p" % [k,v] if v }.compact.join(', ')
70
-
71
- @@ layout
72
-
73
- html
74
- head
75
- title Validate your .travis.yml file
76
- link rel="stylesheet" type="text/css" href="/style.css"
77
- body
78
- h1
79
- a href="/" Travis WebLint
80
- p.tagline
81
- | Uses <a href="https://github.com/travis-ci/travis-yaml">travis-yaml</a> to check your .travis.yml config.
82
-
83
- == yield
84
-
85
- form class="first" action="/" method="post" accept-charset="UTF-8"
86
- label for="repo" Enter your Github repository
87
- input type="text" id="repo" name="repo" maxlength="80" placeholder="travis-ci/travis-yaml" required=true value=params[:repo]
88
- input type="submit" value="Validate"
89
-
90
- form action="/" method="post" accept-charset="UTF-8" id="ymlform"
91
- label for="yml" Or paste your .travis.yml
92
- textarea id="yml" name="yml" maxlength="10000" autofocus=true = params[:yml]
93
- input type="submit" value="Validate"
94
-
95
- javascript:
96
- var input = document.getElementById("yml");
97
- var form = document.getElementById("ymlform");
98
- input.onkeydown = function(event) {
99
- if ((event.metaKey || event.ctrlKey) && event.keyCode == 13) form.submit();
100
- };
101
-
102
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
103
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
104
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
105
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
106
-
107
- ga('create', 'UA-24868285-9', 'travis-ci.org');
108
- ga('send', 'pageview');
109
-
110
- @@ style
111
-
112
- // http://meyerweb.com/eric/tools/css/reset/
113
- // v2.0 | 20110126
114
- // License: none (public domain)
115
-
116
- html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video
117
- margin: 0
118
- padding: 0
119
- border: 0
120
- font-size: 100%
121
- font: inherit
122
- vertical-align: baseline
123
-
124
- // HTML5 display-role reset for older browsers
125
- article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section
126
- display: block
127
-
128
- body
129
- line-height: 1
130
-
131
- ol, ul
132
- list-style: none
133
-
134
- blockquote, q
135
- quotes: none
136
-
137
- blockquote
138
- &:before, &:after
139
- content: ''
140
- content: none
141
-
142
- q
143
- &:before, &:after
144
- content: ''
145
- content: none
146
-
147
- table
148
- border-collapse: collapse
149
- border-spacing: 0
150
-
151
- // General
152
-
153
- body
154
- margin: 2em auto 2em auto
155
- width: 960px
156
- font-size: 14px
157
- line-height: 1.4286
158
- color: #555
159
- background: #fff
160
- font-family: "Helvetica Neue", Arial, Verdana, sans-serif
161
-
162
- b
163
- font-weight: bold
164
-
165
- a
166
- color: #36c
167
- outline: none
168
- text-decoration: underline
169
-
170
- a:visited
171
- color: #666
172
-
173
- a:hover
174
- color: #6c3
175
- text-decoration: none
176
-
177
- h1
178
- color: #000
179
- font-size: 4em
180
- font-weight: bold
181
- line-height: 1em
182
-
183
- h1 a:link, h1 a:visited, h1 a:hover, h1 a:active
184
- color: #000
185
- text-decoration: none
186
-
187
- h2
188
- font-size: 2em
189
- font-weight: bold
190
- line-height: 2em
191
-
192
- p.tagline
193
- color: #777
194
- display: block
195
- font: italic 1.25em Georgia, Times, Serif
196
- line-height: 1.67em
197
- margin: 1em 0 4em 0
198
- padding: 0 0 1.25em 0
199
- border-bottom: 1px solid #ccc
200
-
201
- // Result
202
-
203
- .result
204
- font-size: 1.5em
205
- margin-bottom: 2em
206
-
207
- p.result
208
- color: #6c3
209
-
210
- ul.result
211
- list-style: none
212
-
213
- ul.result li:before
214
- content: ">"
215
- display: inline-block
216
- background-color: #c00
217
- color: #fff
218
- width: 1.4em
219
- height: 1.4em
220
- font-size: 40%
221
- margin-right: 1em
222
- text-align: center
223
- position: relative
224
- top: -0.5em
225
-
226
- // jobs
227
-
228
- .jobs
229
- font-size: 1.5em
230
-
231
- ul.jobs
232
- list-style: none
233
- margin-bottom: 2em
234
- font-size: 1.25em
235
-
236
- ul.jobs li:before
237
- content: ">"
238
- display: inline-block
239
- background-color: #000
240
- color: #fff
241
- width: 1.4em
242
- height: 1.4em
243
- font-size: 48%
244
- margin-right: 1em
245
- text-align: center
246
- position: relative
247
- top: -0.5em
248
-
249
- // Form
250
-
251
- form
252
- display: inline-block
253
- vertical-align: top
254
- width: 475px
255
-
256
- form.left
257
- margin-right: 55px
258
-
259
- label, input
260
- display: block
261
-
262
- label
263
- margin-bottom: 0.5em
264
-
265
- input, textarea
266
- font-size: 14px
267
- line-height: 1.4286
268
- color: #555
269
- font-family: "Helvetica Neue", Arial, Verdana, sans-serif
270
- border: 1px solid #ccc
271
- margin: 0
272
-
273
- input[type=text]
274
- padding: 4px 8px
275
- width: 400px
276
-
277
- input[type=submit]
278
- background: #efefef
279
- padding: 4px 8px
280
- margin-top: 0.5em
281
-
282
- input[type=submit]:hover
283
- cursor: pointer
284
-
285
- textarea
286
- padding: 4px 8px
287
- width: 460px
288
- height: 250px
289
-
290
- // Various
291
-
292
- .error
293
- color: #c00
294
-
295
- .note
296
- margin-top: 5em