middleman-cli 4.6.1 → 5.0.0.rc.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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.simplecov +5 -2
  3. data/.yardopts +6 -2
  4. data/Rakefile +1 -1
  5. data/bin/middleman +8 -11
  6. data/lib/middleman-cli/build.rb +45 -10
  7. data/lib/middleman-cli/extension.rb +0 -1
  8. data/lib/middleman-cli/init.rb +54 -35
  9. data/lib/middleman-cli/templates/extension/Gemfile +1 -1
  10. data/lib/middleman-cli/templates/extension/Rakefile +1 -1
  11. data/lib/middleman-cli/templates/extension/gemspec +2 -2
  12. data/lib/middleman-cli/templates/extension/lib/lib/extension.rb +1 -1
  13. data/lib/middleman-cli/templates/extension/lib/lib.rb +1 -1
  14. data/lib/middleman-cli.rb +1 -1
  15. data/middleman-cli.gemspec +7 -7
  16. metadata +13 -48
  17. data/features/cli_extension.feature +0 -14
  18. data/features/cli_init.feature +0 -92
  19. data/features/preview_server-hook.feature +0 -17
  20. data/features/preview_server.feature +0 -535
  21. data/features/support/env.rb +0 -12
  22. data/fixtures/preview-server-app/bin/dns_server.rb +0 -33
  23. data/fixtures/preview-server-app/source/index.html.erb +0 -1
  24. data/fixtures/preview-server-app/source/layout.erb +0 -9
  25. data/fixtures/preview-server-app/source/layouts/custom.erb +0 -8
  26. data/fixtures/preview-server-app/source/real/index.html.erb +0 -5
  27. data/fixtures/preview-server-app/source/real.html +0 -1
  28. data/fixtures/preview-server-app/source/should_be_ignored.html +0 -1
  29. data/fixtures/preview-server-app/source/should_be_ignored2.html +0 -1
  30. data/fixtures/preview-server-app/source/should_be_ignored3.html +0 -1
  31. data/fixtures/preview-server-app/source/static.html +0 -1
  32. data/fixtures/preview-server-hook-app/config.rb +0 -19
  33. data/fixtures/preview-server-hook-app/source/index.html.erb +0 -9
  34. /data/{fixtures/preview-server-app/config.rb → .gemtest} +0 -0
@@ -1,17 +0,0 @@
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 exit 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
- """
@@ -1,535 +0,0 @@
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 exit 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
- @wip
143
- Scenario: Start the server with bind address ::1
144
- Given a file named ".hosts" with:
145
- """
146
- # <ip-address> <hostname.domain.org> <hostname>
147
- ::1 localhost.localdomain localhost
148
- """
149
- When I run `middleman server --verbose --bind-address ::1` interactively
150
- And I stop middleman if the output contains:
151
- """
152
- Inspect your site configuration
153
- """
154
- Then the output should contain:
155
- """
156
- The Middleman preview server is bound to "::1:4567"
157
- """
158
- And the output should contain:
159
- """
160
- View your site at "http://[::1]:4567"
161
- """
162
- And the output should contain:
163
- """
164
- Inspect your site configuration at "http://[::1]:4567/__middleman"
165
- """
166
-
167
- Scenario: Start the server with bind address 0.0.0.0
168
- When I run `middleman server --verbose --bind-address 0.0.0.0` interactively
169
- And I stop middleman if the output contains:
170
- """
171
- Inspect your site configuration
172
- """
173
- Then the output should contain:
174
- """
175
- The Middleman preview server is bound to "0.0.0.0:4567"
176
- """
177
- And the output should contain:
178
- """
179
- View your site at "http://
180
- """
181
- And the output should contain:
182
- """
183
- Inspect your site configuration at "http://
184
- """
185
-
186
- Scenario: Start the server with bind address ::
187
- When I run `middleman server --verbose --bind-address ::` interactively
188
- And I stop middleman if the output contains:
189
- """
190
- Inspect your site configuration
191
- """
192
- Then the output should contain:
193
- """
194
- The Middleman preview server is bound to ":::4567"
195
- """
196
- And the output should contain:
197
- """
198
- View your site at "http://
199
- """
200
- And the output should contain:
201
- """
202
- Inspect your site configuration at "http://
203
- """
204
-
205
- Scenario: Start the server with server name "localhost"
206
- Given I have a local hosts file with:
207
- """
208
- # <ip-address> <hostname.domain.org> <hostname>
209
- 127.0.0.1 localhost.localdomain localhost
210
- """
211
- When I run `middleman server --verbose --server-name localhost` interactively
212
- And I stop middleman if the output contains:
213
- """
214
- Inspect your site configuration
215
- """
216
- Then the output should contain:
217
- """
218
- The Middleman preview server is bound to "127.0.0.1:4567"
219
- """
220
- And the output should contain:
221
- """
222
- View your site at "http://localhost:4567", "http://127.0.0.1:4567"
223
- """
224
- And the output should contain:
225
- """
226
- Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
227
- """
228
-
229
- Scenario: Start the server with server name "localhost" configured via config.rb
230
- Given I have a local hosts file with:
231
- """
232
- # <ip-address> <hostname.domain.org> <hostname>
233
- 127.0.0.1 localhost.localdomain localhost
234
- """
235
- And a file named "config.rb" with:
236
- """
237
- set :server_name, 'localhost'
238
- """
239
- When I run `middleman server --verbose` interactively
240
- And I stop middleman if the output contains:
241
- """
242
- Inspect your site configuration
243
- """
244
- Then the output should contain:
245
- """
246
- The Middleman preview server is bound to "127.0.0.1:4567"
247
- """
248
- And the output should contain:
249
- """
250
- View your site at "http://localhost:4567", "http://127.0.0.1:4567"
251
- """
252
- And the output should contain:
253
- """
254
- Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
255
- """
256
-
257
- Scenario: Start the server with server name "localhost" and bind address "127.0.0.1"
258
- Given I have a local hosts file with:
259
- """
260
- # <ip-address> <hostname.domain.org> <hostname>
261
- 127.0.0.1 localhost.localdomain localhost
262
- """
263
- When I run `middleman server --verbose --server-name localhost --bind-address 127.0.0.1` interactively
264
- And I stop middleman if the output contains:
265
- """
266
- Inspect your site configuration
267
- """
268
- Then the output should contain:
269
- """
270
- The Middleman preview server is bound to "127.0.0.1:4567"
271
- """
272
- And the output should contain:
273
- """
274
- View your site at "http://localhost:4567", "http://127.0.0.1:4567"
275
- """
276
- And the output should contain:
277
- """
278
- Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
279
- """
280
-
281
- Scenario: Start the server with server name "127.0.0.1"
282
- When I run `middleman server --verbose --server-name 127.0.0.1` interactively
283
- And I stop middleman if the output contains:
284
- """
285
- Inspect your site configuration
286
- """
287
- Then the output should contain:
288
- """
289
- The Middleman preview server is bound to "127.0.0.1:4567"
290
- """
291
- And the output should contain:
292
- """
293
- View your site at "http://127.0.0.1:4567"
294
- """
295
- And the output should contain:
296
- """
297
- Inspect your site configuration at "http://127.0.0.1:4567/__middleman"
298
- """
299
-
300
- Scenario: Start the server with server name "::1"
301
- When I run `middleman server --verbose --server-name ::1` interactively
302
- And I stop middleman if the output contains:
303
- """
304
- Inspect your site configuration
305
- """
306
- Then the output should contain:
307
- """
308
- The Middleman preview server is bound to "::1:4567"
309
- """
310
- And the output should contain:
311
- """
312
- View your site at "http://[::1]:4567"
313
- """
314
- And the output should contain:
315
- """
316
- Inspect your site configuration at "http://[::1]:4567/__middleman"
317
- """
318
-
319
- Scenario: Start the server with https
320
- When I run `middleman server --verbose --https` interactively
321
- And I stop middleman if the output contains:
322
- """
323
- Inspect your site configuration
324
- """
325
- Then the output should contain:
326
- """
327
- The Middleman preview server is bound to ":::4567", "0.0.0.0:4567"
328
- """
329
- And the output should contain:
330
- """
331
- View your site at "https://
332
- """
333
- And the output should contain:
334
- """
335
- Inspect your site configuration at "https://
336
- """
337
-
338
- Scenario: Start the server with port 65432
339
- When I run `middleman server --verbose --port 65432` interactively
340
- And I stop middleman if the output contains:
341
- """
342
- Inspect your site configuration
343
- """
344
- Then the output should contain:
345
- """
346
- The Middleman preview server is bound to ":::65432", "0.0.0.0:65432"
347
- """
348
-
349
- Scenario: Start the server with port 65432 configured via config.rb
350
- Given a file named "config.rb" with:
351
- """
352
- set :port, 65432
353
- """
354
- When I run `middleman server --verbose` interactively
355
- And I stop middleman if the output contains:
356
- """
357
- Inspect your site configuration
358
- """
359
- Then the output should contain:
360
- """
361
- The Middleman preview server is bound to ":::65432", "0.0.0.0:65432"
362
- """
363
-
364
- @wip
365
- Scenario: Start the server when port is blocked by other middleman instance
366
- Given `middleman server` is running in background
367
- When I run `middleman server --verbose` interactively
368
- And I stop all commands if the output of the last command contains:
369
- """
370
- Inspect your site configuration
371
- """
372
- Then the output should contain:
373
- """
374
- The Middleman uses a different port
375
- """
376
-
377
- Scenario: Start the server with bind address 1.1.1.1
378
-
379
- This should fail, because "1.1.1.1" is not an interface available on this computer.
380
-
381
- Given a file named ".hosts" with:
382
- """
383
- 1.1.1.1 www.example.com www
384
- """
385
- When I run `middleman server --verbose --bind-address 1.1.1.1` interactively
386
- And I stop middleman if the output contains:
387
- """
388
- Running Middleman failed:
389
- """
390
- Then the output should contain:
391
- """
392
- Bind address "1.1.1.1" is not available on your system
393
- """
394
-
395
- Scenario: Start the server with server name www.example.com and bind address 0.0.0.0
396
-
397
- This should fail, because the user can just use `--server-name`. It does
398
- not make sense for `middleman` to only listen on `0.0.0.0` (IPv4 all
399
- interfaces), but not on `::` (IPv6 all interfaces). There are other tools
400
- like `iptables` (Linux-only) or better some `kernel`-configurations to make
401
- this possible.
402
-
403
- When I run `middleman server --verbose --server-name www.example.com --bind-address 0.0.0.0` interactively
404
- And I stop middleman if the output contains:
405
- """
406
- Running Middleman failed:
407
- """
408
- Then the output should contain:
409
- """
410
- Undefined combination of options "--server-name" and "--bind-address".
411
- """
412
-
413
- Scenario: Start the server with server name "www.example.com" and bind address "127.0.0.1"
414
-
415
- This should fail because the server name does not resolve to the ip address.
416
-
417
- Given a file named ".hosts" with:
418
- """
419
- 1.1.1.1 www.example.com www
420
- """
421
- When I run `middleman server --verbose --server-name www.example.com --bind-address 127.0.0.1` interactively
422
- And I stop middleman if the output contains:
423
- """
424
- Running Middleman failed:
425
- """
426
- Then the output should contain:
427
- """
428
- Server name "www.example.com" does not resolve to bind address "127.0.0.1". Please fix that and try again.
429
- """
430
-
431
- Scenario: Start the server with server name "garbage.example.com"
432
- When I run `middleman server --verbose --server-name garbage.example.com` interactively
433
- And I stop middleman if the output contains:
434
- """
435
- Running Middleman failed:
436
- """
437
- Then the output should contain:
438
- """
439
- Server name "garbage.example.com" does not resolve to an ip address. Please fix that and try again.
440
- """
441
-
442
- Scenario: Start the server with server name "www.example.com" and the network name server is used to resolve the server name
443
- Given I have a local hosts file with:
444
- """
445
- # empty
446
- """
447
- And I start a mdns server with:
448
- """
449
- # empty
450
- """
451
- And I start a dns server with:
452
- """
453
- www.example.com: 127.0.0.1
454
- """
455
- When I run `middleman server --verbose --server-name www.example.com` interactively
456
- And I stop middleman if the output contains:
457
- """
458
- Inspect your site configuration
459
- """
460
- Then the output should contain:
461
- """
462
- The Middleman preview server is bound to "127.0.0.1:4567"
463
- """
464
- And the output should contain:
465
- """
466
- View your site at "http://www.example.com:4567", "http://127.0.0.1:4567"
467
- """
468
- And the output should contain:
469
- """
470
- Inspect your site configuration at "http://www.example.com:4567/__middleman", "http://127.0.0.1:4567/__middleman"
471
- """
472
-
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
- @wip
506
- Scenario: Start the server with server name "host" and the link local name server is used to resolve the server name
507
-
508
- To make the mdns resolver resolve a name, it needs to end with ".local". If
509
- a plain hostname is given `middleman` appends ".local" automatically.
510
-
511
- Given I have a local hosts file with:
512
- """
513
- # empty
514
- """
515
- And I start a mdns server with:
516
- """
517
- host.local: 127.0.0.1
518
- """
519
- When I run `middleman server --verbose --server-name host` interactively
520
- And I stop middleman if the output contains:
521
- """
522
- Inspect your site configuration
523
- """
524
- Then the output should contain:
525
- """
526
- The Middleman preview server is bound to "127.0.0.1:4567"
527
- """
528
- And the output should contain:
529
- """
530
- View your site at "http://host.local:4567", "http://127.0.0.1:4567"
531
- """
532
- And the output should contain:
533
- """
534
- Inspect your site configuration at "http://host.local:4567/__middleman", "http://127.0.0.1:4567/__middleman"
535
- """
@@ -1,12 +0,0 @@
1
- ENV["TEST"] = "true"
2
-
3
- require 'sassc'
4
-
5
- require 'simplecov'
6
- SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/../..'))
7
-
8
- SimpleCov.start
9
-
10
- PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
11
- require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-cli')
12
- require File.join(File.dirname(PROJECT_ROOT_PATH), 'middleman-core', 'lib', 'middleman-core', 'step_definitions')
@@ -1,33 +0,0 @@
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
@@ -1 +0,0 @@
1
- <h1>Welcome</h1>
@@ -1,9 +0,0 @@
1
- <html>
2
- <head>
3
- <title>My Sample Site</title>
4
- <!-- Comment in layout -->
5
- </head>
6
- <body>
7
- <%= yield %>
8
- </body>
9
- </html>
@@ -1,8 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Custom Layout</title>
4
- </head>
5
- <body>
6
- <%= yield %>
7
- </body>
8
- </html>
@@ -1,5 +0,0 @@
1
- ---
2
- layout: false
3
- ---
4
-
5
- I am real: <%= @num %>
@@ -1 +0,0 @@
1
- I am real
@@ -1 +0,0 @@
1
- <h1>Ignore me!</h1>
@@ -1 +0,0 @@
1
- <h1>Ignore me! 2</h1>
@@ -1 +0,0 @@
1
- <h1>Ignore me! 3</h1>
@@ -1 +0,0 @@
1
- Static, no code!
@@ -1,19 +0,0 @@
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
@@ -1,9 +0,0 @@
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>