middleman-build-reporter 0.0.1
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 +7 -0
- data/.gitignore +3 -0
- data/.travis.yml +3 -0
- data/Gemfile +3 -0
- data/README.md +118 -0
- data/Rakefile +12 -0
- data/features/build_reporter.feature +21 -0
- data/features/custom_build_reporter_file_name.feature +6 -0
- data/features/extended_build_reporter.feature +12 -0
- data/features/json_build_reporter.feature +21 -0
- data/features/no_explicit_version.feature +6 -0
- data/features/step_definitions/git_steps.rb +19 -0
- data/features/step_definitions/json_reporter_file_steps.rb +31 -0
- data/features/step_definitions/version_steps.rb +5 -0
- data/features/support/env.rb +4 -0
- data/features/support/helpers.rb +7 -0
- data/fixtures/basic-app/config.rb +4 -0
- data/fixtures/basic-app/source/images/background.png +0 -0
- data/fixtures/basic-app/source/images/middleman.png +0 -0
- data/fixtures/basic-app/source/index.html.erb +10 -0
- data/fixtures/basic-app/source/javascripts/all.js +1 -0
- data/fixtures/basic-app/source/layouts/layout.erb +19 -0
- data/fixtures/basic-app/source/stylesheets/all.css +55 -0
- data/fixtures/basic-app/source/stylesheets/normalize.css +375 -0
- data/fixtures/custom-reporter-file-name/config.rb +4 -0
- data/fixtures/custom-reporter-file-name/source/images/background.png +0 -0
- data/fixtures/custom-reporter-file-name/source/images/middleman.png +0 -0
- data/fixtures/custom-reporter-file-name/source/index.html.erb +10 -0
- data/fixtures/custom-reporter-file-name/source/javascripts/all.js +1 -0
- data/fixtures/custom-reporter-file-name/source/layouts/layout.erb +19 -0
- data/fixtures/custom-reporter-file-name/source/stylesheets/all.css +55 -0
- data/fixtures/custom-reporter-file-name/source/stylesheets/normalize.css +375 -0
- data/fixtures/extended-build-reporter/.build_reporter.yml +4 -0
- data/fixtures/extended-build-reporter/config.rb +4 -0
- data/fixtures/extended-build-reporter/source/images/background.png +0 -0
- data/fixtures/extended-build-reporter/source/images/middleman.png +0 -0
- data/fixtures/extended-build-reporter/source/index.html.erb +10 -0
- data/fixtures/extended-build-reporter/source/javascripts/all.js +1 -0
- data/fixtures/extended-build-reporter/source/layouts/layout.erb +19 -0
- data/fixtures/extended-build-reporter/source/stylesheets/all.css +55 -0
- data/fixtures/extended-build-reporter/source/stylesheets/normalize.css +375 -0
- data/fixtures/json-reporter-file/config.rb +5 -0
- data/fixtures/json-reporter-file/source/images/background.png +0 -0
- data/fixtures/json-reporter-file/source/images/middleman.png +0 -0
- data/fixtures/json-reporter-file/source/index.html.erb +10 -0
- data/fixtures/json-reporter-file/source/javascripts/all.js +1 -0
- data/fixtures/json-reporter-file/source/layouts/layout.erb +19 -0
- data/fixtures/json-reporter-file/source/stylesheets/all.css +55 -0
- data/fixtures/json-reporter-file/source/stylesheets/normalize.css +375 -0
- data/fixtures/no-version/config.rb +3 -0
- data/fixtures/no-version/source/images/background.png +0 -0
- data/fixtures/no-version/source/images/middleman.png +0 -0
- data/fixtures/no-version/source/index.html.erb +10 -0
- data/fixtures/no-version/source/javascripts/all.js +1 -0
- data/fixtures/no-version/source/layouts/layout.erb +19 -0
- data/fixtures/no-version/source/stylesheets/all.css +55 -0
- data/fixtures/no-version/source/stylesheets/normalize.css +375 -0
- data/lib/middleman-build-reporter/extension.rb +29 -0
- data/lib/middleman-build-reporter/reporter.rb +68 -0
- data/lib/middleman-build-reporter/version.rb +5 -0
- data/lib/middleman-build-reporter.rb +9 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman-build-reporter.gemspec +32 -0
- data/spec/middleman-build-reporter/extension_spec.rb +82 -0
- data/spec/middleman-build-reporter/reporter_spec.rb +184 -0
- data/spec/spec_helper.rb +35 -0
- metadata +248 -0
@@ -0,0 +1,375 @@
|
|
1
|
+
/*! normalize.css v2.0.1 | MIT License | git.io/normalize */
|
2
|
+
|
3
|
+
/* ==========================================================================
|
4
|
+
HTML5 display definitions
|
5
|
+
========================================================================== */
|
6
|
+
|
7
|
+
/*
|
8
|
+
* Corrects `block` display not defined in IE 8/9.
|
9
|
+
*/
|
10
|
+
|
11
|
+
article,
|
12
|
+
aside,
|
13
|
+
details,
|
14
|
+
figcaption,
|
15
|
+
figure,
|
16
|
+
footer,
|
17
|
+
header,
|
18
|
+
hgroup,
|
19
|
+
nav,
|
20
|
+
section,
|
21
|
+
summary {
|
22
|
+
display: block;
|
23
|
+
}
|
24
|
+
|
25
|
+
/*
|
26
|
+
* Corrects `inline-block` display not defined in IE 8/9.
|
27
|
+
*/
|
28
|
+
|
29
|
+
audio,
|
30
|
+
canvas,
|
31
|
+
video {
|
32
|
+
display: inline-block;
|
33
|
+
}
|
34
|
+
|
35
|
+
/*
|
36
|
+
* Prevents modern browsers from displaying `audio` without controls.
|
37
|
+
* Remove excess height in iOS 5 devices.
|
38
|
+
*/
|
39
|
+
|
40
|
+
audio:not([controls]) {
|
41
|
+
display: none;
|
42
|
+
height: 0;
|
43
|
+
}
|
44
|
+
|
45
|
+
/*
|
46
|
+
* Addresses styling for `hidden` attribute not present in IE 8/9.
|
47
|
+
*/
|
48
|
+
|
49
|
+
[hidden] {
|
50
|
+
display: none;
|
51
|
+
}
|
52
|
+
|
53
|
+
/* ==========================================================================
|
54
|
+
Base
|
55
|
+
========================================================================== */
|
56
|
+
|
57
|
+
/*
|
58
|
+
* 1. Sets default font family to sans-serif.
|
59
|
+
* 2. Prevents iOS text size adjust after orientation change, without disabling
|
60
|
+
* user zoom.
|
61
|
+
*/
|
62
|
+
|
63
|
+
html {
|
64
|
+
font-family: sans-serif; /* 1 */
|
65
|
+
-webkit-text-size-adjust: 100%; /* 2 */
|
66
|
+
-ms-text-size-adjust: 100%; /* 2 */
|
67
|
+
}
|
68
|
+
|
69
|
+
/*
|
70
|
+
* Removes default margin.
|
71
|
+
*/
|
72
|
+
|
73
|
+
body {
|
74
|
+
margin: 0;
|
75
|
+
}
|
76
|
+
|
77
|
+
/* ==========================================================================
|
78
|
+
Links
|
79
|
+
========================================================================== */
|
80
|
+
|
81
|
+
/*
|
82
|
+
* Addresses `outline` inconsistency between Chrome and other browsers.
|
83
|
+
*/
|
84
|
+
|
85
|
+
a:focus {
|
86
|
+
outline: thin dotted;
|
87
|
+
}
|
88
|
+
|
89
|
+
/*
|
90
|
+
* Improves readability when focused and also mouse hovered in all browsers.
|
91
|
+
*/
|
92
|
+
|
93
|
+
a:active,
|
94
|
+
a:hover {
|
95
|
+
outline: 0;
|
96
|
+
}
|
97
|
+
|
98
|
+
/* ==========================================================================
|
99
|
+
Typography
|
100
|
+
========================================================================== */
|
101
|
+
|
102
|
+
/*
|
103
|
+
* Addresses `h1` font sizes within `section` and `article` in Firefox 4+,
|
104
|
+
* Safari 5, and Chrome.
|
105
|
+
*/
|
106
|
+
|
107
|
+
h1 {
|
108
|
+
font-size: 2em;
|
109
|
+
}
|
110
|
+
|
111
|
+
/*
|
112
|
+
* Addresses styling not present in IE 8/9, Safari 5, and Chrome.
|
113
|
+
*/
|
114
|
+
|
115
|
+
abbr[title] {
|
116
|
+
border-bottom: 1px dotted;
|
117
|
+
}
|
118
|
+
|
119
|
+
/*
|
120
|
+
* Addresses style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
|
121
|
+
*/
|
122
|
+
|
123
|
+
b,
|
124
|
+
strong {
|
125
|
+
font-weight: bold;
|
126
|
+
}
|
127
|
+
|
128
|
+
/*
|
129
|
+
* Addresses styling not present in Safari 5 and Chrome.
|
130
|
+
*/
|
131
|
+
|
132
|
+
dfn {
|
133
|
+
font-style: italic;
|
134
|
+
}
|
135
|
+
|
136
|
+
/*
|
137
|
+
* Addresses styling not present in IE 8/9.
|
138
|
+
*/
|
139
|
+
|
140
|
+
mark {
|
141
|
+
background: #ff0;
|
142
|
+
color: #000;
|
143
|
+
}
|
144
|
+
|
145
|
+
|
146
|
+
/*
|
147
|
+
* Corrects font family set oddly in Safari 5 and Chrome.
|
148
|
+
*/
|
149
|
+
|
150
|
+
code,
|
151
|
+
kbd,
|
152
|
+
pre,
|
153
|
+
samp {
|
154
|
+
font-family: monospace, serif;
|
155
|
+
font-size: 1em;
|
156
|
+
}
|
157
|
+
|
158
|
+
/*
|
159
|
+
* Improves readability of pre-formatted text in all browsers.
|
160
|
+
*/
|
161
|
+
|
162
|
+
pre {
|
163
|
+
white-space: pre;
|
164
|
+
white-space: pre-wrap;
|
165
|
+
word-wrap: break-word;
|
166
|
+
}
|
167
|
+
|
168
|
+
/*
|
169
|
+
* Sets consistent quote types.
|
170
|
+
*/
|
171
|
+
|
172
|
+
q {
|
173
|
+
quotes: "\201C" "\201D" "\2018" "\2019";
|
174
|
+
}
|
175
|
+
|
176
|
+
/*
|
177
|
+
* Addresses inconsistent and variable font size in all browsers.
|
178
|
+
*/
|
179
|
+
|
180
|
+
small {
|
181
|
+
font-size: 80%;
|
182
|
+
}
|
183
|
+
|
184
|
+
/*
|
185
|
+
* Prevents `sub` and `sup` affecting `line-height` in all browsers.
|
186
|
+
*/
|
187
|
+
|
188
|
+
sub,
|
189
|
+
sup {
|
190
|
+
font-size: 75%;
|
191
|
+
line-height: 0;
|
192
|
+
position: relative;
|
193
|
+
vertical-align: baseline;
|
194
|
+
}
|
195
|
+
|
196
|
+
sup {
|
197
|
+
top: -0.5em;
|
198
|
+
}
|
199
|
+
|
200
|
+
sub {
|
201
|
+
bottom: -0.25em;
|
202
|
+
}
|
203
|
+
|
204
|
+
/* ==========================================================================
|
205
|
+
Embedded content
|
206
|
+
========================================================================== */
|
207
|
+
|
208
|
+
/*
|
209
|
+
* Removes border when inside `a` element in IE 8/9.
|
210
|
+
*/
|
211
|
+
|
212
|
+
img {
|
213
|
+
border: 0;
|
214
|
+
}
|
215
|
+
|
216
|
+
/*
|
217
|
+
* Corrects overflow displayed oddly in IE 9.
|
218
|
+
*/
|
219
|
+
|
220
|
+
svg:not(:root) {
|
221
|
+
overflow: hidden;
|
222
|
+
}
|
223
|
+
|
224
|
+
/* ==========================================================================
|
225
|
+
Figures
|
226
|
+
========================================================================== */
|
227
|
+
|
228
|
+
/*
|
229
|
+
* Addresses margin not present in IE 8/9 and Safari 5.
|
230
|
+
*/
|
231
|
+
|
232
|
+
figure {
|
233
|
+
margin: 0;
|
234
|
+
}
|
235
|
+
|
236
|
+
/* ==========================================================================
|
237
|
+
Forms
|
238
|
+
========================================================================== */
|
239
|
+
|
240
|
+
/*
|
241
|
+
* Define consistent border, margin, and padding.
|
242
|
+
*/
|
243
|
+
|
244
|
+
fieldset {
|
245
|
+
border: 1px solid #c0c0c0;
|
246
|
+
margin: 0 2px;
|
247
|
+
padding: 0.35em 0.625em 0.75em;
|
248
|
+
}
|
249
|
+
|
250
|
+
/*
|
251
|
+
* 1. Corrects color not being inherited in IE 8/9.
|
252
|
+
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
|
253
|
+
*/
|
254
|
+
|
255
|
+
legend {
|
256
|
+
border: 0; /* 1 */
|
257
|
+
padding: 0; /* 2 */
|
258
|
+
}
|
259
|
+
|
260
|
+
/*
|
261
|
+
* 1. Corrects font family not being inherited in all browsers.
|
262
|
+
* 2. Corrects font size not being inherited in all browsers.
|
263
|
+
* 3. Addresses margins set differently in Firefox 4+, Safari 5, and Chrome
|
264
|
+
*/
|
265
|
+
|
266
|
+
button,
|
267
|
+
input,
|
268
|
+
select,
|
269
|
+
textarea {
|
270
|
+
font-family: inherit; /* 1 */
|
271
|
+
font-size: 100%; /* 2 */
|
272
|
+
margin: 0; /* 3 */
|
273
|
+
}
|
274
|
+
|
275
|
+
/*
|
276
|
+
* Addresses Firefox 4+ setting `line-height` on `input` using `!important` in
|
277
|
+
* the UA stylesheet.
|
278
|
+
*/
|
279
|
+
|
280
|
+
button,
|
281
|
+
input {
|
282
|
+
line-height: normal;
|
283
|
+
}
|
284
|
+
|
285
|
+
/*
|
286
|
+
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
|
287
|
+
* and `video` controls.
|
288
|
+
* 2. Corrects inability to style clickable `input` types in iOS.
|
289
|
+
* 3. Improves usability and consistency of cursor style between image-type
|
290
|
+
* `input` and others.
|
291
|
+
*/
|
292
|
+
|
293
|
+
button,
|
294
|
+
html input[type="button"], /* 1 */
|
295
|
+
input[type="reset"],
|
296
|
+
input[type="submit"] {
|
297
|
+
-webkit-appearance: button; /* 2 */
|
298
|
+
cursor: pointer; /* 3 */
|
299
|
+
}
|
300
|
+
|
301
|
+
/*
|
302
|
+
* Re-set default cursor for disabled elements.
|
303
|
+
*/
|
304
|
+
|
305
|
+
button[disabled],
|
306
|
+
input[disabled] {
|
307
|
+
cursor: default;
|
308
|
+
}
|
309
|
+
|
310
|
+
/*
|
311
|
+
* 1. Addresses box sizing set to `content-box` in IE 8/9.
|
312
|
+
* 2. Removes excess padding in IE 8/9.
|
313
|
+
*/
|
314
|
+
|
315
|
+
input[type="checkbox"],
|
316
|
+
input[type="radio"] {
|
317
|
+
box-sizing: border-box; /* 1 */
|
318
|
+
padding: 0; /* 2 */
|
319
|
+
}
|
320
|
+
|
321
|
+
/*
|
322
|
+
* 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome.
|
323
|
+
* 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome
|
324
|
+
* (include `-moz` to future-proof).
|
325
|
+
*/
|
326
|
+
|
327
|
+
input[type="search"] {
|
328
|
+
-webkit-appearance: textfield; /* 1 */
|
329
|
+
-moz-box-sizing: content-box;
|
330
|
+
-webkit-box-sizing: content-box; /* 2 */
|
331
|
+
box-sizing: content-box;
|
332
|
+
}
|
333
|
+
|
334
|
+
/*
|
335
|
+
* Removes inner padding and search cancel button in Safari 5 and Chrome
|
336
|
+
* on OS X.
|
337
|
+
*/
|
338
|
+
|
339
|
+
input[type="search"]::-webkit-search-cancel-button,
|
340
|
+
input[type="search"]::-webkit-search-decoration {
|
341
|
+
-webkit-appearance: none;
|
342
|
+
}
|
343
|
+
|
344
|
+
/*
|
345
|
+
* Removes inner padding and border in Firefox 4+.
|
346
|
+
*/
|
347
|
+
|
348
|
+
button::-moz-focus-inner,
|
349
|
+
input::-moz-focus-inner {
|
350
|
+
border: 0;
|
351
|
+
padding: 0;
|
352
|
+
}
|
353
|
+
|
354
|
+
/*
|
355
|
+
* 1. Removes default vertical scrollbar in IE 8/9.
|
356
|
+
* 2. Improves readability and alignment in all browsers.
|
357
|
+
*/
|
358
|
+
|
359
|
+
textarea {
|
360
|
+
overflow: auto; /* 1 */
|
361
|
+
vertical-align: top; /* 2 */
|
362
|
+
}
|
363
|
+
|
364
|
+
/* ==========================================================================
|
365
|
+
Tables
|
366
|
+
========================================================================== */
|
367
|
+
|
368
|
+
/*
|
369
|
+
* Remove most spacing between table cells.
|
370
|
+
*/
|
371
|
+
|
372
|
+
table {
|
373
|
+
border-collapse: collapse;
|
374
|
+
border-spacing: 0;
|
375
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Middleman
|
2
|
+
class BuildReporterExtension < Extension
|
3
|
+
option :repo_root, nil, 'repo root'
|
4
|
+
option :version, '', 'app version'
|
5
|
+
option :reporter_file, 'build', 'build report file name'
|
6
|
+
option :reporter_file_formats, ['yaml'], 'an array of build report file formats'
|
7
|
+
|
8
|
+
def initialize(app, options_hash = {}, &block)
|
9
|
+
super
|
10
|
+
|
11
|
+
@app = app
|
12
|
+
|
13
|
+
@app.set :repo_root, (options.repo_root ? options.repo_root : app.root)
|
14
|
+
@app.set :version, options.version
|
15
|
+
@app.set :reporter_file, options.reporter_file
|
16
|
+
@app.set :reporter_file_formats, options.reporter_file_formats
|
17
|
+
end
|
18
|
+
|
19
|
+
def after_build(builder)
|
20
|
+
build_report.write do |file|
|
21
|
+
builder.say_status :create, file, :green
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def build_report
|
26
|
+
@report ||= Middleman::BuildReporter::Reporter.new(@app)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'git'
|
2
|
+
require 'json'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module Middleman
|
6
|
+
module BuildReporter
|
7
|
+
class Reporter
|
8
|
+
attr_accessor :app
|
9
|
+
|
10
|
+
def initialize(app_instance)
|
11
|
+
@app = app_instance
|
12
|
+
|
13
|
+
@app.set :repo, Git.open(@app.repo_root)
|
14
|
+
end
|
15
|
+
|
16
|
+
def write
|
17
|
+
@app.reporter_file_formats.each do |format|
|
18
|
+
file = "#{reporter_file_path}.#{format}"
|
19
|
+
|
20
|
+
File.write(file, serialize(format))
|
21
|
+
|
22
|
+
yield(file) if block_given?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def reporter_file_path
|
27
|
+
"#{@app.build_dir}/#{@app.reporter_file}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def reporter_extension_file_path
|
31
|
+
"#{@app.root}/.build_reporter.yml"
|
32
|
+
end
|
33
|
+
|
34
|
+
def details
|
35
|
+
{
|
36
|
+
'branch' => repo.current_branch,
|
37
|
+
'revision' => repo.log.first.to_s,
|
38
|
+
'build_time' => build_time.to_s,
|
39
|
+
'version' => @app.version
|
40
|
+
}.merge(details_extension)
|
41
|
+
end
|
42
|
+
|
43
|
+
def details_extension
|
44
|
+
return {} unless details_extension_exist?
|
45
|
+
|
46
|
+
YAML.load(File.read(reporter_extension_file_path))
|
47
|
+
end
|
48
|
+
|
49
|
+
def details_extension_exist?
|
50
|
+
File.exist?(reporter_extension_file_path)
|
51
|
+
end
|
52
|
+
|
53
|
+
def build_time
|
54
|
+
@build_time ||= Time.now
|
55
|
+
end
|
56
|
+
|
57
|
+
def repo
|
58
|
+
@app.repo
|
59
|
+
end
|
60
|
+
|
61
|
+
def serialize(format)
|
62
|
+
method = "to_#{format}".to_sym
|
63
|
+
|
64
|
+
details.send(method)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'middleman-core'
|
2
|
+
require 'middleman-build-reporter/version'
|
3
|
+
require 'middleman-build-reporter/reporter'
|
4
|
+
|
5
|
+
::Middleman::Extensions.register(:build_reporter) do
|
6
|
+
require 'middleman-build-reporter/extension'
|
7
|
+
|
8
|
+
::Middleman::BuildReporterExtension
|
9
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "middleman-build-reporter"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'middleman-build-reporter/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'middleman-build-reporter'
|
8
|
+
s.version = Middleman::BuildReporter::VERSION
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
|
11
|
+
s.authors = ['Mike Ball']
|
12
|
+
s.email = ['mikedball@gmail.com']
|
13
|
+
s.homepage = 'https://github.com/mdb/middleman-build-reporter'
|
14
|
+
s.summary = %q{Report build time details within your Middleman build}
|
15
|
+
s.description = %q{Report build time details within your Middleman build}
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
20
|
+
s.require_paths = ['lib']
|
21
|
+
|
22
|
+
s.add_runtime_dependency 'middleman-core'
|
23
|
+
s.add_runtime_dependency 'git'
|
24
|
+
|
25
|
+
s.add_development_dependency 'rspec'
|
26
|
+
s.add_development_dependency 'simplecov'
|
27
|
+
s.add_development_dependency 'timecop'
|
28
|
+
s.add_development_dependency 'cucumber'
|
29
|
+
s.add_development_dependency 'aruba'
|
30
|
+
s.add_development_dependency 'fivemat'
|
31
|
+
s.add_development_dependency 'rake'
|
32
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Middleman::BuildReporterExtension do
|
4
|
+
let(:app) { middleman_app('basic-app') }
|
5
|
+
|
6
|
+
let(:extension) { described_class.new(app) }
|
7
|
+
|
8
|
+
context 'its default options' do
|
9
|
+
|
10
|
+
let(:settings) { extension.options.instance_variable_get('@settings') }
|
11
|
+
|
12
|
+
context 'its default repo_root' do
|
13
|
+
|
14
|
+
let(:repo_root) { settings[:repo_root] }
|
15
|
+
|
16
|
+
it 'is nil' do
|
17
|
+
expect(repo_root.default).to be_nil
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'has the correct description' do
|
21
|
+
expect(repo_root.description).to eq 'repo root'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'its default version' do
|
26
|
+
|
27
|
+
let(:version) { settings[:version] }
|
28
|
+
|
29
|
+
it 'is an empty string' do
|
30
|
+
expect(version.default).to eq ''
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'has the correct description' do
|
34
|
+
expect(version.description).to eq 'app version'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'its default reporter file' do
|
39
|
+
|
40
|
+
let(:reporter_file) { settings[:reporter_file] }
|
41
|
+
|
42
|
+
it 'is "build"' do
|
43
|
+
expect(reporter_file.default).to eq 'build'
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'has the correct description' do
|
47
|
+
expect(reporter_file.description).to eq 'build report file name'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'its default reporter file formats' do
|
52
|
+
|
53
|
+
let(:reporter_file_formats) { settings[:reporter_file_formats] }
|
54
|
+
|
55
|
+
it 'they are json and yaml' do
|
56
|
+
expect(reporter_file_formats.default).to eq ['yaml']
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'has the correct description' do
|
60
|
+
expect(reporter_file_formats.description).to eq 'an array of build report file formats'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '#build_report' do
|
66
|
+
|
67
|
+
it 'returns a Middleman::BuildReporter::Reporter instance' do
|
68
|
+
expect(extension.build_report.class).to eq Middleman::BuildReporter::Reporter
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '#after_build' do
|
73
|
+
|
74
|
+
let(:builder) { double('builder', say_status: 'fake status') }
|
75
|
+
|
76
|
+
it 'writes the build report to a file' do
|
77
|
+
allow(extension.build_report).to receive(:write).and_return 'fake_write_result'
|
78
|
+
|
79
|
+
expect(extension.after_build(builder)).to eq 'fake_write_result'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|