middleman-core 3.3.12 → 3.4.0

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 (93) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/cucumber.yml +2 -0
  4. data/features/asset_hash.feature +9 -0
  5. data/features/chained_templates.feature +4 -1
  6. data/features/cli/preview_server.feature +532 -0
  7. data/features/i18n_link_to.feature +209 -0
  8. data/features/javascript-testing.feature +18 -0
  9. data/features/redirects.feature +1 -0
  10. data/features/relative_assets.feature +11 -0
  11. data/features/support/env.rb +3 -0
  12. data/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff +0 -0
  13. data/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff2 +0 -0
  14. data/fixtures/asset-hash-app/source/stylesheets/uses_fonts.css +4 -0
  15. data/fixtures/chained-app/source/test.erb.combobreaker.str.erb +8 -0
  16. data/fixtures/javascript-app/config.rb +0 -0
  17. data/fixtures/javascript-app/source/index.html +17 -0
  18. data/fixtures/preview-server-app/bin/dns_server.rb +33 -0
  19. data/fixtures/preview-server-app/config-complications.rb +11 -0
  20. data/fixtures/preview-server-app/config-empty.rb +0 -0
  21. data/fixtures/preview-server-app/config.rb +11 -0
  22. data/fixtures/preview-server-app/source/index.html.erb +1 -0
  23. data/fixtures/preview-server-app/source/layout.erb +9 -0
  24. data/fixtures/preview-server-app/source/layouts/custom.erb +8 -0
  25. data/fixtures/preview-server-app/source/real.html +1 -0
  26. data/fixtures/preview-server-app/source/real/index.html.erb +5 -0
  27. data/fixtures/preview-server-app/source/should_be_ignored.html +1 -0
  28. data/fixtures/preview-server-app/source/should_be_ignored2.html +1 -0
  29. data/fixtures/preview-server-app/source/should_be_ignored3.html +1 -0
  30. data/fixtures/preview-server-app/source/static.html +1 -0
  31. data/fixtures/relative-assets-app/source/absolute_image_relative_css.html.erb +9 -0
  32. data/fixtures/relative-assets-app/source/javascripts/app.js +3 -0
  33. data/fixtures/relative-assets-app/source/relative_image.html.erb +1 -0
  34. data/fixtures/relative-assets-app/source/relative_image_absolute_css.html.erb +9 -0
  35. data/lib/middleman-core/application.rb +11 -5
  36. data/lib/middleman-core/cli/build.rb +3 -1
  37. data/lib/middleman-core/cli/bundler.rb +1 -1
  38. data/lib/middleman-core/cli/extension.rb +2 -2
  39. data/lib/middleman-core/cli/init.rb +3 -3
  40. data/lib/middleman-core/cli/server.rb +9 -1
  41. data/lib/middleman-core/configuration.rb +0 -2
  42. data/lib/middleman-core/core_extensions/data.rb +2 -2
  43. data/lib/middleman-core/core_extensions/external_helpers.rb +2 -1
  44. data/lib/middleman-core/core_extensions/file_watcher.rb +7 -0
  45. data/lib/middleman-core/core_extensions/front_matter.rb +13 -4
  46. data/lib/middleman-core/core_extensions/rendering.rb +20 -6
  47. data/lib/middleman-core/core_extensions/request.rb +2 -2
  48. data/lib/middleman-core/dns_resolver.rb +73 -0
  49. data/lib/middleman-core/dns_resolver/basic_network_resolver.rb +52 -0
  50. data/lib/middleman-core/dns_resolver/hosts_resolver.rb +63 -0
  51. data/lib/middleman-core/dns_resolver/local_link_resolver.rb +44 -0
  52. data/lib/middleman-core/dns_resolver/network_resolver.rb +42 -0
  53. data/lib/middleman-core/extension.rb +0 -1
  54. data/lib/middleman-core/meta_pages.rb +1 -1
  55. data/lib/middleman-core/preview_server.rb +94 -37
  56. data/lib/middleman-core/preview_server/checks.rb +81 -0
  57. data/lib/middleman-core/preview_server/information.rb +273 -0
  58. data/lib/middleman-core/preview_server/network_interface_inventory.rb +65 -0
  59. data/lib/middleman-core/preview_server/server_hostname.rb +39 -0
  60. data/lib/middleman-core/preview_server/server_information.rb +144 -0
  61. data/lib/middleman-core/preview_server/server_information_validator.rb +18 -0
  62. data/lib/middleman-core/preview_server/server_ip_address.rb +55 -0
  63. data/lib/middleman-core/preview_server/server_url.rb +50 -0
  64. data/lib/middleman-core/preview_server/tcp_port_prober.rb +29 -0
  65. data/lib/middleman-core/sitemap.rb +4 -4
  66. data/lib/middleman-core/sitemap/extensions/ignores.rb +5 -1
  67. data/lib/middleman-core/sitemap/extensions/proxies.rb +0 -1
  68. data/lib/middleman-core/sitemap/extensions/redirects.rb +2 -1
  69. data/lib/middleman-core/sitemap/queryable.rb +2 -1
  70. data/lib/middleman-core/sitemap/store.rb +3 -3
  71. data/lib/middleman-core/step_definitions.rb +1 -0
  72. data/lib/middleman-core/step_definitions/builder_steps.rb +7 -7
  73. data/lib/middleman-core/step_definitions/commandline_steps.rb +88 -0
  74. data/lib/middleman-core/step_definitions/server_steps.rb +25 -28
  75. data/lib/middleman-core/templates/extension/Gemfile +0 -1
  76. data/lib/middleman-core/templates/extension/Rakefile +1 -1
  77. data/lib/middleman-core/util.rb +24 -0
  78. data/lib/middleman-core/version.rb +1 -1
  79. data/lib/middleman-more/core_extensions/default_helpers.rb +49 -8
  80. data/lib/middleman-more/core_extensions/i18n.rb +101 -27
  81. data/lib/middleman-more/extensions/asset_hash.rb +1 -1
  82. data/lib/middleman-more/extensions/asset_host.rb +1 -1
  83. data/lib/middleman-more/extensions/automatic_image_sizes.rb +7 -0
  84. data/lib/middleman-more/extensions/cache_buster.rb +1 -1
  85. data/lib/middleman-more/extensions/lorem.rb +2 -2
  86. data/lib/middleman-more/extensions/minify_javascript.rb +6 -4
  87. data/lib/middleman-more/extensions/relative_assets.rb +4 -8
  88. data/middleman-core.gemspec +3 -3
  89. data/spec/middleman-core/dns_resolver_spec.rb +118 -0
  90. data/spec/middleman-core/preview_server/server_hostname_spec.rb +39 -0
  91. data/spec/middleman-core/preview_server/server_ip_address_spec.rb +43 -0
  92. data/spec/spec_helper.rb +26 -0
  93. metadata +81 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6bfeb7129e9a3c6e06a50e32856e7ec973c597a5
4
- data.tar.gz: dbff503bac895a4e4ffa2f734e52144d0ebe3a6b
3
+ metadata.gz: 0e3c2639ce04b7a22efad4cf9307e3c157fa3214
4
+ data.tar.gz: 9359a06926df1e0c3d8e9115c77898001ec1126a
5
5
  SHA512:
6
- metadata.gz: d983aca0f6732cad2fc53273562e67570d36f5cd20d100f756901849f256e55b8ee20583b620e227b5ee4b671b74074ab982d58aa904a3146752c4fe40d798a5
7
- data.tar.gz: 1aed9d493d38c379270fff5b2e5da9373c88c1af73e3ea468e824e0333fb0351a0428b07be8347a790d5e328efde579f35782792ae73b40ad98b540e63f6f639
6
+ metadata.gz: 4c6e0738451a9b3f720b60489d807d9ef6ffcc420fc2e3626b66ae8c616343eec91f9bdb88272bd50d224c4e4cce88a3ad1d24aaeba95deefe52fd5117bb74c6
7
+ data.tar.gz: 20c3f6219b96c8cfd93f316f7f58d33a9369e3d9451bef65f3d70888e60767f145348c71508136bc365a6f747439923736bdaf1ae492ddead01ee9fed949eed3
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/cucumber.yml ADDED
@@ -0,0 +1,2 @@
1
+ default: --require features --tags ~@wip
2
+ wip: --require features --tags @wip
@@ -47,6 +47,15 @@ Feature: Assets get a file hash appended to their and references to them are upd
47
47
  And the file "subdir/api.json" should contain 'images/100px-5fd6fb90.jpg'
48
48
  And the file "subdir/api.json" should contain 'images/100px-1242c368.png'
49
49
 
50
+ Scenario: Hashed fonts assets work with woff and woff2 extension
51
+ Given a successfully built app at "asset-hash-app"
52
+ When I cd to "build"
53
+ Then the following files should exist:
54
+ | fonts/fontawesome-webfont-56ce13e7.woff |
55
+ | fonts/fontawesome-webfont-10752316.woff2 |
56
+ And the file "stylesheets/uses_fonts-88aa3e2b.css" should contain "src: url('../fonts/fontawesome-webfont-10752316.woff2')"
57
+ And the file "stylesheets/uses_fonts-88aa3e2b.css" should contain "url('../fonts/fontawesome-webfont-56ce13e7.woff')"
58
+
50
59
  Scenario: Hashed assets work in preview server
51
60
  Given the Server is running at "asset-hash-app"
52
61
  When I go to "/"
@@ -13,10 +13,13 @@ Feature: Templates should be chainable
13
13
  When I cd to "build"
14
14
  Then the following files should exist:
15
15
  | index.html |
16
-
16
+ | test.erb.combobreaker |
17
17
  And the file "index.html" should contain "Title</h1>"
18
18
  And the file "index.html" should contain "Subtitle</h2>"
19
19
  And the file "index.html" should contain "Sup</h3>"
20
+ And the file "test.erb.combobreaker" should contain "Title</h1>"
21
+ And the file "test.erb.combobreaker" should contain "Subtitle</h2>"
22
+ And the file "test.erb.combobreaker" should contain "Sup</h3>"
20
23
 
21
24
  Scenario: Partials are parsed by multiple template engines: Outer template has .erb and inner .md.erb
22
25
  Given a fixture app "partial-chained_templates-app"
@@ -0,0 +1,532 @@
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 bind 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
+ @ruby-2.1
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 bind 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 bind 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 bind 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
+ Scenario: Start the server with bind address 127.0.0.5
119
+
120
+ This will have no hostname attached because the hosts file, the DNS server
121
+ and the MDNS-server do not know anything about 127.0.0.5
122
+
123
+ When I run `middleman server --verbose --bind-address 127.0.0.5` interactively
124
+ And I stop middleman if the output contains:
125
+ """
126
+ Inspect your site configuration
127
+ """
128
+ Then the output should contain:
129
+ """
130
+ The Middleman preview server is bind to "127.0.0.5:4567"
131
+ """
132
+ And the output should contain:
133
+ """
134
+ View your site at "http://127.0.0.5:4567"
135
+ """
136
+ And the output should contain:
137
+ """
138
+ Inspect your site configuration at "http://127.0.0.5:4567/__middleman"
139
+ """
140
+
141
+ Scenario: Start the server with bind address ::1
142
+ Given a file named ".hosts" with:
143
+ """
144
+ # <ip-address> <hostname.domain.org> <hostname>
145
+ ::1 localhost.localdomain localhost
146
+ """
147
+ When I run `middleman server --verbose --bind-address ::1` interactively
148
+ And I stop middleman if the output contains:
149
+ """
150
+ Inspect your site configuration
151
+ """
152
+ Then the output should contain:
153
+ """
154
+ The Middleman preview server is bind to "::1:4567"
155
+ """
156
+ And the output should contain:
157
+ """
158
+ View your site at "http://[::1]:4567"
159
+ """
160
+ And the output should contain:
161
+ """
162
+ Inspect your site configuration at "http://[::1]:4567/__middleman"
163
+ """
164
+
165
+ Scenario: Start the server with bind address 0.0.0.0
166
+ When I run `middleman server --verbose --bind-address 0.0.0.0` interactively
167
+ And I stop middleman if the output contains:
168
+ """
169
+ Inspect your site configuration
170
+ """
171
+ Then the output should contain:
172
+ """
173
+ The Middleman preview server is bind to "0.0.0.0:4567"
174
+ """
175
+ And the output should contain:
176
+ """
177
+ View your site at "http://
178
+ """
179
+ And the output should contain:
180
+ """
181
+ Inspect your site configuration at "http://
182
+ """
183
+
184
+ Scenario: Start the server with bind address ::
185
+ When I run `middleman server --verbose --bind-address ::` interactively
186
+ And I stop middleman if the output contains:
187
+ """
188
+ Inspect your site configuration
189
+ """
190
+ Then the output should contain:
191
+ """
192
+ The Middleman preview server is bind to ":::4567"
193
+ """
194
+ And the output should contain:
195
+ """
196
+ View your site at "http://
197
+ """
198
+ And the output should contain:
199
+ """
200
+ Inspect your site configuration at "http://
201
+ """
202
+
203
+ Scenario: Start the server with server name "localhost"
204
+ Given I have a local hosts file with:
205
+ """
206
+ # <ip-address> <hostname.domain.org> <hostname>
207
+ 127.0.0.1 localhost.localdomain localhost
208
+ """
209
+ When I run `middleman server --verbose --server-name localhost` interactively
210
+ And I stop middleman if the output contains:
211
+ """
212
+ Inspect your site configuration
213
+ """
214
+ Then the output should contain:
215
+ """
216
+ The Middleman preview server is bind to "127.0.0.1:4567"
217
+ """
218
+ And the output should contain:
219
+ """
220
+ View your site at "http://localhost:4567", "http://127.0.0.1:4567"
221
+ """
222
+ And the output should contain:
223
+ """
224
+ Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
225
+ """
226
+
227
+ Scenario: Start the server with server name "localhost" configured via config.rb
228
+ Given I have a local hosts file with:
229
+ """
230
+ # <ip-address> <hostname.domain.org> <hostname>
231
+ 127.0.0.1 localhost.localdomain localhost
232
+ """
233
+ And a file named "config.rb" with:
234
+ """
235
+ set :server_name, 'localhost'
236
+ """
237
+ When I run `middleman server --verbose` interactively
238
+ And I stop middleman if the output contains:
239
+ """
240
+ Inspect your site configuration
241
+ """
242
+ Then the output should contain:
243
+ """
244
+ The Middleman preview server is bind to "127.0.0.1:4567"
245
+ """
246
+ And the output should contain:
247
+ """
248
+ View your site at "http://localhost:4567", "http://127.0.0.1:4567"
249
+ """
250
+ And the output should contain:
251
+ """
252
+ Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
253
+ """
254
+
255
+ Scenario: Start the server with server name "localhost" and bind address "127.0.0.1"
256
+ Given I have a local hosts file with:
257
+ """
258
+ # <ip-address> <hostname.domain.org> <hostname>
259
+ 127.0.0.1 localhost.localdomain localhost
260
+ """
261
+ When I run `middleman server --verbose --server-name localhost --bind-address 127.0.0.1` interactively
262
+ And I stop middleman if the output contains:
263
+ """
264
+ Inspect your site configuration
265
+ """
266
+ Then the output should contain:
267
+ """
268
+ The Middleman preview server is bind to "127.0.0.1:4567"
269
+ """
270
+ And the output should contain:
271
+ """
272
+ View your site at "http://localhost:4567", "http://127.0.0.1:4567"
273
+ """
274
+ And the output should contain:
275
+ """
276
+ Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman"
277
+ """
278
+
279
+ Scenario: Start the server with server name "127.0.0.1"
280
+ When I run `middleman server --verbose --server-name 127.0.0.1` interactively
281
+ And I stop middleman if the output contains:
282
+ """
283
+ Inspect your site configuration
284
+ """
285
+ Then the output should contain:
286
+ """
287
+ The Middleman preview server is bind to "127.0.0.1:4567"
288
+ """
289
+ And the output should contain:
290
+ """
291
+ View your site at "http://127.0.0.1:4567"
292
+ """
293
+ And the output should contain:
294
+ """
295
+ Inspect your site configuration at "http://127.0.0.1:4567/__middleman"
296
+ """
297
+
298
+ Scenario: Start the server with server name "::1"
299
+ When I run `middleman server --verbose --server-name ::1` interactively
300
+ And I stop middleman if the output contains:
301
+ """
302
+ Inspect your site configuration
303
+ """
304
+ Then the output should contain:
305
+ """
306
+ The Middleman preview server is bind to "::1:4567"
307
+ """
308
+ And the output should contain:
309
+ """
310
+ View your site at "http://[::1]:4567"
311
+ """
312
+ And the output should contain:
313
+ """
314
+ Inspect your site configuration at "http://[::1]:4567/__middleman"
315
+ """
316
+
317
+ Scenario: Start the server with https
318
+ When I run `middleman server --verbose --https` interactively
319
+ And I stop middleman if the output contains:
320
+ """
321
+ Inspect your site configuration
322
+ """
323
+ Then the output should contain:
324
+ """
325
+ The Middleman preview server is bind to ":::4567", "0.0.0.0:4567"
326
+ """
327
+ And the output should contain:
328
+ """
329
+ View your site at "https://
330
+ """
331
+ And the output should contain:
332
+ """
333
+ Inspect your site configuration at "https://
334
+ """
335
+
336
+ Scenario: Start the server with port 65432
337
+ When I run `middleman server --verbose --port 65432` interactively
338
+ And I stop middleman if the output contains:
339
+ """
340
+ Inspect your site configuration
341
+ """
342
+ Then the output should contain:
343
+ """
344
+ The Middleman preview server is bind to ":::65432", "0.0.0.0:65432"
345
+ """
346
+
347
+ Scenario: Start the server with port 65432 configured via config.rb
348
+ Given a file named "config.rb" with:
349
+ """
350
+ set :port, 65432
351
+ """
352
+ When I run `middleman server --verbose` interactively
353
+ And I stop middleman if the output contains:
354
+ """
355
+ Inspect your site configuration
356
+ """
357
+ Then the output should contain:
358
+ """
359
+ The Middleman preview server is bind to ":::65432", "0.0.0.0:65432"
360
+ """
361
+
362
+ Scenario: Start the server when port is blocked by other middleman instance
363
+ Given `middleman server` is running in background
364
+ When I run `middleman server --verbose` interactively
365
+ And I stop all commands if the output of the last command contains:
366
+ """
367
+ Inspect your site configuration
368
+ """
369
+ Then the output should contain:
370
+ """
371
+ The Middleman uses a different port
372
+ """
373
+
374
+ Scenario: Start the server with bind address 1.1.1.1
375
+
376
+ This should fail, because "1.1.1.1" is not an interface available on this computer.
377
+
378
+ Given a file named ".hosts" with:
379
+ """
380
+ 1.1.1.1 www.example.com www
381
+ """
382
+ When I run `middleman server --verbose --bind-address 1.1.1.1` interactively
383
+ And I stop middleman if the output contains:
384
+ """
385
+ Running Middleman failed:
386
+ """
387
+ Then the output should contain:
388
+ """
389
+ Bind address "1.1.1.1" is not available on your system
390
+ """
391
+
392
+ Scenario: Start the server with server name www.example.com and bind address 0.0.0.0
393
+
394
+ This should fail, because the user can just use `--server-name`. It does
395
+ not make sense for `middleman` to only listen on `0.0.0.0` (IPv4 all
396
+ interfaces), but not on `::` (IPv6 all interfaces). There are other tools
397
+ like `iptables` (Linux-only) or better some `kernel`-configurations to make
398
+ this possible.
399
+
400
+ When I run `middleman server --verbose --server-name www.example.com --bind-address 0.0.0.0` interactively
401
+ And I stop middleman if the output contains:
402
+ """
403
+ Running Middleman failed:
404
+ """
405
+ Then the output should contain:
406
+ """
407
+ Undefined combination of options "--server-name" and "--bind-address".
408
+ """
409
+
410
+ Scenario: Start the server with server name "www.example.com" and bind address "127.0.0.1"
411
+
412
+ This should fail because the server name does not resolve to the ip address.
413
+
414
+ Given a file named ".hosts" with:
415
+ """
416
+ 1.1.1.1 www.example.com www
417
+ """
418
+ When I run `middleman server --verbose --server-name www.example.com --bind-address 127.0.0.1` interactively
419
+ And I stop middleman if the output contains:
420
+ """
421
+ Running Middleman failed:
422
+ """
423
+ Then the output should contain:
424
+ """
425
+ Server name "www.example.com" does not resolve to bind address "127.0.0.1". Please fix that and try again.
426
+ """
427
+
428
+ Scenario: Start the server with server name "garbage.example.com"
429
+ When I run `middleman server --verbose --server-name garbage.example.com` interactively
430
+ And I stop middleman if the output contains:
431
+ """
432
+ Running Middleman failed:
433
+ """
434
+ Then the output should contain:
435
+ """
436
+ Server name "garbage.example.com" does not resolve to an ip address. Please fix that and try again.
437
+ """
438
+
439
+ Scenario: Start the server with server name "www.example.com" and the network name server is used to resolve the server name
440
+ Given I have a local hosts file with:
441
+ """
442
+ # empty
443
+ """
444
+ And I start a mdns server with:
445
+ """
446
+ # empty
447
+ """
448
+ And I start a dns server with:
449
+ """
450
+ www.example.com: 127.0.0.1
451
+ """
452
+ When I run `middleman server --verbose --server-name www.example.com` interactively
453
+ And I stop middleman if the output contains:
454
+ """
455
+ Inspect your site configuration
456
+ """
457
+ Then the output should contain:
458
+ """
459
+ The Middleman preview server is bind to "127.0.0.1:4567"
460
+ """
461
+ And the output should contain:
462
+ """
463
+ View your site at "http://www.example.com:4567", "http://127.0.0.1:4567"
464
+ """
465
+ And the output should contain:
466
+ """
467
+ Inspect your site configuration at "http://www.example.com:4567/__middleman", "http://127.0.0.1:4567/__middleman"
468
+ """
469
+
470
+ @ruby-2.1
471
+ Scenario: Start the server with server name "host.local" and the link local name server is used to resolve the server name
472
+
473
+ To make the mdns resolver resolve a name, it needs to end with ".local".
474
+ Otherwise the resolver returns [].
475
+
476
+ Given I have a local hosts file with:
477
+ """
478
+ # empty
479
+ """
480
+ And I start a mdns server with:
481
+ """
482
+ host.local: 127.0.0.1
483
+ """
484
+ When I run `middleman server --verbose --server-name host.local` interactively
485
+ And I stop middleman if the output contains:
486
+ """
487
+ Inspect your site configuration
488
+ """
489
+ Then the output should contain:
490
+ """
491
+ The Middleman preview server is bind to "127.0.0.1:4567"
492
+ """
493
+ And the output should contain:
494
+ """
495
+ View your site at "http://host.local:4567", "http://127.0.0.1:4567"
496
+ """
497
+ And the output should contain:
498
+ """
499
+ Inspect your site configuration at "http://host.local:4567/__middleman", "http://127.0.0.1:4567/__middleman"
500
+ """
501
+
502
+ @ruby-2.1
503
+ Scenario: Start the server with server name "host" and the link local name server is used to resolve the server name
504
+
505
+ To make the mdns resolver resolve a name, it needs to end with ".local". If
506
+ a plain hostname is given `middleman` appends ".local" automatically.
507
+
508
+ Given I have a local hosts file with:
509
+ """
510
+ # empty
511
+ """
512
+ And I start a mdns server with:
513
+ """
514
+ host.local: 127.0.0.1
515
+ """
516
+ When I run `middleman server --verbose --server-name host` interactively
517
+ And I stop middleman if the output contains:
518
+ """
519
+ Inspect your site configuration
520
+ """
521
+ Then the output should contain:
522
+ """
523
+ The Middleman preview server is bind to "127.0.0.1:4567"
524
+ """
525
+ And the output should contain:
526
+ """
527
+ View your site at "http://host.local:4567", "http://127.0.0.1:4567"
528
+ """
529
+ And the output should contain:
530
+ """
531
+ Inspect your site configuration at "http://host.local:4567/__middleman", "http://127.0.0.1:4567/__middleman"
532
+ """