middleman-core 3.0.0 → 3.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. data/.cane +2 -0
  2. data/.cane-exclusions.yml +5 -0
  3. data/Rakefile +1 -1
  4. data/bin/middleman +9 -55
  5. data/features/cli_extension.feature +1 -0
  6. data/features/frontmatter_page_settings.feature +11 -1
  7. data/features/instance_vars.feature +9 -0
  8. data/features/step_definitions/page_layout_steps.rb +3 -3
  9. data/features/strip_url.feature +40 -0
  10. data/features/support/env.rb +1 -1
  11. data/fixtures/automatic-directory-matcher-app/config.rb +1 -1
  12. data/fixtures/basic-data-app/config.rb +1 -1
  13. data/fixtures/build-with-errors-app/config.rb +1 -1
  14. data/fixtures/clean-app/config-complications.rb +1 -1
  15. data/fixtures/clean-app/config.rb +1 -1
  16. data/fixtures/current-page-app/config.rb +1 -1
  17. data/fixtures/custom-layout-app/config.rb +1 -1
  18. data/fixtures/data-app/config.rb +1 -1
  19. data/fixtures/external-helpers/config.rb +1 -1
  20. data/fixtures/external-helpers/helpers/derp.rb +1 -1
  21. data/fixtures/external-helpers/helpers/four_helpers.rb +1 -1
  22. data/fixtures/external-helpers/helpers/one_helper.rb +1 -1
  23. data/fixtures/external-helpers/helpers/yet_another_thingy.rb +1 -1
  24. data/fixtures/external-helpers/lib/hello_helper.rb +1 -1
  25. data/fixtures/feature-params-app/config.rb +1 -1
  26. data/fixtures/frontmatter-settings-app/config.rb +3 -1
  27. data/fixtures/frontmatter-settings-app/source/layouts/override.erb +2 -0
  28. data/fixtures/frontmatter-settings-app/source/override_layout.html.erb +4 -0
  29. data/fixtures/frontmatter-settings-app/source/page_mentioned.html.erb +4 -0
  30. data/fixtures/generator-test/config.rb +10 -10
  31. data/fixtures/glob-app/config.rb +1 -1
  32. data/fixtures/instance-vars-app/config.rb +7 -0
  33. data/fixtures/instance-vars-app/source/content.html.erb +2 -0
  34. data/fixtures/instance-vars-app/source/layout.erb +1 -0
  35. data/fixtures/large-build-app/config.rb +1 -1
  36. data/fixtures/large-build-app/source/images/Child folder/regular_file(example).txt +1 -1
  37. data/fixtures/large-build-app/source/images/Read me (example).txt +1 -1
  38. data/fixtures/manual-layout-missing/config.rb +1 -1
  39. data/fixtures/manual-layout-override/config.rb +1 -1
  40. data/fixtures/manual-layout/config.rb +1 -1
  41. data/fixtures/page-helper-layout-block-app/config.rb +1 -1
  42. data/fixtures/sinatra-app/config.rb +1 -1
  43. data/fixtures/strip-url-app/config.rb +0 -0
  44. data/fixtures/strip-url-app/source/index.html.erb +1 -0
  45. data/fixtures/strip-url-app/source/other.html.erb +1 -0
  46. data/fixtures/strip-url-app/source/subdir/index.html.erb +1 -0
  47. data/fixtures/traversal-app/config.rb +1 -1
  48. data/fixtures/wildcard-app/config.rb +1 -1
  49. data/lib/middleman-core.rb +3 -3
  50. data/lib/middleman-core/application.rb +12 -11
  51. data/lib/middleman-core/cli.rb +23 -10
  52. data/lib/middleman-core/cli/build.rb +65 -54
  53. data/lib/middleman-core/cli/bundler.rb +7 -7
  54. data/lib/middleman-core/cli/extension.rb +25 -12
  55. data/lib/middleman-core/cli/init.rb +19 -19
  56. data/lib/middleman-core/cli/server.rb +25 -16
  57. data/lib/middleman-core/core_extensions/builder.rb +3 -3
  58. data/lib/middleman-core/core_extensions/data.rb +28 -28
  59. data/lib/middleman-core/core_extensions/extensions.rb +24 -25
  60. data/lib/middleman-core/core_extensions/external_helpers.rb +7 -7
  61. data/lib/middleman-core/core_extensions/file_watcher.rb +41 -38
  62. data/lib/middleman-core/core_extensions/front_matter.rb +36 -33
  63. data/lib/middleman-core/core_extensions/rendering.rb +49 -46
  64. data/lib/middleman-core/core_extensions/request.rb +34 -33
  65. data/lib/middleman-core/core_extensions/routing.rb +17 -17
  66. data/lib/middleman-core/core_extensions/ruby_encoding.rb +1 -1
  67. data/lib/middleman-core/core_extensions/show_exceptions.rb +5 -5
  68. data/lib/middleman-core/extensions.rb +4 -4
  69. data/lib/middleman-core/load_paths.rb +56 -0
  70. data/lib/middleman-core/logger.rb +29 -0
  71. data/lib/middleman-core/preview_server.rb +35 -34
  72. data/lib/middleman-core/profiling.rb +58 -0
  73. data/lib/middleman-core/renderers/coffee_script.rb +8 -6
  74. data/lib/middleman-core/renderers/erb.rb +5 -5
  75. data/lib/middleman-core/renderers/haml.rb +5 -5
  76. data/lib/middleman-core/renderers/less.rb +14 -10
  77. data/lib/middleman-core/renderers/liquid.rb +7 -7
  78. data/lib/middleman-core/renderers/markdown.rb +13 -14
  79. data/lib/middleman-core/renderers/redcarpet.rb +31 -11
  80. data/lib/middleman-core/renderers/sass.rb +38 -22
  81. data/lib/middleman-core/renderers/slim.rb +15 -7
  82. data/lib/middleman-core/sitemap.rb +25 -28
  83. data/lib/middleman-core/sitemap/extensions/ignores.rb +13 -13
  84. data/lib/middleman-core/sitemap/extensions/on_disk.rb +12 -12
  85. data/lib/middleman-core/sitemap/extensions/proxies.rb +26 -20
  86. data/lib/middleman-core/sitemap/extensions/traversal.rb +10 -10
  87. data/lib/middleman-core/sitemap/resource.rb +47 -50
  88. data/lib/middleman-core/sitemap/store.rb +38 -36
  89. data/lib/middleman-core/step_definitions.rb +1 -1
  90. data/lib/middleman-core/step_definitions/builder_steps.rb +1 -1
  91. data/lib/middleman-core/step_definitions/middleman_steps.rb +3 -3
  92. data/lib/middleman-core/step_definitions/server_steps.rb +5 -5
  93. data/lib/middleman-core/templates.rb +12 -12
  94. data/lib/middleman-core/templates/default.rb +11 -11
  95. data/lib/middleman-core/templates/extension/Gemfile +14 -1
  96. data/lib/middleman-core/templates/extension/Rakefile +3 -1
  97. data/lib/middleman-core/templates/extension/features/support/env.rb +1 -1
  98. data/lib/middleman-core/templates/extension/gitignore +2 -0
  99. data/lib/middleman-core/templates/extension/lib/lib.rb +11 -11
  100. data/lib/middleman-core/templates/extension/lib/middleman_extension.rb +1 -1
  101. data/lib/middleman-core/templates/html5.rb +10 -10
  102. data/lib/middleman-core/templates/html5/source/humans.txt +0 -0
  103. data/lib/middleman-core/templates/html5/source/robots.txt +0 -0
  104. data/lib/middleman-core/templates/local.rb +4 -4
  105. data/lib/middleman-core/templates/mobile.rb +3 -3
  106. data/lib/middleman-core/templates/mobile/source/humans.txt +0 -0
  107. data/lib/middleman-core/templates/mobile/source/robots.txt +0 -0
  108. data/lib/middleman-core/templates/shared/config.ru +1 -1
  109. data/lib/middleman-core/templates/shared/config.tt +10 -10
  110. data/lib/middleman-core/util.rb +30 -6
  111. data/lib/middleman-core/vendor/hooks-0.2.0/lib/hooks.rb +19 -19
  112. data/lib/middleman-core/vendor/hooks-0.2.0/lib/hooks/inheritable_attribute.rb +2 -2
  113. data/lib/middleman-core/vendor/hooks-0.2.0/test/hooks_test.rb +29 -29
  114. data/lib/middleman-core/vendor/hooks-0.2.0/test/inheritable_attribute_test.rb +11 -11
  115. data/lib/middleman-core/version.rb +1 -1
  116. data/lib/middleman/rack.rb +4 -0
  117. data/middleman-core-x86-mingw32.gemspec +38 -0
  118. data/middleman-core.gemspec +3 -2
  119. metadata +72 -11
@@ -10,15 +10,15 @@ end
10
10
  module Middleman
11
11
  module CoreExtensions
12
12
  module Rendering
13
-
13
+
14
14
  # Setup extension
15
15
  class << self
16
-
16
+
17
17
  # Once registered
18
18
  def registered(app)
19
19
  # Include methods
20
20
  app.send :include, InstanceMethods
21
-
21
+
22
22
  # Activate custom renderers
23
23
  require "middleman-core/renderers/erb"
24
24
  app.register Middleman::Renderers::ERb
@@ -61,7 +61,7 @@ module Middleman
61
61
  app.register Middleman::Renderers::Slim
62
62
  rescue LoadError
63
63
  end
64
-
64
+
65
65
  # Less Support
66
66
  begin
67
67
  require "middleman-core/renderers/less"
@@ -69,17 +69,17 @@ module Middleman
69
69
  rescue LoadError
70
70
  end
71
71
  end
72
-
72
+
73
73
  alias :included :registered
74
74
  end
75
-
75
+
76
76
  # Custom error class for handling
77
77
  class TemplateNotFound < RuntimeError
78
78
  end
79
-
79
+
80
80
  # Rendering instance methods
81
81
  module InstanceMethods
82
-
82
+
83
83
  # Add or overwrite a default template extension
84
84
  #
85
85
  # @param [Hash] extension_map
@@ -89,24 +89,27 @@ module Middleman
89
89
  @_template_extensions.merge!(extension_map) if extension_map
90
90
  @_template_extensions
91
91
  end
92
-
92
+
93
93
  # Render a template, with layout, given a path
94
94
  #
95
95
  # @param [String] path
96
96
  # @param [Hash] locs
97
97
  # @param [Hash] opts
98
98
  # @return [String]
99
- def render_template(path, locs={}, opts={})
99
+ def render_template(path, locs={}, opts={}, blocks=[])
100
100
  # Detect the remdering engine from the extension
101
101
  extension = File.extname(path)
102
102
  engine = extension[1..-1].to_sym
103
103
 
104
104
  # Store last engine for later (could be inside nested renders)
105
105
  @current_engine, engine_was = engine, @current_engine
106
-
107
- # Use a dup of self as a context so that instance variables set within
106
+
107
+ # Use a dup of self as a context so that instance variables set within
108
108
  # the template don't persist for other templates.
109
109
  context = self.dup
110
+ blocks.each do |block|
111
+ context.instance_eval(&block)
112
+ end
110
113
 
111
114
  # Store current locs/opts for later
112
115
  @current_locs = locs, @current_opts = opts
@@ -123,26 +126,26 @@ module Middleman
123
126
  raise "Tried to render a layout (calls yield) at #{path} like it was a template. Non-default layouts need to be in #{source}/layouts."
124
127
  end
125
128
  end
126
-
129
+
127
130
  # Certain output file types don't use layouts
128
131
  needs_layout = !%w(.js .json .css .txt).include?(File.extname(path))
129
-
132
+
130
133
  # If we need a layout and have a layout, use it
131
134
  if needs_layout && layout_path = fetch_layout(engine, opts)
132
135
  content = render_individual_file(layout_path, locs, opts, context) { content }
133
136
  end
134
-
137
+
135
138
  # Return result
136
139
  content
137
140
  ensure
138
- # Pop all the saved variables from earlier as we may be returning to a
141
+ # Pop all the saved variables from earlier as we may be returning to a
139
142
  # previous render (layouts, partials, nested layouts).
140
143
  @current_engine = engine_was
141
144
  @content_blocks = nil
142
145
  @current_locs = nil
143
146
  @current_opts = nil
144
147
  end
145
-
148
+
146
149
  # Sinatra/Padrino compatible render method signature referenced by some view
147
150
  # helpers. Especially partials.
148
151
  #
@@ -176,7 +179,7 @@ module Middleman
176
179
  end
177
180
  end
178
181
  end
179
-
182
+
180
183
  # Look in the root for the partial with the current engine
181
184
  if !found_partial && !engine.nil?
182
185
  found_partial, found_engine = resolve_template(data, :preferred_engine => engine, :try_without_underscore => true)
@@ -204,17 +207,17 @@ module Middleman
204
207
  # @return [String]
205
208
  def render_individual_file(path, locs = {}, opts = {}, context = self, &block)
206
209
  path = path.to_s
207
-
210
+
208
211
  # Save current buffer for later
209
212
  @_out_buf, _buf_was = "", @_out_buf
210
-
213
+
211
214
  # Read from disk or cache the contents of the file
212
215
  body = if opts[:template_body]
213
216
  opts.delete(:template_body)
214
217
  else
215
218
  template_data_for_file(path)
216
219
  end
217
-
220
+
218
221
  # Merge per-extension options from config
219
222
  extension = File.extname(path)
220
223
  options = opts.merge(options_for_ext(extension))
@@ -231,15 +234,15 @@ module Middleman
231
234
  # Reset stored buffer
232
235
  @_out_buf = _buf_was
233
236
  end
234
-
237
+
235
238
  # Get the template data from a path
236
239
  # @param [String] path
237
240
  # @return [String]
238
241
  def template_data_for_file(path)
239
242
  File.read(File.expand_path(path, source_dir))
240
243
  end
241
-
242
- # Get a hash of configuration options for a given file extension, from
244
+
245
+ # Get a hash of configuration options for a given file extension, from
243
246
  # config.rb
244
247
  #
245
248
  # @param [String] ext
@@ -249,7 +252,7 @@ module Middleman
249
252
  cache.fetch(:options_for_ext, ext) do
250
253
  options = {}
251
254
 
252
- # Find all the engines which handle this extension in tilt. Look for
255
+ # Find all the engines which handle this extension in tilt. Look for
253
256
  # config variables of that name and merge it
254
257
  extension_class = ::Tilt[ext]
255
258
  ::Tilt.mappings.each do |ext, engines|
@@ -261,7 +264,7 @@ module Middleman
261
264
  options
262
265
  end
263
266
  end
264
-
267
+
265
268
  # Find a layout for a given engine
266
269
  #
267
270
  # @param [Symbol] engine
@@ -271,7 +274,7 @@ module Middleman
271
274
  # The layout name comes from either the system default or the options
272
275
  local_layout = opts.has_key?(:layout) ? opts[:layout] : layout
273
276
  return false unless local_layout
274
-
277
+
275
278
  # Look for engine-specific options
276
279
  engine_options = respond_to?(engine) ? send(engine) : {}
277
280
 
@@ -300,7 +303,7 @@ module Middleman
300
303
  end
301
304
  end
302
305
  end
303
-
306
+
304
307
  # Find a layout on-disk, optionally using a specific engine
305
308
  # @param [String] name
306
309
  # @param [Symbol] preferred_engine
@@ -308,47 +311,47 @@ module Middleman
308
311
  def locate_layout(name, preferred_engine=nil)
309
312
  # Whether we've found the layout
310
313
  layout_path = false
311
-
314
+
312
315
  # If we prefer a specific engine
313
316
  if !preferred_engine.nil?
314
317
  # Check root
315
318
  layout_path, layout_engine = resolve_template(name, :preferred_engine => preferred_engine)
316
-
319
+
317
320
  # Check layouts folder
318
321
  if !layout_path
319
322
  layout_path, layout_engine = resolve_template(File.join("layouts", name.to_s), :preferred_engine => preferred_engine)
320
323
  end
321
324
  end
322
-
325
+
323
326
  # Check root, no preference
324
327
  if !layout_path
325
328
  layout_path, layout_engine = resolve_template(name)
326
329
  end
327
-
330
+
328
331
  # Check layouts folder, no preference
329
332
  if !layout_path
330
333
  layout_path, layout_engine = resolve_template(File.join("layouts", name.to_s))
331
334
  end
332
-
335
+
333
336
  # Return the path
334
337
  layout_path
335
338
  end
336
-
339
+
337
340
  # Allow layouts to be wrapped in the contents of other layouts
338
341
  # @param [String, Symbol] layout_name
339
342
  # @return [void]
340
343
  def wrap_layout(layout_name, &block)
341
344
  # Save current buffer for later
342
345
  @_out_buf, _buf_was = "", @_out_buf
343
-
346
+
344
347
  layout_path = locate_layout(layout_name, current_engine)
345
-
348
+
346
349
  extension = File.extname(layout_path)
347
350
  engine = extension[1..-1].to_sym
348
-
351
+
349
352
  # Store last engine for later (could be inside nested renders)
350
353
  @current_engine, engine_was = engine, @current_engine
351
-
354
+
352
355
  begin
353
356
  content = if block_given?
354
357
  capture_html(&block)
@@ -359,18 +362,18 @@ module Middleman
359
362
  # Reset stored buffer
360
363
  @_out_buf = _buf_was
361
364
  end
362
-
365
+
363
366
  concat_content render_individual_file(layout_path, @current_locs || {}, @current_opts || {}, self) { content }
364
367
  ensure
365
368
  @current_engine = engine_was
366
369
  end
367
-
370
+
368
371
  # The currently rendering engine
369
372
  # @return [Symbol, nil]
370
373
  def current_engine
371
374
  @current_engine ||= nil
372
375
  end
373
-
376
+
374
377
  # Find a template on disk given a output path
375
378
  # @param [String] request_path
376
379
  # @param [Hash] options
@@ -384,7 +387,7 @@ module Middleman
384
387
 
385
388
  # By default, any engine will do
386
389
  preferred_engine = "*"
387
-
390
+
388
391
  # Unless we're specifically looking for a preferred engine
389
392
  if options.has_key?(:preferred_engine)
390
393
  extension_class = ::Tilt[options[:preferred_engine]]
@@ -407,12 +410,12 @@ module Middleman
407
410
 
408
411
  # Look for files that match
409
412
  path_with_ext = on_disk_path + "." + preferred_engine
410
-
413
+
411
414
  found_path = Dir[path_with_ext].find do |path|
412
415
  ::Tilt[path]
413
416
  end
414
-
415
- if !found_path && options[:try_without_underscore] &&
417
+
418
+ if !found_path && options[:try_without_underscore] &&
416
419
  path_no_underscore = path_with_ext.
417
420
  sub(relative_path, relative_path.sub(/^_/, "").
418
421
  sub(/\/_/, "/"))
@@ -420,7 +423,7 @@ module Middleman
420
423
  ::Tilt[path]
421
424
  end
422
425
  end
423
-
426
+
424
427
  # If we found one, return it and the found engine
425
428
  if found_path || (File.exists?(on_disk_path) && !File.directory?(on_disk_path))
426
429
  engine = found_path ? File.extname(found_path)[1..-1].to_sym : nil
@@ -4,33 +4,33 @@ require "rack/file"
4
4
 
5
5
  module Middleman
6
6
  module CoreExtensions
7
-
7
+
8
8
  # Base helper to manipulate asset paths
9
9
  module Request
10
-
10
+
11
11
  # Extension registered
12
12
  class << self
13
13
  # @private
14
14
  def registered(app)
15
-
15
+
16
16
  # CSSPIE HTC File
17
17
  ::Rack::Mime::MIME_TYPES['.htc'] = 'text/x-component'
18
18
 
19
19
  # Let's serve all HTML as UTF-8
20
20
  ::Rack::Mime::MIME_TYPES['.html'] = 'text/html; charset=utf-8'
21
21
  ::Rack::Mime::MIME_TYPES['.htm'] = 'text/html; charset=utf-8'
22
-
22
+
23
23
  app.extend ClassMethods
24
24
  app.extend ServerMethods
25
-
25
+
26
26
  Middleman.extend CompatibleClassMethods
27
-
27
+
28
28
  # Include instance methods
29
29
  app.send :include, InstanceMethods
30
30
  end
31
31
  alias :included :registered
32
32
  end
33
-
33
+
34
34
  module ClassMethods
35
35
  # Reset Rack setup
36
36
  #
@@ -39,7 +39,7 @@ module Middleman
39
39
  @app = nil
40
40
  @prototype = nil
41
41
  end
42
-
42
+
43
43
  # The shared Rack instance being build
44
44
  #
45
45
  # @private
@@ -47,7 +47,7 @@ module Middleman
47
47
  def app
48
48
  @app ||= ::Rack::Builder.new
49
49
  end
50
-
50
+
51
51
  # Get the static instance
52
52
  #
53
53
  # @private
@@ -59,7 +59,7 @@ module Middleman
59
59
  mm
60
60
  end
61
61
  end
62
-
62
+
63
63
  # Set the shared instance
64
64
  #
65
65
  # @private
@@ -68,27 +68,27 @@ module Middleman
68
68
  def inst=(inst)
69
69
  @inst = inst
70
70
  end
71
-
71
+
72
72
  # Return built Rack app
73
73
  #
74
74
  # @private
75
75
  # @return [Rack::Builder]
76
76
  def to_rack_app(&block)
77
77
  inner_app = inst(&block)
78
-
78
+
79
79
  (@middleware || []).each do |m|
80
80
  app.use(m[0], *m[1], &m[2])
81
81
  end
82
-
82
+
83
83
  app.map("/") { run inner_app }
84
-
84
+
85
85
  (@mappings || []).each do |m|
86
86
  app.map(m[0], &m[1])
87
87
  end
88
-
88
+
89
89
  app
90
90
  end
91
-
91
+
92
92
  # Prototype app. Used in config.ru
93
93
  #
94
94
  # @private
@@ -103,7 +103,7 @@ module Middleman
103
103
  def call(env)
104
104
  prototype.call(env)
105
105
  end
106
-
106
+
107
107
  # Use Rack middleware
108
108
  #
109
109
  # @param [Class] middleware Middleware module
@@ -112,7 +112,7 @@ module Middleman
112
112
  @middleware ||= []
113
113
  @middleware << [middleware, args, block]
114
114
  end
115
-
115
+
116
116
  # Add Rack App mapped to specific path
117
117
  #
118
118
  # @param [String] map Path to map
@@ -122,7 +122,7 @@ module Middleman
122
122
  @mappings << [map, block]
123
123
  end
124
124
  end
125
-
125
+
126
126
  module ServerMethods
127
127
  # Create a new Class which is based on Middleman::Application
128
128
  # Used to create a safe sandbox into which extensions and
@@ -136,7 +136,7 @@ module Middleman
136
136
  const_set("MiddlemanApplication#{@@servercounter}", Class.new(Middleman::Application))
137
137
  end
138
138
  end
139
-
139
+
140
140
  module CompatibleClassMethods
141
141
  # Create a new Class which is based on Middleman::Application
142
142
  # Used to create a safe sandbox into which extensions and
@@ -145,7 +145,7 @@ module Middleman
145
145
  #
146
146
  # @return [Class]
147
147
  def server(&block)
148
- ::Middleman::Application.server(&block)
148
+ ::Middleman::Application.server
149
149
  end
150
150
  end
151
151
 
@@ -164,15 +164,15 @@ module Middleman
164
164
  # @return [void]
165
165
  def current_path=(path)
166
166
  @current_path = path
167
- @request = ::Thor::CoreExt::HashWithIndifferentAccess.new({
168
- :path => path,
169
- :params => req ? ::Thor::CoreExt::HashWithIndifferentAccess.new(req.params) : {}
167
+ @request = ::Thor::CoreExt::HashWithIndifferentAccess.new({
168
+ :path => path,
169
+ :params => req ? ::Thor::CoreExt::HashWithIndifferentAccess.new(req.params) : {}
170
170
  })
171
171
  end
172
-
172
+
173
173
  def use(*args, &block); self.class.use(*args, &block); end
174
174
  def map(*args, &block); self.class.map(*args, &block); end
175
-
175
+
176
176
  # Rack env
177
177
  attr_accessor :env
178
178
 
@@ -187,7 +187,7 @@ module Middleman
187
187
  def call(env)
188
188
  dup.call!(env)
189
189
  end
190
-
190
+
191
191
  # Rack Interface
192
192
  #
193
193
  # @param env Rack environment
@@ -197,13 +197,14 @@ module Middleman
197
197
  self.req = req = ::Rack::Request.new(env)
198
198
  self.res = res = ::Rack::Response.new
199
199
 
200
- puts "== Request: #{env["PATH_INFO"]}" if logging?
200
+ logger.debug "== Request: #{env["PATH_INFO"]}"
201
201
 
202
202
  # Catch :halt exceptions and use that response if given
203
203
  catch(:halt) do
204
204
  process_request(env, req, res)
205
205
 
206
206
  res.status = 404
207
+
207
208
  res.finish
208
209
  end
209
210
  end
@@ -214,8 +215,8 @@ module Middleman
214
215
  def halt(response)
215
216
  throw :halt, response
216
217
  end
217
-
218
- # Core response method. We process the request, check with
218
+
219
+ # Core response method. We process the request, check with
219
220
  # the sitemap, and return the correct file, response or status
220
221
  # message.
221
222
  #
@@ -251,7 +252,7 @@ module Middleman
251
252
  return send_file(resource.source_file, env, res) unless resource.template?
252
253
 
253
254
  current_path = request_path.dup
254
-
255
+
255
256
  # Set a HTTP content type based on the request's extensions
256
257
  content_type(res, resource.mime_type)
257
258
 
@@ -271,10 +272,10 @@ module Middleman
271
272
  end
272
273
 
273
274
  # End the request
274
- puts "== Finishing Request: #{request_path} (#{(Time.now - start_time).round(2)}s)" if logging?
275
+ logger.debug "== Finishing Request: #{request_path} (#{(Time.now - start_time).round(2)}s)"
275
276
  halt res.finish
276
277
  end
277
-
278
+
278
279
  # Add a new mime-type for a specific extension
279
280
  #
280
281
  # @param [Symbol] type File extension