middleman-cli 4.1.0.rc.1 → 4.1.0.rc.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a55a47e652b3501db52cdd026f821833d4911ca0
4
- data.tar.gz: 6844c00c8a36b5d6dfce34e8e136a7d38207a1f6
3
+ metadata.gz: f56a6b880d1fd6a68637089f0498e22db06e592c
4
+ data.tar.gz: ef4484d9dd4183e48685bdda817766c87d6247e1
5
5
  SHA512:
6
- metadata.gz: 261e3cfce78e9fbab83d7bf81e157fb3767897fdbbeb11e817f751c8fecbdd7e28bbad52c7b6ea3dbe4a460ec097e9d8f5ff220398e82266c6c7518d00ba8e21
7
- data.tar.gz: bd7734c89384ce59d9457a2e0e9b6bb00ac9eed428849416490f5668c69258205e952051ef6b9a7f0aa2f131297c492b274c9177e7ca04808fbb7698e453478e
6
+ metadata.gz: 9650bb5c122da185f691fd20509c0cbf249fcd5425d4e57e953c51aadd1de6fcc6c2a1d5be9be7ba062005c2d36ae0699a3ea9d64ba99a4eb416f3dead1e9de3
7
+ data.tar.gz: 3f0d0958af6f0c3c2f4d268ac73523890ca196bfcf1c7d86b466f0f53ac88386b79c7dfe6902fa534695ee0393c9e37774037cac0ad68a1903805278588fb569
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
1
  # coding:utf-8
2
- RAKE_ROOT = __FILE__
3
- GEM_NAME = 'middleman-cli'
2
+ RAKE_ROOT = __FILE__.freeze
3
+ GEM_NAME = 'middleman-cli'.freeze
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper')
@@ -0,0 +1,14 @@
1
+ Feature: Middleman New Extension CLI
2
+
3
+ Scenario: Create a new extension scaffold
4
+ Given I run `middleman extension my-extension-library`
5
+ Then the exit status should be 0
6
+ When I cd to "my-extension-library"
7
+ Then the following files should exist:
8
+ | Gemfile |
9
+ | Rakefile |
10
+ | my-extension-library.gemspec |
11
+ | features/support/env.rb |
12
+ | lib/my-extension-library/extension.rb |
13
+ | lib/my-extension-library.rb |
14
+ | .gitignore |
@@ -0,0 +1,93 @@
1
+ Feature: Middleman CLI
2
+
3
+ Scenario: Create a new project
4
+ When I run `middleman init MY_PROJECT` interactively
5
+ And I type "y"
6
+ And I type "y"
7
+ And I type "y"
8
+ And I type "y"
9
+ Then the exit status should be 0
10
+ When I cd to "MY_PROJECT"
11
+ Then the following files should exist:
12
+ | Gemfile |
13
+ | .gitignore |
14
+ | config.rb |
15
+ | source/index.html.erb |
16
+ | source/layouts/layout.erb |
17
+ | source/javascripts/all.js |
18
+ | source/stylesheets/site.css.scss |
19
+ | source/stylesheets/_normalize.scss |
20
+
21
+ Scenario: Create a new project in the current directory
22
+ Given a directory named "MY_PROJECT"
23
+ When I cd to "MY_PROJECT"
24
+ And I run `middleman init` interactively
25
+ And I type "y"
26
+ And I type "y"
27
+ And I type "y"
28
+ And I type "y"
29
+ Then the exit status should be 0
30
+ And the following files should exist:
31
+ | Gemfile |
32
+ | config.rb |
33
+ | source/index.html.erb |
34
+
35
+ Scenario: Create a new project (alias i)
36
+ When I run `middleman i MY_PROJECT` interactively
37
+ And I type "y"
38
+ And I type "y"
39
+ And I type "y"
40
+ And I type "y"
41
+ Then a directory named "MY_PROJECT" should exist
42
+
43
+ Scenario: Create a new project (alias new)
44
+ When I run `middleman new MY_PROJECT` interactively
45
+ And I type "y"
46
+ And I type "y"
47
+ And I type "y"
48
+ And I type "y"
49
+ Then a directory named "MY_PROJECT" should exist
50
+
51
+ Scenario: Create a new project (alias n)
52
+ When I run `middleman n MY_PROJECT` interactively
53
+ And I type "y"
54
+ And I type "y"
55
+ And I type "y"
56
+ And I type "y"
57
+ Then a directory named "MY_PROJECT" should exist
58
+
59
+ Scenario: Create a new project using Middleman directory
60
+ When I run `middleman init MY_PROJECT -T blog`
61
+ Then a directory named "MY_PROJECT" should exist
62
+ When I cd to "MY_PROJECT"
63
+ And the file "Gemfile" should contain "middleman-blog"
64
+ And the file ".gitignore" should exist
65
+
66
+ Scenario: Create an invalid project using Middleman directory
67
+ When I run `middleman init MY_PROJECT -T does-not-exist-for-reals`
68
+ Then the exit status should be 1
69
+
70
+ Scenario: Create a new project using github(user/repository)
71
+ When I run `middleman init MY_PROJECT -T middleman/middleman-templates-default` interactively
72
+ And I type "y"
73
+ And I type "y"
74
+ And I type "y"
75
+ And I type "y"
76
+ Then a directory named "MY_PROJECT" should exist
77
+
78
+ Scenario: Create a new project using github(user/repository#branch)
79
+ When I run `middleman init MY_PROJECT -T middleman/middleman-templates-default#master` interactively
80
+ And I type "y"
81
+ And I type "y"
82
+ And I type "y"
83
+ And I type "y"
84
+ Then a directory named "MY_PROJECT" should exist
85
+ And the output should contain "-b master"
86
+
87
+ Scenario: Create a new project using full path(://)
88
+ When I run `middleman init MY_PROJECT -T https://github.com/middleman/middleman-templates-default.git` interactively
89
+ And I type "y"
90
+ And I type "y"
91
+ And I type "y"
92
+ And I type "y"
93
+ Then a directory named "MY_PROJECT" should exist
@@ -0,0 +1,17 @@
1
+ Feature: Run preview server before hook
2
+
3
+ Scenario: When run
4
+ Given a fixture app "preview-server-hook-app"
5
+ And the default aruba timeout is 30 seconds
6
+ When I run `middleman server --server-name localhost --bind-address 127.0.0.1` interactively
7
+ And I stop middleman if the output contains:
8
+ """
9
+ ### END ###
10
+ """
11
+ Then the output should contain:
12
+ """
13
+ /// 127.0.0.1:4567 ///
14
+ /// 4567 ///
15
+ /// localhost ///
16
+ /// http://localhost:4567 ///
17
+ """
@@ -0,0 +1,536 @@
1
+ Feature: Run the preview server
2
+
3
+ As a software developer
4
+ I want to start the preview server
5
+ In order to view my changes immediately in the browser
6
+
7
+ Background:
8
+ Given a fixture app "preview-server-app"
9
+ And the default aruba timeout is 30 seconds
10
+
11
+ Scenario: Start the server with defaults
12
+ When I run `middleman server` interactively
13
+ And I stop middleman if the output contains:
14
+ """
15
+ Inspect your site configuration
16
+ """
17
+ And the output should contain:
18
+ """
19
+ View your site at "http://
20
+ """
21
+ And the output should contain:
22
+ """
23
+ Inspect your site configuration at "http://
24
+ """
25
+
26
+ Scenario: Start the server with defaults in verbose mode
27
+ When I run `middleman server --verbose` interactively
28
+ And I stop middleman if the output contains:
29
+ """
30
+ Inspect your site configuration
31
+ """
32
+ Then the output should contain:
33
+ """
34
+ The Middleman preview server is bound to ":::4567", "0.0.0.0:4567"
35
+ """
36
+ And the output should contain:
37
+ """
38
+ View your site at "http://
39
+ """
40
+ And the output should contain:
41
+ """
42
+ Inspect your site configuration at "http://
43
+ """
44
+
45
+ @wip
46
+ Scenario: Start the server with defaults in verbose mode, when a local mdns server resolves the local hostname
47
+ Given I start a mdns server for the local hostname
48
+ When I run `middleman server --verbose` interactively
49
+ And I stop middleman if the output contains:
50
+ """
51
+ Inspect your site configuration
52
+ """
53
+ Then the output should contain:
54
+ """
55
+ The Middleman preview server is bound to ":::4567", "0.0.0.0:4567"
56
+ """
57
+ And the output should contain:
58
+ """
59
+ View your site at "http://
60
+ """
61
+ And the output should contain:
62
+ """
63
+ Inspect your site configuration at "http://
64
+ """
65
+
66
+ Scenario: Start the server with bind address 127.0.0.1
67
+ Given I have a local hosts file with:
68
+ """
69
+ # <ip-address> <hostname.domain.org> <hostname>
70
+ 127.0.0.1 localhost.localdomain localhost
71
+ """
72
+ When I run `middleman server --verbose --bind-address 127.0.0.1` interactively
73
+ And I stop middleman if the output contains:
74
+ """
75
+ Inspect your site configuration
76
+ """
77
+ Then the output should contain:
78
+ """
79
+ The Middleman preview server is bound to "127.0.0.1:4567"
80
+ """
81
+ And the output should contain:
82
+ """
83
+ View your site at "http://127.0.0.1:4567"
84
+ """
85
+ And the output should contain:
86
+ """
87
+ Inspect your site configuration at "http://127.0.0.1:4567/__middleman"
88
+ """
89
+
90
+ Scenario: Start the server with bind address 127.0.0.1 configured via config.rb
91
+ Given I have a local hosts file with:
92
+ """
93
+ # <ip-address> <hostname.domain.org> <hostname>
94
+ 127.0.0.1 localhost.localdomain localhost
95
+ """
96
+ And a file named "config.rb" with:
97
+ """
98
+ set :bind_address, '127.0.0.1'
99
+ """
100
+ When I run `middleman server --verbose` interactively
101
+ And I stop middleman if the output contains:
102
+ """
103
+ Inspect your site configuration
104
+ """
105
+ Then the output should contain:
106
+ """
107
+ The Middleman preview server is bound to "127.0.0.1:4567"
108
+ """
109
+ And the output should contain:
110
+ """
111
+ View your site at "http://127.0.0.1:4567"
112
+ """
113
+ And the output should contain:
114
+ """
115
+ Inspect your site configuration at "http://127.0.0.1:4567/__middleman"
116
+ """
117
+
118
+ @wip
119
+ Scenario: Start the server with bind address 127.0.0.5
120
+
121
+ This will have no hostname attached because the hosts file, the DNS server
122
+ and the MDNS-server do not know anything about 127.0.0.5
123
+
124
+ When I run `middleman server --verbose --bind-address 127.0.0.5` interactively
125
+ And I stop middleman if the output contains:
126
+ """
127
+ Inspect your site configuration
128
+ """
129
+ Then the output should contain:
130
+ """
131
+ The Middleman preview server is bound to "127.0.0.5:4567"
132
+ """
133
+ And the output should contain:
134
+ """
135
+ View your site at "http://127.0.0.5:4567"
136
+ """
137
+ And the output should contain:
138
+ """
139
+ Inspect your site configuration at "http://127.0.0.5:4567/__middleman"
140
+ """
141
+
142
+ Scenario: Start the server with bind address ::1
143
+ Given a file named ".hosts" with:
144
+ """
145
+ # <ip-address> <hostname.domain.org> <hostname>
146
+ ::1 localhost.localdomain localhost
147
+ """
148
+ When I run `middleman server --verbose --bind-address ::1` interactively
149
+ And I stop middleman if the output contains:
150
+ """
151
+ Inspect your site configuration
152
+ """
153
+ Then the output should contain:
154
+ """
155
+ The Middleman preview server is bound to "::1:4567"
156
+ """
157
+ And the output should contain:
158
+ """
159
+ View your site at "http://[::1]:4567"
160
+ """
161
+ And the output should contain:
162
+ """
163
+ Inspect your site configuration at "http://[::1]:4567/__middleman"
164
+ """
165
+
166
+ Scenario: Start the server with bind address 0.0.0.0
167
+ When I run `middleman server --verbose --bind-address 0.0.0.0` interactively
168
+ And I stop middleman if the output contains:
169
+ """
170
+ Inspect your site configuration
171
+ """
172
+ Then the output should contain:
173
+ """
174
+ The Middleman preview server is bound to "0.0.0.0:4567"
175
+ """
176
+ And the output should contain:
177
+ """
178
+ View your site at "http://
179
+ """
180
+ And the output should contain:
181
+ """
182
+ Inspect your site configuration at "http://
183
+ """
184
+
185
+ Scenario: Start the server with bind address ::
186
+ When I run `middleman server --verbose --bind-address ::` interactively
187
+ And I stop middleman if the output contains:
188
+ """
189
+ Inspect your site configuration
190
+ """
191
+ Then the output should contain:
192
+ """
193
+ The Middleman preview server is bound to ":::4567"
194
+ """
195
+ And the output should contain:
196
+ """
197
+ View your site at "http://
198
+ """
199
+ And the output should contain:
200
+ """
201
+ Inspect your site configuration at "http://
202
+ """
203
+
204
+ Scenario: Start the server with server name "localhost"
205
+ Given I have a local hosts file with:
206
+ """
207
+ # <ip-address> <hostname.domain.org> <hostname>
208
+ 127.0.0.1 localhost.localdomain localhost
209
+ """
210
+ When I run `middleman server --verbose --server-name localhost` interactively
211
+ And I stop middleman if the output contains:
212
+ """
213
+ Inspect your site configuration
214
+ """
215
+ Then the output should contain:
216
+ """
217
+ The Middleman preview server is bound to "127.0.0.1:4567"
218
+ """
219
+ And the output should contain:
220
+ """
221
+ View your site at "http://localhost:4567", "http://127.0.0.1:4567"
222
+ """
223
+ And the output should contain:
224
+ """
225
+ Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
226
+ """
227
+
228
+ Scenario: Start the server with server name "localhost" configured via config.rb
229
+ Given I have a local hosts file with:
230
+ """
231
+ # <ip-address> <hostname.domain.org> <hostname>
232
+ 127.0.0.1 localhost.localdomain localhost
233
+ """
234
+ And a file named "config.rb" with:
235
+ """
236
+ set :server_name, 'localhost'
237
+ """
238
+ When I run `middleman server --verbose` interactively
239
+ And I stop middleman if the output contains:
240
+ """
241
+ Inspect your site configuration
242
+ """
243
+ Then the output should contain:
244
+ """
245
+ The Middleman preview server is bound to "127.0.0.1:4567"
246
+ """
247
+ And the output should contain:
248
+ """
249
+ View your site at "http://localhost:4567", "http://127.0.0.1:4567"
250
+ """
251
+ And the output should contain:
252
+ """
253
+ Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
254
+ """
255
+
256
+ Scenario: Start the server with server name "localhost" and bind address "127.0.0.1"
257
+ Given I have a local hosts file with:
258
+ """
259
+ # <ip-address> <hostname.domain.org> <hostname>
260
+ 127.0.0.1 localhost.localdomain localhost
261
+ """
262
+ When I run `middleman server --verbose --server-name localhost --bind-address 127.0.0.1` interactively
263
+ And I stop middleman if the output contains:
264
+ """
265
+ Inspect your site configuration
266
+ """
267
+ Then the output should contain:
268
+ """
269
+ The Middleman preview server is bound to "127.0.0.1:4567"
270
+ """
271
+ And the output should contain:
272
+ """
273
+ View your site at "http://localhost:4567", "http://127.0.0.1:4567"
274
+ """
275
+ And the output should contain:
276
+ """
277
+ Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
278
+ """
279
+
280
+ Scenario: Start the server with server name "127.0.0.1"
281
+ When I run `middleman server --verbose --server-name 127.0.0.1` interactively
282
+ And I stop middleman if the output contains:
283
+ """
284
+ Inspect your site configuration
285
+ """
286
+ Then the output should contain:
287
+ """
288
+ The Middleman preview server is bound to "127.0.0.1:4567"
289
+ """
290
+ And the output should contain:
291
+ """
292
+ View your site at "http://127.0.0.1:4567"
293
+ """
294
+ And the output should contain:
295
+ """
296
+ Inspect your site configuration at "http://127.0.0.1:4567/__middleman"
297
+ """
298
+
299
+ Scenario: Start the server with server name "::1"
300
+ When I run `middleman server --verbose --server-name ::1` interactively
301
+ And I stop middleman if the output contains:
302
+ """
303
+ Inspect your site configuration
304
+ """
305
+ Then the output should contain:
306
+ """
307
+ The Middleman preview server is bound to "::1:4567"
308
+ """
309
+ And the output should contain:
310
+ """
311
+ View your site at "http://[::1]:4567"
312
+ """
313
+ And the output should contain:
314
+ """
315
+ Inspect your site configuration at "http://[::1]:4567/__middleman"
316
+ """
317
+
318
+ Scenario: Start the server with https
319
+ When I run `middleman server --verbose --https` interactively
320
+ And I stop middleman if the output contains:
321
+ """
322
+ Inspect your site configuration
323
+ """
324
+ Then the output should contain:
325
+ """
326
+ The Middleman preview server is bound to ":::4567", "0.0.0.0:4567"
327
+ """
328
+ And the output should contain:
329
+ """
330
+ View your site at "https://
331
+ """
332
+ And the output should contain:
333
+ """
334
+ Inspect your site configuration at "https://
335
+ """
336
+
337
+ Scenario: Start the server with port 65432
338
+ When I run `middleman server --verbose --port 65432` interactively
339
+ And I stop middleman if the output contains:
340
+ """
341
+ Inspect your site configuration
342
+ """
343
+ Then the output should contain:
344
+ """
345
+ The Middleman preview server is bound to ":::65432", "0.0.0.0:65432"
346
+ """
347
+
348
+ Scenario: Start the server with port 65432 configured via config.rb
349
+ Given a file named "config.rb" with:
350
+ """
351
+ set :port, 65432
352
+ """
353
+ When I run `middleman server --verbose` interactively
354
+ And I stop middleman if the output contains:
355
+ """
356
+ Inspect your site configuration
357
+ """
358
+ Then the output should contain:
359
+ """
360
+ The Middleman preview server is bound to ":::65432", "0.0.0.0:65432"
361
+ """
362
+
363
+ @wip
364
+ Scenario: Start the server when port is blocked by other middleman instance
365
+ Given `middleman server` is running in background
366
+ When I run `middleman server --verbose` interactively
367
+ And I stop all commands if the output of the last command contains:
368
+ """
369
+ Inspect your site configuration
370
+ """
371
+ Then the output should contain:
372
+ """
373
+ The Middleman uses a different port
374
+ """
375
+
376
+ Scenario: Start the server with bind address 1.1.1.1
377
+
378
+ This should fail, because "1.1.1.1" is not an interface available on this computer.
379
+
380
+ Given a file named ".hosts" with:
381
+ """
382
+ 1.1.1.1 www.example.com www
383
+ """
384
+ When I run `middleman server --verbose --bind-address 1.1.1.1` interactively
385
+ And I stop middleman if the output contains:
386
+ """
387
+ Running Middleman failed:
388
+ """
389
+ Then the output should contain:
390
+ """
391
+ Bind address "1.1.1.1" is not available on your system
392
+ """
393
+
394
+ Scenario: Start the server with server name www.example.com and bind address 0.0.0.0
395
+
396
+ This should fail, because the user can just use `--server-name`. It does
397
+ not make sense for `middleman` to only listen on `0.0.0.0` (IPv4 all
398
+ interfaces), but not on `::` (IPv6 all interfaces). There are other tools
399
+ like `iptables` (Linux-only) or better some `kernel`-configurations to make
400
+ this possible.
401
+
402
+ When I run `middleman server --verbose --server-name www.example.com --bind-address 0.0.0.0` interactively
403
+ And I stop middleman if the output contains:
404
+ """
405
+ Running Middleman failed:
406
+ """
407
+ Then the output should contain:
408
+ """
409
+ Undefined combination of options "--server-name" and "--bind-address".
410
+ """
411
+
412
+ Scenario: Start the server with server name "www.example.com" and bind address "127.0.0.1"
413
+
414
+ This should fail because the server name does not resolve to the ip address.
415
+
416
+ Given a file named ".hosts" with:
417
+ """
418
+ 1.1.1.1 www.example.com www
419
+ """
420
+ When I run `middleman server --verbose --server-name www.example.com --bind-address 127.0.0.1` interactively
421
+ And I stop middleman if the output contains:
422
+ """
423
+ Running Middleman failed:
424
+ """
425
+ Then the output should contain:
426
+ """
427
+ Server name "www.example.com" does not resolve to bind address "127.0.0.1". Please fix that and try again.
428
+ """
429
+
430
+ Scenario: Start the server with server name "garbage.example.com"
431
+ When I run `middleman server --verbose --server-name garbage.example.com` interactively
432
+ And I stop middleman if the output contains:
433
+ """
434
+ Running Middleman failed:
435
+ """
436
+ Then the output should contain:
437
+ """
438
+ Server name "garbage.example.com" does not resolve to an ip address. Please fix that and try again.
439
+ """
440
+
441
+ Scenario: Start the server with server name "www.example.com" and the network name server is used to resolve the server name
442
+ Given I have a local hosts file with:
443
+ """
444
+ # empty
445
+ """
446
+ And I start a mdns server with:
447
+ """
448
+ # empty
449
+ """
450
+ And I start a dns server with:
451
+ """
452
+ www.example.com: 127.0.0.1
453
+ """
454
+ When I run `middleman server --verbose --server-name www.example.com` interactively
455
+ And I stop middleman if the output contains:
456
+ """
457
+ Inspect your site configuration
458
+ """
459
+ Then the output should contain:
460
+ """
461
+ The Middleman preview server is bound to "127.0.0.1:4567"
462
+ """
463
+ And the output should contain:
464
+ """
465
+ View your site at "http://www.example.com:4567", "http://127.0.0.1:4567"
466
+ """
467
+ And the output should contain:
468
+ """
469
+ Inspect your site configuration at "http://www.example.com:4567/__middleman", "http://127.0.0.1:4567/__middleman"
470
+ """
471
+
472
+ @ruby-2.1
473
+ @wip
474
+ Scenario: Start the server with server name "host.local" and the link local name server is used to resolve the server name
475
+
476
+ To make the mdns resolver resolve a name, it needs to end with ".local".
477
+ Otherwise the resolver returns [].
478
+
479
+ Given I have a local hosts file with:
480
+ """
481
+ # empty
482
+ """
483
+ And I start a mdns server with:
484
+ """
485
+ host.local: 127.0.0.1
486
+ """
487
+ When I run `middleman server --verbose --server-name host.local` interactively
488
+ And I stop middleman if the output contains:
489
+ """
490
+ Inspect your site configuration
491
+ """
492
+ Then the output should contain:
493
+ """
494
+ The Middleman preview server is bound to "127.0.0.1:4567"
495
+ """
496
+ And the output should contain:
497
+ """
498
+ View your site at "http://host.local:4567", "http://127.0.0.1:4567"
499
+ """
500
+ And the output should contain:
501
+ """
502
+ Inspect your site configuration at "http://host.local:4567/__middleman", "http://127.0.0.1:4567/__middleman"
503
+ """
504
+
505
+ @ruby-2.1
506
+ @wip
507
+ Scenario: Start the server with server name "host" and the link local name server is used to resolve the server name
508
+
509
+ To make the mdns resolver resolve a name, it needs to end with ".local". If
510
+ a plain hostname is given `middleman` appends ".local" automatically.
511
+
512
+ Given I have a local hosts file with:
513
+ """
514
+ # empty
515
+ """
516
+ And I start a mdns server with:
517
+ """
518
+ host.local: 127.0.0.1
519
+ """
520
+ When I run `middleman server --verbose --server-name host` interactively
521
+ And I stop middleman if the output contains:
522
+ """
523
+ Inspect your site configuration
524
+ """
525
+ Then the output should contain:
526
+ """
527
+ The Middleman preview server is bound to "127.0.0.1:4567"
528
+ """
529
+ And the output should contain:
530
+ """
531
+ View your site at "http://host.local:4567", "http://127.0.0.1:4567"
532
+ """
533
+ And the output should contain:
534
+ """
535
+ Inspect your site configuration at "http://host.local:4567/__middleman", "http://127.0.0.1:4567/__middleman"
536
+ """
@@ -0,0 +1,19 @@
1
+ ENV["TEST"] = "true"
2
+
3
+ require 'sassc'
4
+
5
+ require 'simplecov'
6
+ SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/../..'))
7
+
8
+ require 'phantomjs/poltergeist'
9
+ Capybara.javascript_driver = :poltergeist
10
+
11
+ require 'coveralls'
12
+ Coveralls.wear!
13
+
14
+ require 'codeclimate-test-reporter'
15
+ CodeClimate::TestReporter.start
16
+
17
+ PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
18
+ require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-cli')
19
+ require File.join(File.dirname(PROJECT_ROOT_PATH), 'middleman-core', 'lib', 'middleman-core', 'step_definitions')
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubydns'
4
+ require 'psych'
5
+
6
+ db_file = ARGV[0]
7
+ port = ARGV[1] || 5300
8
+
9
+ db = if File.file? db_file
10
+ $stderr.puts 'Found dns db'
11
+ Psych.load_file(db_file)
12
+ else
13
+ $stderr.puts 'Found no dns db. Use default db.'
14
+
15
+ {
16
+ /www\.example\.org/ => '1.1.1.1'
17
+ }
18
+ end
19
+
20
+ interfaces = [
21
+ [:udp, "127.0.0.1", port],
22
+ [:tcp, "127.0.0.1", port]
23
+ ]
24
+
25
+
26
+ # Start the RubyDNS server
27
+ RubyDNS::run_server(listen: interfaces) do
28
+ db.each do |matcher, result|
29
+ match(matcher, Resolv::DNS::Resource::IN::A) do |transaction|
30
+ transaction.respond!(result)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1 @@
1
+ <h1>Welcome</h1>
@@ -0,0 +1,9 @@
1
+ <html>
2
+ <head>
3
+ <title>My Sample Site</title>
4
+ <!-- Comment in layout -->
5
+ </head>
6
+ <body>
7
+ <%= yield %>
8
+ </body>
9
+ </html>
@@ -0,0 +1,8 @@
1
+ <html>
2
+ <head>
3
+ <title>Custom Layout</title>
4
+ </head>
5
+ <body>
6
+ <%= yield %>
7
+ </body>
8
+ </html>
@@ -0,0 +1,5 @@
1
+ ---
2
+ layout: false
3
+ ---
4
+
5
+ I am real: <%= @num %>
@@ -0,0 +1 @@
1
+ <h1>Ignore me! 2</h1>
@@ -0,0 +1 @@
1
+ <h1>Ignore me! 3</h1>
@@ -0,0 +1 @@
1
+ Static, no code!
@@ -0,0 +1,19 @@
1
+ set :layout, false
2
+
3
+ class MyFeature < Middleman::Extension
4
+ def initialize(app, options_hash = {}, &block)
5
+ super
6
+
7
+ app.before_server do |server_information|
8
+ puts "/// #{server_information.listeners.first} ///"
9
+ puts "/// #{server_information.port} ///"
10
+ puts "/// #{server_information.server_name} ///"
11
+ puts "/// #{server_information.site_addresses.first} ///"
12
+ puts "/// ### END ### ///"
13
+ end
14
+ end
15
+ end
16
+
17
+ ::Middleman::Extensions.register(:my_feature, MyFeature)
18
+
19
+ activate :my_feature
@@ -0,0 +1,9 @@
1
+ <html>
2
+ <head>
3
+ <meta charset="utf-8">
4
+ <title>preview-server-hook-app</title>
5
+ </head>
6
+ <body>
7
+ <h1>preview-server-hook-app</h1>
8
+ </body>
9
+ </html>
@@ -48,31 +48,38 @@ module Middleman::Cli
48
48
  verbose = options['verbose'] ? 0 : 1
49
49
  instrument = options['instrument']
50
50
 
51
- @app = ::Middleman::Application.new do
52
- config[:mode] = :build
53
- config[:environment] = env
54
- config[:show_exceptions] = false
55
- ::Middleman::Logger.singleton(verbose, instrument)
56
- end
51
+ builder = nil
57
52
 
58
- builder = Middleman::Builder.new(@app,
59
- glob: options['glob'],
60
- clean: options['clean'],
61
- parallel: options['parallel'])
62
- builder.thor = self
63
- builder.on_build_event(&method(:on_event))
53
+ ::Middleman::Logger.singleton(verbose, instrument)
64
54
 
65
- if builder.run!
66
- clean_directories! if options['clean']
67
- shell.say 'Project built successfully.'
68
- else
69
- msg = 'There were errors during this build'
70
- unless options['verbose']
71
- msg << ', re-run with `middleman build --verbose` to see the full exception.'
55
+ ::Middleman::Util.instrument 'builder_setup' do
56
+ @app = ::Middleman::Application.new do
57
+ config[:mode] = :build
58
+ config[:environment] = env
59
+ config[:show_exceptions] = false
72
60
  end
73
- shell.say msg, :red
74
61
 
75
- exit(1)
62
+ builder = Middleman::Builder.new(@app,
63
+ glob: options['glob'],
64
+ clean: options['clean'],
65
+ parallel: options['parallel'])
66
+ builder.thor = self
67
+ builder.on_build_event(&method(:on_event))
68
+ end
69
+
70
+ ::Middleman::Util.instrument 'builder_run' do
71
+ if builder.run!
72
+ clean_directories! if options['clean']
73
+ shell.say 'Project built successfully.'
74
+ else
75
+ msg = 'There were errors during this build'
76
+ unless options['verbose']
77
+ msg << ', re-run with `middleman build --verbose` to see the full exception.'
78
+ end
79
+ shell.say msg, :red
80
+
81
+ exit(1)
82
+ end
76
83
  end
77
84
  end
78
85
 
@@ -4,6 +4,8 @@ module Middleman::Cli
4
4
  class Init < Thor::Group
5
5
  include Thor::Actions
6
6
 
7
+ GIT_CMD = 'git'.freeze
8
+
7
9
  check_unknown_options!
8
10
 
9
11
  argument :target, type: :string, default: '.'
@@ -25,6 +27,13 @@ module Middleman::Cli
25
27
  require 'fileutils'
26
28
  require 'tmpdir'
27
29
 
30
+ unless git_present?
31
+ msg = 'You need to install the git command line tool to initialize a new project. '
32
+ msg << "For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git"
33
+ say msg, :red
34
+ exit 1
35
+ end
36
+
28
37
  repo_path, repo_branch = if shortname?(options[:template])
29
38
  require 'open-uri'
30
39
  require 'json'
@@ -51,10 +60,11 @@ module Middleman::Cli
51
60
  begin
52
61
  branch_cmd = repo_branch ? "-b #{repo_branch} " : ''
53
62
 
54
- run("git clone --depth 1 #{branch_cmd}#{repo_path} #{dir}")
63
+ git_path = "#{branch_cmd}#{repo_path}"
64
+ run("#{GIT_CMD} clone --depth 1 #{branch_cmd}#{repo_path} #{dir}")
55
65
 
56
- unless File.directory?(dir)
57
- say 'Git clone failed, maybe the url is invalid or you don\'t have the permissions?', :red
66
+ unless $?.success?
67
+ say "Git clone command failed. Make sure git repository exists: #{git_path}", :red
58
68
  exit 1
59
69
  end
60
70
 
@@ -79,6 +89,25 @@ module Middleman::Cli
79
89
 
80
90
  protected
81
91
 
92
+ # Copied from Bundler
93
+ def git_present?
94
+ return @git_present if defined?(@git_present)
95
+ @git_present = which(GIT_CMD) || which('git.exe')
96
+ end
97
+
98
+ # Copied from Bundler
99
+ def which(executable)
100
+ if File.file?(executable) && File.executable?(executable)
101
+ executable
102
+ elsif ENV['PATH']
103
+ path = ENV['PATH'].split(File::PATH_SEPARATOR).find do |p|
104
+ abs_path = File.join(p, executable)
105
+ File.file?(abs_path) && File.executable?(abs_path)
106
+ end
107
+ path && File.expand_path(executable, path)
108
+ end
109
+ end
110
+
82
111
  def shortname?(repo)
83
112
  repo.split('/').length == 1
84
113
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0.rc.1
4
+ version: 4.1.0.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-11 00:00:00.000000000 Z
12
+ date: 2016-01-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -47,8 +47,24 @@ files:
47
47
  - ".yardopts"
48
48
  - Rakefile
49
49
  - bin/middleman
50
- - features/.gitkeep
51
- - fixtures/.gitkeep
50
+ - features/cli_extension.feature
51
+ - features/cli_init.feature
52
+ - features/preview_server-hook.feature
53
+ - features/preview_server.feature
54
+ - features/support/env.rb
55
+ - fixtures/preview-server-app/bin/dns_server.rb
56
+ - fixtures/preview-server-app/config.rb
57
+ - fixtures/preview-server-app/source/index.html.erb
58
+ - fixtures/preview-server-app/source/layout.erb
59
+ - fixtures/preview-server-app/source/layouts/custom.erb
60
+ - fixtures/preview-server-app/source/real.html
61
+ - fixtures/preview-server-app/source/real/index.html.erb
62
+ - fixtures/preview-server-app/source/should_be_ignored.html
63
+ - fixtures/preview-server-app/source/should_be_ignored2.html
64
+ - fixtures/preview-server-app/source/should_be_ignored3.html
65
+ - fixtures/preview-server-app/source/static.html
66
+ - fixtures/preview-server-hook-app/config.rb
67
+ - fixtures/preview-server-hook-app/source/index.html.erb
52
68
  - lib/middleman-cli.rb
53
69
  - lib/middleman-cli/build.rb
54
70
  - lib/middleman-cli/config.rb
@@ -92,6 +108,22 @@ signing_key:
92
108
  specification_version: 4
93
109
  summary: Hand-crafted frontend development
94
110
  test_files:
95
- - features/.gitkeep
96
- - fixtures/.gitkeep
111
+ - features/cli_extension.feature
112
+ - features/cli_init.feature
113
+ - features/preview_server-hook.feature
114
+ - features/preview_server.feature
115
+ - features/support/env.rb
116
+ - fixtures/preview-server-app/bin/dns_server.rb
117
+ - fixtures/preview-server-app/config.rb
118
+ - fixtures/preview-server-app/source/index.html.erb
119
+ - fixtures/preview-server-app/source/layout.erb
120
+ - fixtures/preview-server-app/source/layouts/custom.erb
121
+ - fixtures/preview-server-app/source/real.html
122
+ - fixtures/preview-server-app/source/real/index.html.erb
123
+ - fixtures/preview-server-app/source/should_be_ignored.html
124
+ - fixtures/preview-server-app/source/should_be_ignored2.html
125
+ - fixtures/preview-server-app/source/should_be_ignored3.html
126
+ - fixtures/preview-server-app/source/static.html
127
+ - fixtures/preview-server-hook-app/config.rb
128
+ - fixtures/preview-server-hook-app/source/index.html.erb
97
129
  has_rdoc:
File without changes