middleman-core 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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/features/asset_hash.feature +44 -6
  4. data/features/asset_host.feature +1 -0
  5. data/features/automatic_image_sizes.feature +18 -5
  6. data/fixtures/asset-hash-host-app/source/index.html.erb +1 -1
  7. data/fixtures/asset-host-app/config.rb +1 -0
  8. data/fixtures/asset-host-app/source/asset_host.html.erb +9 -0
  9. data/fixtures/automatic-image-size-app/source/markdown-sizes.html.markdown +1 -0
  10. data/lib/middleman-core/application.rb +68 -58
  11. data/lib/middleman-core/builder.rb +24 -18
  12. data/lib/middleman-core/callback_manager.rb +8 -1
  13. data/lib/middleman-core/contracts.rb +13 -102
  14. data/lib/middleman-core/core_extensions.rb +6 -0
  15. data/lib/middleman-core/core_extensions/collections/lazy_step.rb +1 -1
  16. data/lib/middleman-core/core_extensions/data.rb +3 -2
  17. data/lib/middleman-core/core_extensions/default_helpers.rb +5 -5
  18. data/lib/middleman-core/core_extensions/external_helpers.rb +6 -11
  19. data/lib/middleman-core/core_extensions/file_watcher.rb +1 -1
  20. data/lib/middleman-core/core_extensions/front_matter.rb +1 -0
  21. data/lib/middleman-core/core_extensions/i18n.rb +4 -4
  22. data/lib/middleman-core/core_extensions/inline_url_rewriter.rb +150 -0
  23. data/lib/middleman-core/core_extensions/routing.rb +22 -28
  24. data/lib/middleman-core/core_extensions/show_exceptions.rb +1 -7
  25. data/lib/middleman-core/extension.rb +19 -2
  26. data/lib/middleman-core/extension_manager.rb +2 -0
  27. data/lib/middleman-core/extensions.rb +12 -0
  28. data/lib/middleman-core/extensions/asset_hash.rb +21 -20
  29. data/lib/middleman-core/extensions/asset_host.rb +9 -10
  30. data/lib/middleman-core/extensions/automatic_image_sizes.rb +1 -1
  31. data/lib/middleman-core/extensions/cache_buster.rb +6 -12
  32. data/lib/middleman-core/extensions/gzip.rb +2 -2
  33. data/lib/middleman-core/extensions/lorem.rb +1 -1
  34. data/lib/middleman-core/extensions/minify_css.rb +2 -2
  35. data/lib/middleman-core/extensions/minify_javascript.rb +2 -2
  36. data/lib/middleman-core/extensions/relative_assets.rb +6 -12
  37. data/lib/middleman-core/preview_server.rb +11 -9
  38. data/lib/middleman-core/preview_server/server_hostname.rb +2 -2
  39. data/lib/middleman-core/rack.rb +1 -1
  40. data/lib/middleman-core/renderers/kramdown.rb +1 -1
  41. data/lib/middleman-core/renderers/less.rb +3 -4
  42. data/lib/middleman-core/renderers/markdown.rb +2 -8
  43. data/lib/middleman-core/renderers/redcarpet.rb +1 -1
  44. data/lib/middleman-core/renderers/sass.rb +8 -11
  45. data/lib/middleman-core/renderers/stylus.rb +1 -5
  46. data/lib/middleman-core/sitemap/extensions/ignores.rb +5 -4
  47. data/lib/middleman-core/sitemap/extensions/import.rb +12 -15
  48. data/lib/middleman-core/sitemap/extensions/move_file.rb +3 -3
  49. data/lib/middleman-core/sitemap/extensions/proxies.rb +4 -4
  50. data/lib/middleman-core/sitemap/extensions/redirects.rb +16 -28
  51. data/lib/middleman-core/sitemap/extensions/request_endpoints.rb +17 -35
  52. data/lib/middleman-core/sitemap/extensions/traversal.rb +5 -5
  53. data/lib/middleman-core/sitemap/resource.rb +16 -16
  54. data/lib/middleman-core/sitemap/store.rb +42 -31
  55. data/lib/middleman-core/sources.rb +9 -9
  56. data/lib/middleman-core/sources/source_watcher.rb +14 -10
  57. data/lib/middleman-core/step_definitions/server_steps.rb +12 -4
  58. data/lib/middleman-core/template_context.rb +1 -1
  59. data/lib/middleman-core/template_renderer.rb +74 -75
  60. data/lib/middleman-core/util.rb +19 -16
  61. data/lib/middleman-core/util/data.rb +86 -82
  62. data/lib/middleman-core/version.rb +1 -1
  63. data/middleman-core.gemspec +1 -0
  64. metadata +19 -39
  65. data/features/cli/preview_server-hook.feature +0 -17
  66. data/features/cli/preview_server.feature +0 -536
  67. data/features/cli_extension.feature +0 -14
  68. data/features/cli_init.feature +0 -89
  69. data/fixtures/asset-hash-host-app/config.rb +0 -4
  70. data/fixtures/preview-server-app/bin/dns_server.rb +0 -33
  71. data/fixtures/preview-server-app/config.rb +0 -0
  72. data/fixtures/preview-server-app/source/index.html.erb +0 -1
  73. data/fixtures/preview-server-app/source/layout.erb +0 -9
  74. data/fixtures/preview-server-app/source/layouts/custom.erb +0 -8
  75. data/fixtures/preview-server-app/source/real.html +0 -1
  76. data/fixtures/preview-server-app/source/real/index.html.erb +0 -5
  77. data/fixtures/preview-server-app/source/should_be_ignored.html +0 -1
  78. data/fixtures/preview-server-app/source/should_be_ignored2.html +0 -1
  79. data/fixtures/preview-server-app/source/should_be_ignored3.html +0 -1
  80. data/fixtures/preview-server-app/source/static.html +0 -1
  81. data/fixtures/preview-server-hook-app/config.rb +0 -19
  82. data/fixtures/preview-server-hook-app/source/index.html.erb +0 -9
  83. data/lib/middleman-core/middleware/inline_url_rewriter.rb +0 -109
@@ -35,7 +35,7 @@ module Middleman
35
35
  def convert_a(el, indent)
36
36
  content = inner(el, indent)
37
37
 
38
- if el.attr['href'] =~ /\Amailto:/
38
+ if el.attr['href'].start_with?('mailto:')
39
39
  mail_addr = el.attr['href'].sub(/\Amailto:/, '')
40
40
  href = obfuscate('mailto') << ':' << obfuscate(mail_addr)
41
41
  content = obfuscate(content) if content == mail_addr
@@ -4,12 +4,11 @@ module Middleman
4
4
  module Renderers
5
5
  # Sass renderer
6
6
  class Less < ::Middleman::Extension
7
+ define_setting :less, {}, 'LESS compiler options'
8
+
7
9
  def initialize(app, options={}, &block)
8
10
  super
9
11
 
10
- # Default less options
11
- app.config.define_setting :less, {}, 'LESS compiler options'
12
-
13
12
  # Tell Tilt to use it as well (for inline sass blocks)
14
13
  ::Tilt.register 'less', LocalLoadingLessTemplate
15
14
  ::Tilt.prefer(LocalLoadingLessTemplate)
@@ -27,7 +26,7 @@ module Middleman
27
26
  if ::Less.const_defined? :Engine
28
27
  @engine = ::Less::Engine.new(data)
29
28
  else
30
- parser = ::Less::Parser.new(options.merge filename: eval_file, line: line, paths: ['.', File.dirname(eval_file)])
29
+ parser = ::Less::Parser.new(options.merge(filename: eval_file, line: line, paths: ['.', File.dirname(eval_file)]))
31
30
  @engine = parser.parse(data)
32
31
  end
33
32
  end
@@ -2,14 +2,8 @@ module Middleman
2
2
  module Renderers
3
3
  # Markdown renderer
4
4
  class Markdown < ::Middleman::Extension
5
- # Once registered
6
- def initialize(app, options={}, &block)
7
- super
8
-
9
- # Set our preference for a markdown engine
10
- app.config.define_setting :markdown_engine, :kramdown, 'Preferred markdown engine'
11
- app.config.define_setting :markdown_engine_prefix, ::Tilt, 'The parent module for markdown template engines'
12
- end
5
+ define_setting :markdown_engine, :kramdown, 'Preferred markdown engine'
6
+ define_setting :markdown_engine_prefix, ::Tilt, 'The parent module for markdown template engines'
13
7
 
14
8
  # Once configuration is parsed
15
9
  def after_configuration
@@ -8,7 +8,7 @@ module Middleman
8
8
  # in the wrong direction
9
9
  ALIASES = {
10
10
  escape_html: :filter_html
11
- }
11
+ }.freeze
12
12
 
13
13
  def initialize(*args, &block)
14
14
  super
@@ -4,6 +4,12 @@ module Middleman
4
4
  module Renderers
5
5
  # Sass renderer
6
6
  class Sass < ::Middleman::Extension
7
+ opts = { output_style: :nested }
8
+ opts[:line_comments] = false if ENV['TEST']
9
+ define_setting :sass, opts, 'Sass engine options'
10
+ define_setting :sass_assets_paths, [], 'Paths to extra SASS/SCSS files'
11
+ define_setting :sass_source_maps, nil, 'Whether to inline sourcemap into Sass'
12
+
7
13
  # Setup extension
8
14
  def initialize(app, options={}, &block)
9
15
  super
@@ -12,15 +18,6 @@ module Middleman
12
18
 
13
19
  app.files.ignore :sass_cache, :source, /(^|\/)\.sass-cache\//
14
20
 
15
- opts = { output_style: :nested }
16
- opts[:line_comments] = false if ENV['TEST']
17
-
18
- # Default sass options
19
- app.config.define_setting :sass, opts, 'Sass engine options'
20
-
21
- app.config.define_setting :sass_assets_paths, [], 'Paths to extra SASS/SCSS files'
22
- app.config.define_setting :sass_source_maps, app.development?, 'Whether to inline sourcemap into Sass'
23
-
24
21
  # Tell Tilt to use it as well (for inline sass blocks)
25
22
  ::Tilt.register 'sass', SassPlusCSSFilenameTemplate
26
23
  ::Tilt.prefer(SassPlusCSSFilenameTemplate)
@@ -75,7 +72,7 @@ module Middleman
75
72
  ctx = @context
76
73
 
77
74
  more_opts = {
78
- load_paths: ::Sass.load_paths | ctx.config[:sass_assets_paths],
75
+ load_paths: ::Sass.load_paths | ctx.app.config[:sass_assets_paths],
79
76
  filename: eval_file,
80
77
  line: line,
81
78
  syntax: syntax,
@@ -85,7 +82,7 @@ module Middleman
85
82
  )
86
83
  }
87
84
 
88
- if ctx.config[:sass_source_maps]
85
+ if ctx.app.config[:sass_source_maps] || (ctx.app.config[:sass_source_maps].nil? && ctx.app.development?)
89
86
  more_opts[:source_map_file] = '.'
90
87
  more_opts[:source_map_embed] = true
91
88
  more_opts[:source_map_contents] = true
@@ -4,11 +4,7 @@ require 'stylus/tilt'
4
4
  module Middleman
5
5
  module Renderers
6
6
  class Stylus < ::Middleman::Extension
7
- def initialize(app, options={}, &block)
8
- super
9
-
10
- app.config.define_setting :styl, {}, 'Stylus config options'
11
- end
7
+ define_setting :styl, {}, 'Stylus config options'
12
8
  end
13
9
  end
14
10
  end
@@ -5,13 +5,14 @@ module Middleman
5
5
  class Ignores < ConfigExtension
6
6
  self.resource_list_manipulator_priority = 0
7
7
 
8
- expose_to_config ignore: :create_ignore
8
+ expose_to_application :ignore
9
+ expose_to_config :ignore
9
10
 
10
11
  # Ignore a path or add an ignore callback
11
12
  # @param [String, Regexp] path Path glob expression, or path regex
12
13
  # @return [IgnoreDescriptor]
13
14
  Contract Maybe[Or[String, Regexp]], Maybe[Proc] => RespondTo[:execute_descriptor]
14
- def create_ignore(path=nil, &block)
15
+ def ignore(path=nil, &block)
15
16
  @app.sitemap.invalidate_resources_not_ignored_cache!
16
17
  IgnoreDescriptor.new(path, block)
17
18
  end
@@ -22,9 +23,9 @@ module Middleman
22
23
  # Ignore based on the source path (without template extensions)
23
24
  if ignored?(r.path)
24
25
  r.ignore!
25
- else
26
+ elsif !r.is_a?(ProxyResource) && r.file_descriptor && ignored?(r.file_descriptor[:relative_path].to_s)
26
27
  # This allows files to be ignored by their source file name (with template extensions)
27
- r.ignore! if !r.is_a?(ProxyResource) && r.file_descriptor && ignored?(r.file_descriptor[:relative_path].to_s)
28
+ r.ignore!
28
29
  end
29
30
 
30
31
  r
@@ -7,11 +7,8 @@ module Middleman
7
7
  class Import < ConfigExtension
8
8
  self.resource_list_manipulator_priority = 1
9
9
 
10
- # Expose `create_import_file` to config as `import_file`
11
- expose_to_config import_file: :create_import_file
12
-
13
- # Expose `create_import_path` to config as `import_path`
14
- expose_to_config import_path: :create_import_path
10
+ # Expose methods
11
+ expose_to_config :import_file, :import_path
15
12
 
16
13
  ImportFileDescriptor = Struct.new(:from, :to) do
17
14
  def execute_descriptor(app, resources)
@@ -26,14 +23,14 @@ module Middleman
26
23
  resources + ::Middleman::Util.glob_directory(File.join(from, '**/*'))
27
24
  .reject { |path| File.directory?(path) }
28
25
  .map do |path|
29
- target_path = Pathname(path).relative_path_from(Pathname(from).parent).to_s
30
-
31
- ::Middleman::Sitemap::Resource.new(
32
- app.sitemap,
33
- renameProc.call(target_path, path),
34
- path
35
- )
36
- end
26
+ target_path = Pathname(path).relative_path_from(Pathname(from).parent).to_s
27
+
28
+ ::Middleman::Sitemap::Resource.new(
29
+ app.sitemap,
30
+ renameProc.call(target_path, path),
31
+ path
32
+ )
33
+ end
37
34
  end
38
35
  end
39
36
 
@@ -42,7 +39,7 @@ module Middleman
42
39
  # @param [String] to The new path.
43
40
  # @return [void]
44
41
  Contract String, String => ImportFileDescriptor
45
- def create_import_file(from, to)
42
+ def import_file(from, to)
46
43
  ImportFileDescriptor.new(
47
44
  File.expand_path(from, @app.root),
48
45
  ::Middleman::Util.normalize_path(to)
@@ -54,7 +51,7 @@ module Middleman
54
51
  # @param [Proc] block Renaming method
55
52
  # @return [void]
56
53
  Contract String, Maybe[Proc] => ImportPathDescriptor
57
- def create_import_path(from, &block)
54
+ def import_path(from, &block)
58
55
  ImportPathDescriptor.new(
59
56
  from,
60
57
  block_given? ? block : proc { |path| path }
@@ -9,8 +9,8 @@ module Middleman
9
9
  class MoveFile < ConfigExtension
10
10
  self.resource_list_manipulator_priority = 101
11
11
 
12
- # Expose `create_move_file` to config as `move_file`
13
- expose_to_config move_file: :create_move_file
12
+ # Expose `move_file`
13
+ expose_to_config :move_file
14
14
 
15
15
  MoveFileDescriptor = Struct.new(:from, :to) do
16
16
  def execute_descriptor(_app, resources)
@@ -27,7 +27,7 @@ module Middleman
27
27
  # @param [String] to The new path.
28
28
  # @return [void]
29
29
  Contract String, String => MoveFileDescriptor
30
- def create_move_file(from, to)
30
+ def move_file(from, to)
31
31
  MoveFileDescriptor.new(
32
32
  ::Middleman::Util.normalize_path(from),
33
33
  ::Middleman::Util.normalize_path(to)
@@ -9,8 +9,8 @@ module Middleman
9
9
  class Proxies < ConfigExtension
10
10
  self.resource_list_manipulator_priority = 0
11
11
 
12
- # Expose `create_proxy` to config as `proxy`
13
- expose_to_config proxy: :create_proxy
12
+ # Expose `proxy`
13
+ expose_to_config :proxy
14
14
 
15
15
  # Setup a proxy from a path to a target
16
16
  # @param [String] path The new, proxied path to create
@@ -22,7 +22,7 @@ module Middleman
22
22
  # @option opts [Hash] data Extra metadata to add to the page. This is the same as frontmatter, though frontmatter will take precedence over metadata defined here. Available via {Resource#data}.
23
23
  # @return [ProxyDescriptor]
24
24
  Contract String, String, Maybe[Hash] => RespondTo[:execute_descriptor]
25
- def create_proxy(path, target, opts={})
25
+ def proxy(path, target, opts={})
26
26
  ProxyDescriptor.new(
27
27
  ::Middleman::Util.normalize_path(path),
28
28
  ::Middleman::Util.normalize_path(target),
@@ -113,7 +113,7 @@ module Middleman
113
113
  def to_s
114
114
  "#<#{self.class} path=#{@path} target=#{@target}>"
115
115
  end
116
- alias_method :inspect, :to_s
116
+ alias inspect to_s
117
117
  end
118
118
  end
119
119
  end
@@ -6,43 +6,31 @@ module Middleman
6
6
  module Extensions
7
7
  # Manages the list of proxy configurations and manipulates the sitemap
8
8
  # to include new resources based on those configurations
9
- class Redirects < Extension
9
+ class Redirects < ConfigExtension
10
10
  self.resource_list_manipulator_priority = 0
11
11
 
12
- # Expose `create_redirect` to config as `redirect`
13
- expose_to_config redirect: :create_redirect
12
+ # Expose `redirect`
13
+ expose_to_config :redirect
14
14
 
15
- def initialize(app, config={}, &block)
16
- super
15
+ RedirectDescriptor = Struct.new(:path, :to, :template) do
16
+ def execute_descriptor(app, resources)
17
+ r = RedirectResource.new(
18
+ app.sitemap,
19
+ path,
20
+ to
21
+ )
22
+ r.output = template if template
17
23
 
18
- @redirects = {}
24
+ resources + [r]
25
+ end
19
26
  end
20
27
 
21
28
  # Setup a redirect from a path to a target
22
29
  # @param [String] path
23
30
  # @param [Hash] opts The :to value gives a target path
24
- Contract String, ({ to: Or[String, IsA['Middleman::Sitemap::Resource']] }), Maybe[Proc] => Any
25
- def create_redirect(path, opts={}, &block)
26
- opts[:template] = block if block_given?
27
-
28
- @redirects[path] = opts
29
-
30
- @app.sitemap.rebuild_resource_list!(:added_redirect)
31
- end
32
-
33
- # Update the main sitemap resource list
34
- # @return Array<Middleman::Sitemap::Resource>
35
- Contract ResourceList => ResourceList
36
- def manipulate_resource_list(resources)
37
- resources + @redirects.map do |path, opts|
38
- r = RedirectResource.new(
39
- @app.sitemap,
40
- path,
41
- opts[:to]
42
- )
43
- r.output = opts[:template] if opts[:template]
44
- r
45
- end
31
+ Contract String, { to: Or[String, ::Middleman::Sitemap::Resource] }, Maybe[Proc] => RedirectDescriptor
32
+ def redirect(path, opts={}, &block)
33
+ RedirectDescriptor.new(path, opts[:to], block_given? ? block : nil)
46
34
  end
47
35
  end
48
36
 
@@ -3,53 +3,35 @@ require 'middleman-core/sitemap/resource'
3
3
  module Middleman
4
4
  module Sitemap
5
5
  module Extensions
6
- class RequestEndpoints < Extension
6
+ class RequestEndpoints < ConfigExtension
7
7
  self.resource_list_manipulator_priority = 0
8
8
 
9
- # Expose `create_endpoint` to config as `endpoint`
10
- expose_to_config endpoint: :create_endpoint
9
+ # Expose `endpoint`
10
+ expose_to_config :endpoint
11
11
 
12
- # Manages the list of proxy configurations and manipulates the sitemap
13
- # to include new resources based on those configurations
14
- def initialize(app, config={}, &block)
15
- super
12
+ EndpointDescriptor = Struct.new(:path, :request_path, :block) do
13
+ def execute_descriptor(app, resources)
14
+ r = EndpointResource.new(
15
+ app.sitemap,
16
+ path,
17
+ request_path
18
+ )
19
+ r.output = block if block
16
20
 
17
- @endpoints = {}
21
+ resources + [r]
22
+ end
18
23
  end
19
24
 
20
25
  # Setup a proxy from a path to a target
21
26
  # @param [String] path
22
27
  # @param [Hash] opts The :path value gives a request path if it
23
28
  # differs from the output path
24
- Contract String, Or[({ path: String }), Proc] => Any
25
- def create_endpoint(path, opts={}, &block)
26
- endpoint = {
27
- request_path: path
28
- }
29
-
29
+ Contract String, Or[{ path: String }, Proc] => EndpointDescriptor
30
+ def endpoint(path, opts={}, &block)
30
31
  if block_given?
31
- endpoint[:output] = block
32
+ EndpointDescriptor.new(path, path, block)
32
33
  else
33
- endpoint[:request_path] = opts[:path] if opts.key?(:path)
34
- end
35
-
36
- @endpoints[path] = endpoint
37
-
38
- @app.sitemap.rebuild_resource_list!(:added_endpoint)
39
- end
40
-
41
- # Update the main sitemap resource list
42
- # @return Array<Middleman::Sitemap::Resource>
43
- Contract ResourceList => ResourceList
44
- def manipulate_resource_list(resources)
45
- resources + @endpoints.map do |path, config|
46
- r = EndpointResource.new(
47
- @app.sitemap,
48
- path,
49
- config[:request_path]
50
- )
51
- r.output = config[:output] if config.key?(:output)
52
- r
34
+ EndpointDescriptor.new(path, opts[:path] || path, nil)
53
35
  end
54
36
  end
55
37
  end
@@ -44,14 +44,14 @@ module Middleman
44
44
  def children
45
45
  return [] unless directory_index?
46
46
 
47
- if eponymous_directory?
48
- base_path = eponymous_directory_path
49
- prefix = %r{^#{base_path.sub("/", "\\/")}}
47
+ base_path = if eponymous_directory?
48
+ eponymous_directory_path
50
49
  else
51
- base_path = path.sub("#{@app.config[:index_file]}", '')
52
- prefix = %r{^#{base_path.sub("/", "\\/")}}
50
+ path.sub(@app.config[:index_file].to_s, '')
53
51
  end
54
52
 
53
+ prefix = %r{^#{base_path.sub("/", "\\/")}}
54
+
55
55
  @store.resources.select do |sub_resource|
56
56
  if sub_resource.path == path || sub_resource.path !~ prefix
57
57
  false
@@ -29,9 +29,9 @@ module Middleman
29
29
  # The path to use when requesting this resource. Normally it's
30
30
  # the same as {#destination_path} but it can be overridden in subclasses.
31
31
  # @return [String]
32
- alias_method :request_path, :destination_path
32
+ alias request_path destination_path
33
33
 
34
- METADATA_HASH = ({ options: Maybe[Hash], locals: Maybe[Hash], page: Maybe[Hash] })
34
+ METADATA_HASH = { options: Maybe[Hash], locals: Maybe[Hash], page: Maybe[Hash] }.freeze
35
35
 
36
36
  # The metadata for this resource
37
37
  # @return [Hash]
@@ -53,10 +53,10 @@ module Middleman
53
53
 
54
54
  source = Pathname(source) if source && source.is_a?(String)
55
55
 
56
- if source && source.is_a?(Pathname)
57
- @file_descriptor = ::Middleman::SourceFile.new(source.relative_path_from(@app.source_dir), source, @app.source_dir, Set.new([:source]))
56
+ @file_descriptor = if source && source.is_a?(Pathname)
57
+ ::Middleman::SourceFile.new(source.relative_path_from(@app.source_dir), source, @app.source_dir, Set.new([:source]))
58
58
  else
59
- @file_descriptor = source
59
+ source
60
60
  end
61
61
 
62
62
  @destination_path = @path
@@ -129,18 +129,18 @@ module Middleman
129
129
  def render(opts={}, locs={})
130
130
  return ::Middleman::FileRenderer.new(@app, file_descriptor[:full_path].to_s).template_data_for_file unless template?
131
131
 
132
- ::Middleman::Util.instrument 'render.resource', path: file_descriptor[:full_path].to_s, destination_path: destination_path do
133
- md = metadata
134
- opts = md[:options].deep_merge(opts)
135
- locs = md[:locals].deep_merge(locs)
136
- locs[:current_path] ||= destination_path
132
+ # ::Middleman::Util.instrument 'render.resource', path: file_descriptor[:full_path].to_s, destination_path: destination_path do
133
+ md = metadata
134
+ opts = md[:options].deep_merge(opts)
135
+ locs = md[:locals].deep_merge(locs)
136
+ locs[:current_path] ||= destination_path
137
137
 
138
- # Certain output file types don't use layouts
139
- opts[:layout] = false if !opts.key?(:layout) && ext != '.html'
138
+ # Certain output file types don't use layouts
139
+ opts[:layout] = false if !opts.key?(:layout) && ext != '.html'
140
140
 
141
- renderer = ::Middleman::TemplateRenderer.new(@app, file_descriptor[:full_path].to_s)
142
- renderer.render(locs, opts)
143
- end
141
+ renderer = ::Middleman::TemplateRenderer.new(@app, file_descriptor[:full_path].to_s)
142
+ renderer.render(locs, opts)
143
+ # end
144
144
  end
145
145
 
146
146
  # A path without the directory index - so foo/index.html becomes
@@ -189,7 +189,7 @@ module Middleman
189
189
  def to_s
190
190
  "#<#{self.class} path=#{@path}>"
191
191
  end
192
- alias_method :inspect, :to_s # Ruby 2.0 calls inspect for NoMethodError instead of to_s
192
+ alias inspect to_s # Ruby 2.0 calls inspect for NoMethodError instead of to_s
193
193
  end
194
194
 
195
195
  class StringResource < Resource