bridgetown-core 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +42 -0
  3. data/bridgetown-core.gemspec +46 -0
  4. data/lib/bridgetown-core.rb +202 -0
  5. data/lib/bridgetown-core/cache.rb +190 -0
  6. data/lib/bridgetown-core/cleaner.rb +111 -0
  7. data/lib/bridgetown-core/collection.rb +279 -0
  8. data/lib/bridgetown-core/command.rb +106 -0
  9. data/lib/bridgetown-core/commands/build.rb +96 -0
  10. data/lib/bridgetown-core/commands/clean.rb +43 -0
  11. data/lib/bridgetown-core/commands/console.rb +56 -0
  12. data/lib/bridgetown-core/commands/doctor.rb +172 -0
  13. data/lib/bridgetown-core/commands/help.rb +34 -0
  14. data/lib/bridgetown-core/commands/new.rb +148 -0
  15. data/lib/bridgetown-core/commands/serve.rb +273 -0
  16. data/lib/bridgetown-core/commands/serve/servlet.rb +68 -0
  17. data/lib/bridgetown-core/configuration.rb +323 -0
  18. data/lib/bridgetown-core/converter.rb +54 -0
  19. data/lib/bridgetown-core/converters/identity.rb +39 -0
  20. data/lib/bridgetown-core/converters/markdown.rb +108 -0
  21. data/lib/bridgetown-core/converters/markdown/kramdown_parser.rb +132 -0
  22. data/lib/bridgetown-core/converters/smartypants.rb +69 -0
  23. data/lib/bridgetown-core/convertible.rb +237 -0
  24. data/lib/bridgetown-core/deprecator.rb +50 -0
  25. data/lib/bridgetown-core/document.rb +475 -0
  26. data/lib/bridgetown-core/drops/bridgetown_drop.rb +32 -0
  27. data/lib/bridgetown-core/drops/collection_drop.rb +20 -0
  28. data/lib/bridgetown-core/drops/document_drop.rb +69 -0
  29. data/lib/bridgetown-core/drops/drop.rb +215 -0
  30. data/lib/bridgetown-core/drops/excerpt_drop.rb +19 -0
  31. data/lib/bridgetown-core/drops/page_drop.rb +14 -0
  32. data/lib/bridgetown-core/drops/site_drop.rb +62 -0
  33. data/lib/bridgetown-core/drops/static_file_drop.rb +14 -0
  34. data/lib/bridgetown-core/drops/unified_payload_drop.rb +26 -0
  35. data/lib/bridgetown-core/drops/url_drop.rb +132 -0
  36. data/lib/bridgetown-core/entry_filter.rb +108 -0
  37. data/lib/bridgetown-core/errors.rb +20 -0
  38. data/lib/bridgetown-core/excerpt.rb +202 -0
  39. data/lib/bridgetown-core/external.rb +62 -0
  40. data/lib/bridgetown-core/filters.rb +467 -0
  41. data/lib/bridgetown-core/filters/date_filters.rb +110 -0
  42. data/lib/bridgetown-core/filters/grouping_filters.rb +64 -0
  43. data/lib/bridgetown-core/filters/url_filters.rb +79 -0
  44. data/lib/bridgetown-core/frontmatter_defaults.rb +238 -0
  45. data/lib/bridgetown-core/generator.rb +5 -0
  46. data/lib/bridgetown-core/hooks.rb +103 -0
  47. data/lib/bridgetown-core/layout.rb +57 -0
  48. data/lib/bridgetown-core/liquid_extensions.rb +22 -0
  49. data/lib/bridgetown-core/liquid_renderer.rb +71 -0
  50. data/lib/bridgetown-core/liquid_renderer/file.rb +67 -0
  51. data/lib/bridgetown-core/liquid_renderer/table.rb +75 -0
  52. data/lib/bridgetown-core/log_adapter.rb +151 -0
  53. data/lib/bridgetown-core/log_writer.rb +60 -0
  54. data/lib/bridgetown-core/mime.types +867 -0
  55. data/lib/bridgetown-core/page.rb +214 -0
  56. data/lib/bridgetown-core/page_without_a_file.rb +14 -0
  57. data/lib/bridgetown-core/path_manager.rb +31 -0
  58. data/lib/bridgetown-core/plugin.rb +80 -0
  59. data/lib/bridgetown-core/plugin_manager.rb +60 -0
  60. data/lib/bridgetown-core/publisher.rb +23 -0
  61. data/lib/bridgetown-core/reader.rb +185 -0
  62. data/lib/bridgetown-core/readers/collection_reader.rb +22 -0
  63. data/lib/bridgetown-core/readers/data_reader.rb +75 -0
  64. data/lib/bridgetown-core/readers/layout_reader.rb +48 -0
  65. data/lib/bridgetown-core/readers/page_reader.rb +24 -0
  66. data/lib/bridgetown-core/readers/post_reader.rb +74 -0
  67. data/lib/bridgetown-core/readers/static_file_reader.rb +24 -0
  68. data/lib/bridgetown-core/regenerator.rb +195 -0
  69. data/lib/bridgetown-core/related_posts.rb +52 -0
  70. data/lib/bridgetown-core/renderer.rb +261 -0
  71. data/lib/bridgetown-core/site.rb +469 -0
  72. data/lib/bridgetown-core/static_file.rb +205 -0
  73. data/lib/bridgetown-core/tags/component.rb +34 -0
  74. data/lib/bridgetown-core/tags/highlight.rb +111 -0
  75. data/lib/bridgetown-core/tags/include.rb +220 -0
  76. data/lib/bridgetown-core/tags/link.rb +41 -0
  77. data/lib/bridgetown-core/tags/post_url.rb +107 -0
  78. data/lib/bridgetown-core/url.rb +164 -0
  79. data/lib/bridgetown-core/utils.rb +367 -0
  80. data/lib/bridgetown-core/utils/ansi.rb +57 -0
  81. data/lib/bridgetown-core/utils/exec.rb +26 -0
  82. data/lib/bridgetown-core/utils/internet.rb +37 -0
  83. data/lib/bridgetown-core/utils/platforms.rb +80 -0
  84. data/lib/bridgetown-core/utils/thread_event.rb +31 -0
  85. data/lib/bridgetown-core/utils/win_tz.rb +75 -0
  86. data/lib/bridgetown-core/version.rb +5 -0
  87. data/lib/bridgetown-core/watcher.rb +139 -0
  88. data/lib/site_template/.gitignore +6 -0
  89. data/lib/site_template/bridgetown.config.yml +21 -0
  90. data/lib/site_template/frontend/javascript/index.js +3 -0
  91. data/lib/site_template/frontend/styles/index.scss +17 -0
  92. data/lib/site_template/package.json +23 -0
  93. data/lib/site_template/src/404.html +9 -0
  94. data/lib/site_template/src/_data/site_metadata.yml +11 -0
  95. data/lib/site_template/src/_includes/footer.html +3 -0
  96. data/lib/site_template/src/_includes/head.html +9 -0
  97. data/lib/site_template/src/_includes/navbar.html +4 -0
  98. data/lib/site_template/src/_layouts/default.html +15 -0
  99. data/lib/site_template/src/_layouts/home.html +7 -0
  100. data/lib/site_template/src/_layouts/page.html +7 -0
  101. data/lib/site_template/src/_layouts/post.html +7 -0
  102. data/lib/site_template/src/_posts/0000-00-00-welcome-to-bridgetown.md.erb +26 -0
  103. data/lib/site_template/src/about.md +11 -0
  104. data/lib/site_template/src/index.md +7 -0
  105. data/lib/site_template/webpack.config.js +60 -0
  106. data/rake/release.rake +30 -0
  107. metadata +106 -1
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bridgetown
4
+ Generator = Class.new(Plugin)
5
+ end
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bridgetown
4
+ module Hooks
5
+ DEFAULT_PRIORITY = 20
6
+
7
+ # compatibility layer for octopress-hooks users
8
+ PRIORITY_MAP = {
9
+ :low => 10,
10
+ :normal => 20,
11
+ :high => 30,
12
+ }.freeze
13
+
14
+ # initial empty hooks
15
+ @registry = {
16
+ :site => {
17
+ :after_init => [],
18
+ :after_reset => [],
19
+ :post_read => [],
20
+ :pre_render => [],
21
+ :post_render => [],
22
+ :post_write => [],
23
+ },
24
+ :pages => {
25
+ :post_init => [],
26
+ :pre_render => [],
27
+ :post_render => [],
28
+ :post_write => [],
29
+ },
30
+ :posts => {
31
+ :post_init => [],
32
+ :pre_render => [],
33
+ :post_render => [],
34
+ :post_write => [],
35
+ },
36
+ :documents => {
37
+ :post_init => [],
38
+ :pre_render => [],
39
+ :post_render => [],
40
+ :post_write => [],
41
+ },
42
+ :clean => {
43
+ :on_obsolete => [],
44
+ },
45
+ }
46
+
47
+ # map of all hooks and their priorities
48
+ @hook_priority = {}
49
+
50
+ NotAvailable = Class.new(RuntimeError)
51
+ Uncallable = Class.new(RuntimeError)
52
+
53
+ # register hook(s) to be called later, public API
54
+ def self.register(owners, event, priority: DEFAULT_PRIORITY, &block)
55
+ Array(owners).each do |owner|
56
+ register_one(owner, event, priority_value(priority), &block)
57
+ end
58
+ end
59
+
60
+ # Ensure the priority is a Fixnum
61
+ def self.priority_value(priority)
62
+ return priority if priority.is_a?(Integer)
63
+
64
+ PRIORITY_MAP[priority] || DEFAULT_PRIORITY
65
+ end
66
+
67
+ # register a single hook to be called later, internal API
68
+ def self.register_one(owner, event, priority, &block)
69
+ @registry[owner] ||= {
70
+ :post_init => [],
71
+ :pre_render => [],
72
+ :post_render => [],
73
+ :post_write => [],
74
+ }
75
+
76
+ unless @registry[owner][event]
77
+ raise NotAvailable, "Invalid hook. #{owner} supports only the " \
78
+ "following hooks #{@registry[owner].keys.inspect}"
79
+ end
80
+
81
+ raise Uncallable, "Hooks must respond to :call" unless block.respond_to? :call
82
+
83
+ insert_hook owner, event, priority, &block
84
+ end
85
+
86
+ def self.insert_hook(owner, event, priority, &block)
87
+ @hook_priority[block] = [-priority, @hook_priority.size]
88
+ @registry[owner][event] << block
89
+ end
90
+
91
+ # interface for Bridgetown core components to trigger hooks
92
+ def self.trigger(owner, event, *args)
93
+ # proceed only if there are hooks to call
94
+ hooks = @registry.dig(owner, event)
95
+ return if hooks.nil? || hooks.empty?
96
+
97
+ # sort and call hooks according to priority and load order
98
+ hooks.sort_by { |h| @hook_priority[h] }.each do |hook|
99
+ hook.call(*args)
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bridgetown
4
+ class Layout
5
+ include Convertible
6
+
7
+ # Gets the Site object.
8
+ attr_reader :site
9
+
10
+ # Gets the name of this layout.
11
+ attr_reader :name
12
+
13
+ # Gets the path to this layout.
14
+ attr_reader :path
15
+
16
+ # Gets the path to this layout relative to its base
17
+ attr_reader :relative_path
18
+
19
+ # Gets/Sets the extension of this layout.
20
+ attr_accessor :ext
21
+
22
+ # Gets/Sets the Hash that holds the metadata for this layout.
23
+ attr_accessor :data
24
+
25
+ # Gets/Sets the content of this layout.
26
+ attr_accessor :content
27
+
28
+ # Initialize a new Layout.
29
+ #
30
+ # site - The Site.
31
+ # base - The String path to the source.
32
+ # name - The String filename of the post file.
33
+ def initialize(site, base, name)
34
+ @site = site
35
+ @base = base
36
+ @name = name
37
+
38
+ @base_dir = site.source
39
+ @path = site.in_source_dir(base, name)
40
+ @relative_path = @path.sub(@base_dir, "")
41
+
42
+ self.data = {}
43
+
44
+ process(name)
45
+ read_yaml(base, name)
46
+ end
47
+
48
+ # Extract information from the layout filename.
49
+ #
50
+ # name - The String filename of the layout file.
51
+ #
52
+ # Returns nothing.
53
+ def process(name)
54
+ self.ext = File.extname(name)
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bridgetown
4
+ module LiquidExtensions
5
+ # Lookup a Liquid variable in the given context.
6
+ #
7
+ # context - the Liquid context in question.
8
+ # variable - the variable name, as a string.
9
+ #
10
+ # Returns the value of the variable in the context
11
+ # or the variable name if not found.
12
+ def lookup_variable(context, variable)
13
+ lookup = context
14
+
15
+ variable.split(".").each do |value|
16
+ lookup = lookup[value]
17
+ end
18
+
19
+ lookup || variable
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "liquid_renderer/file"
4
+ require_relative "liquid_renderer/table"
5
+
6
+ module Bridgetown
7
+ class LiquidRenderer
8
+ extend Forwardable
9
+
10
+ private def_delegator :@site, :in_source_dir, :source_dir
11
+
12
+ def initialize(site)
13
+ @site = site
14
+ Liquid::Template.error_mode = @site.config["liquid"]["error_mode"].to_sym
15
+ reset
16
+ end
17
+
18
+ def reset
19
+ @stats = {}
20
+ @cache = {}
21
+ end
22
+
23
+ def file(filename)
24
+ filename.match(filename_regex)
25
+ filename = Regexp.last_match(2)
26
+ LiquidRenderer::File.new(self, filename).tap do
27
+ @stats[filename] ||= new_profile_hash
28
+ end
29
+ end
30
+
31
+ def increment_bytes(filename, bytes)
32
+ @stats[filename][:bytes] += bytes
33
+ end
34
+
35
+ def increment_time(filename, time)
36
+ @stats[filename][:time] += time
37
+ end
38
+
39
+ def increment_count(filename)
40
+ @stats[filename][:count] += 1
41
+ end
42
+
43
+ def stats_table(num_of_rows = 50)
44
+ LiquidRenderer::Table.new(@stats).to_s(num_of_rows)
45
+ end
46
+
47
+ def self.format_error(error, path)
48
+ "#{error.message} in #{path}"
49
+ end
50
+
51
+ # A persistent cache to store and retrieve parsed templates based on the filename
52
+ # via `LiquidRenderer::File#parse`
53
+ #
54
+ # It is emptied when `self.reset` is called.
55
+ def cache
56
+ @cache ||= {}
57
+ end
58
+
59
+ private
60
+
61
+ def filename_regex
62
+ @filename_regex ||= begin
63
+ %r!\A(#{Regexp.escape(source_dir)}/|/*)(.*)!i
64
+ end
65
+ end
66
+
67
+ def new_profile_hash
68
+ Hash.new { |hash, key| hash[key] = 0 }
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bridgetown
4
+ class LiquidRenderer
5
+ class File
6
+ def initialize(renderer, filename)
7
+ @renderer = renderer
8
+ @filename = filename
9
+ end
10
+
11
+ def parse(content)
12
+ measure_time do
13
+ @renderer.cache[@filename] ||= Liquid::Template.parse(content, :line_numbers => true)
14
+ end
15
+ @template = @renderer.cache[@filename]
16
+
17
+ self
18
+ end
19
+
20
+ def render(*args)
21
+ measure_time do
22
+ measure_bytes do
23
+ measure_counts do
24
+ @template.render(*args)
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ # This method simply 'rethrows any error' before attempting to render the template.
31
+ def render!(*args)
32
+ measure_time do
33
+ measure_bytes do
34
+ measure_counts do
35
+ @template.render!(*args)
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ def warnings
42
+ @template.warnings
43
+ end
44
+
45
+ private
46
+
47
+ def measure_counts
48
+ @renderer.increment_count(@filename)
49
+ yield
50
+ end
51
+
52
+ def measure_bytes
53
+ yield.tap do |str|
54
+ @renderer.increment_bytes(@filename, str.bytesize)
55
+ end
56
+ end
57
+
58
+ def measure_time
59
+ before = Time.now
60
+ yield
61
+ ensure
62
+ after = Time.now
63
+ @renderer.increment_time(@filename, after - before)
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bridgetown
4
+ class LiquidRenderer
5
+ class Table
6
+ GAUGES = [:count, :bytes, :time].freeze
7
+
8
+ def initialize(stats)
9
+ @stats = stats
10
+ end
11
+
12
+ def to_s(num_of_rows = 50)
13
+ tabulate(data_for_table(num_of_rows))
14
+ end
15
+
16
+ private
17
+
18
+ def tabulate(data)
19
+ require "terminal-table"
20
+
21
+ header = data.shift
22
+ footer = data.pop
23
+ output = +"\n"
24
+
25
+ table = Terminal::Table.new do |t|
26
+ t << header
27
+ t << :separator
28
+ data.each { |row| t << row }
29
+ t << :separator
30
+ t << footer
31
+ t.style = { :alignment => :right, :border_top => false, :border_bottom => false }
32
+ t.align_column(0, :left)
33
+ end
34
+
35
+ output << table.to_s << "\n"
36
+ end
37
+
38
+ # rubocop:disable Metrics/AbcSize
39
+ def data_for_table(num_of_rows)
40
+ sorted = @stats.sort_by { |_, file_stats| -file_stats[:time] }
41
+ sorted = sorted.slice(0, num_of_rows)
42
+
43
+ table = [header_labels]
44
+ totals = Hash.new { |hash, key| hash[key] = 0 }
45
+
46
+ sorted.each do |filename, file_stats|
47
+ GAUGES.each { |gauge| totals[gauge] += file_stats[gauge] }
48
+ row = []
49
+ row << filename
50
+ row << file_stats[:count].to_s
51
+ row << format_bytes(file_stats[:bytes])
52
+ row << format("%.3f", file_stats[:time])
53
+ table << row
54
+ end
55
+
56
+ footer = []
57
+ footer << "TOTAL (for #{sorted.size} files)"
58
+ footer << totals[:count].to_s
59
+ footer << format_bytes(totals[:bytes])
60
+ footer << format("%.3f", totals[:time])
61
+ table << footer
62
+ end
63
+ # rubocop:enable Metrics/AbcSize
64
+
65
+ def header_labels
66
+ GAUGES.map { |gauge| gauge.to_s.capitalize }.unshift("Filename")
67
+ end
68
+
69
+ def format_bytes(bytes)
70
+ bytes /= 1024.0
71
+ format("%.2fK", bytes)
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,151 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bridgetown
4
+ class LogAdapter
5
+ attr_reader :writer, :messages, :level
6
+
7
+ LOG_LEVELS = {
8
+ :debug => ::Logger::DEBUG,
9
+ :info => ::Logger::INFO,
10
+ :warn => ::Logger::WARN,
11
+ :error => ::Logger::ERROR,
12
+ }.freeze
13
+
14
+ # Public: Create a new instance of a log writer
15
+ #
16
+ # writer - Logger compatible instance
17
+ # log_level - (optional, symbol) the log level
18
+ #
19
+ # Returns nothing
20
+ def initialize(writer, level = :info)
21
+ @messages = []
22
+ @writer = writer
23
+ self.log_level = level
24
+ end
25
+
26
+ # Public: Set the log level on the writer
27
+ #
28
+ # level - (symbol) the log level
29
+ #
30
+ # Returns nothing
31
+ def log_level=(level)
32
+ writer.level = level if level.is_a?(Integer) && level.between?(0, 3)
33
+ writer.level = LOG_LEVELS[level] ||
34
+ raise(ArgumentError, "unknown log level")
35
+ @level = level
36
+ end
37
+
38
+ def adjust_verbosity(options = {})
39
+ # Quiet always wins.
40
+ if options[:quiet]
41
+ self.log_level = :error
42
+ elsif options[:verbose]
43
+ self.log_level = :debug
44
+ end
45
+ debug "Logging at level:", LOG_LEVELS.key(writer.level).to_s
46
+ debug "Bridgetown Version:", Bridgetown::VERSION
47
+ end
48
+
49
+ # Public: Print a debug message
50
+ #
51
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
52
+ # message - the message detail
53
+ #
54
+ # Returns nothing
55
+ def debug(topic, message = nil, &block)
56
+ write(:debug, topic, message, &block)
57
+ end
58
+
59
+ # Public: Print a message
60
+ #
61
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
62
+ # message - the message detail
63
+ #
64
+ # Returns nothing
65
+ def info(topic, message = nil, &block)
66
+ write(:info, topic, message, &block)
67
+ end
68
+
69
+ # Public: Print a message
70
+ #
71
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
72
+ # message - the message detail
73
+ #
74
+ # Returns nothing
75
+ def warn(topic, message = nil, &block)
76
+ write(:warn, topic, message, &block)
77
+ end
78
+
79
+ # Public: Print an error message
80
+ #
81
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
82
+ # message - the message detail
83
+ #
84
+ # Returns nothing
85
+ def error(topic, message = nil, &block)
86
+ write(:error, topic, message, &block)
87
+ end
88
+
89
+ # Public: Print an error message and immediately abort the process
90
+ #
91
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
92
+ # message - the message detail (can be omitted)
93
+ #
94
+ # Returns nothing
95
+ def abort_with(topic, message = nil, &block)
96
+ error(topic, message, &block)
97
+ abort
98
+ end
99
+
100
+ # Internal: Build a topic method
101
+ #
102
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
103
+ # message - the message detail
104
+ #
105
+ # Returns the formatted message
106
+ def message(topic, message = nil)
107
+ raise ArgumentError, "block or message, not both" if block_given? && message
108
+
109
+ message = yield if block_given?
110
+ message = message.to_s.gsub(%r!\s+!, " ")
111
+ topic = formatted_topic(topic, block_given?)
112
+ out = topic + message
113
+ messages << out
114
+ out
115
+ end
116
+
117
+ # Internal: Format the topic
118
+ #
119
+ # topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
120
+ # colon -
121
+ #
122
+ # Returns the formatted topic statement
123
+ def formatted_topic(topic, colon = false)
124
+ "#{topic}#{colon ? ": " : " "}".rjust(20)
125
+ end
126
+
127
+ # Internal: Check if the message should be written given the log level.
128
+ #
129
+ # level_of_message - the Symbol level of message, one of :debug, :info, :warn, :error
130
+ #
131
+ # Returns whether the message should be written.
132
+ def write_message?(level_of_message)
133
+ LOG_LEVELS.fetch(level) <= LOG_LEVELS.fetch(level_of_message)
134
+ end
135
+
136
+ # Internal: Log a message.
137
+ #
138
+ # level_of_message - the Symbol level of message, one of :debug, :info, :warn, :error
139
+ # topic - the String topic or full message
140
+ # message - the String message (optional)
141
+ # block - a block containing the message (optional)
142
+ #
143
+ # Returns false if the message was not written, otherwise returns the value of calling
144
+ # the appropriate writer method, e.g. writer.info.
145
+ def write(level_of_message, topic, message = nil, &block)
146
+ return false unless write_message?(level_of_message)
147
+
148
+ writer.public_send(level_of_message, message(topic, message, &block))
149
+ end
150
+ end
151
+ end