jekyll 4.2.1 → 4.3.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 (126) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +474 -350
  3. data/LICENSE +21 -21
  4. data/README.markdown +83 -86
  5. data/exe/jekyll +57 -57
  6. data/lib/blank_template/_config.yml +3 -3
  7. data/lib/blank_template/_layouts/default.html +12 -12
  8. data/lib/blank_template/_sass/{main.scss → base.scss} +9 -9
  9. data/lib/blank_template/assets/css/main.scss +4 -4
  10. data/lib/blank_template/index.md +8 -8
  11. data/lib/jekyll/cache.rb +186 -190
  12. data/lib/jekyll/cleaner.rb +111 -111
  13. data/lib/jekyll/collection.rb +310 -309
  14. data/lib/jekyll/command.rb +105 -105
  15. data/lib/jekyll/commands/build.rb +82 -93
  16. data/lib/jekyll/commands/clean.rb +44 -45
  17. data/lib/jekyll/commands/doctor.rb +177 -177
  18. data/lib/jekyll/commands/help.rb +34 -34
  19. data/lib/jekyll/commands/new.rb +168 -169
  20. data/lib/jekyll/commands/new_theme.rb +39 -40
  21. data/lib/jekyll/commands/serve/live_reload_reactor.rb +119 -122
  22. data/lib/jekyll/commands/serve/livereload_assets/livereload.js +1183 -1183
  23. data/lib/jekyll/commands/serve/mime_types_charset.json +71 -0
  24. data/lib/jekyll/commands/serve/servlet.rb +206 -202
  25. data/lib/jekyll/commands/serve/websockets.rb +81 -81
  26. data/lib/jekyll/commands/serve.rb +367 -362
  27. data/lib/jekyll/configuration.rb +313 -313
  28. data/lib/jekyll/converter.rb +54 -54
  29. data/lib/jekyll/converters/identity.rb +41 -41
  30. data/lib/jekyll/converters/markdown/kramdown_parser.rb +197 -199
  31. data/lib/jekyll/converters/markdown.rb +113 -113
  32. data/lib/jekyll/converters/smartypants.rb +70 -70
  33. data/lib/jekyll/convertible.rb +257 -257
  34. data/lib/jekyll/deprecator.rb +50 -50
  35. data/lib/jekyll/document.rb +543 -544
  36. data/lib/jekyll/drops/collection_drop.rb +20 -20
  37. data/lib/jekyll/drops/document_drop.rb +74 -70
  38. data/lib/jekyll/drops/drop.rb +293 -293
  39. data/lib/jekyll/drops/excerpt_drop.rb +23 -19
  40. data/lib/jekyll/drops/jekyll_drop.rb +32 -32
  41. data/lib/jekyll/drops/site_drop.rb +66 -66
  42. data/lib/jekyll/drops/static_file_drop.rb +14 -14
  43. data/lib/jekyll/drops/theme_drop.rb +36 -0
  44. data/lib/jekyll/drops/unified_payload_drop.rb +30 -26
  45. data/lib/jekyll/drops/url_drop.rb +140 -140
  46. data/lib/jekyll/entry_filter.rb +117 -121
  47. data/lib/jekyll/errors.rb +20 -20
  48. data/lib/jekyll/excerpt.rb +200 -201
  49. data/lib/jekyll/external.rb +75 -79
  50. data/lib/jekyll/filters/date_filters.rb +110 -110
  51. data/lib/jekyll/filters/grouping_filters.rb +64 -64
  52. data/lib/jekyll/filters/url_filters.rb +98 -98
  53. data/lib/jekyll/filters.rb +532 -535
  54. data/lib/jekyll/frontmatter_defaults.rb +238 -240
  55. data/lib/jekyll/generator.rb +5 -5
  56. data/lib/jekyll/hooks.rb +107 -107
  57. data/lib/jekyll/inclusion.rb +32 -32
  58. data/lib/jekyll/layout.rb +55 -67
  59. data/lib/jekyll/liquid_extensions.rb +22 -22
  60. data/lib/jekyll/liquid_renderer/file.rb +77 -77
  61. data/lib/jekyll/liquid_renderer/table.rb +45 -55
  62. data/lib/jekyll/liquid_renderer.rb +80 -80
  63. data/lib/jekyll/log_adapter.rb +151 -151
  64. data/lib/jekyll/mime.types +939 -866
  65. data/lib/jekyll/page.rb +215 -217
  66. data/lib/jekyll/page_excerpt.rb +25 -25
  67. data/lib/jekyll/page_without_a_file.rb +14 -14
  68. data/lib/jekyll/path_manager.rb +74 -74
  69. data/lib/jekyll/plugin.rb +92 -92
  70. data/lib/jekyll/plugin_manager.rb +123 -115
  71. data/lib/jekyll/profiler.rb +51 -58
  72. data/lib/jekyll/publisher.rb +23 -23
  73. data/lib/jekyll/reader.rb +209 -192
  74. data/lib/jekyll/readers/collection_reader.rb +23 -23
  75. data/lib/jekyll/readers/data_reader.rb +113 -79
  76. data/lib/jekyll/readers/layout_reader.rb +62 -62
  77. data/lib/jekyll/readers/page_reader.rb +25 -25
  78. data/lib/jekyll/readers/post_reader.rb +85 -85
  79. data/lib/jekyll/readers/static_file_reader.rb +25 -25
  80. data/lib/jekyll/readers/theme_assets_reader.rb +52 -52
  81. data/lib/jekyll/regenerator.rb +195 -195
  82. data/lib/jekyll/related_posts.rb +52 -52
  83. data/lib/jekyll/renderer.rb +263 -265
  84. data/lib/jekyll/site.rb +576 -551
  85. data/lib/jekyll/static_file.rb +205 -208
  86. data/lib/jekyll/stevenson.rb +60 -60
  87. data/lib/jekyll/tags/highlight.rb +114 -110
  88. data/lib/jekyll/tags/include.rb +275 -275
  89. data/lib/jekyll/tags/link.rb +42 -42
  90. data/lib/jekyll/tags/post_url.rb +106 -106
  91. data/lib/jekyll/theme.rb +90 -86
  92. data/lib/jekyll/theme_builder.rb +121 -121
  93. data/lib/jekyll/url.rb +167 -167
  94. data/lib/jekyll/utils/ansi.rb +57 -57
  95. data/lib/jekyll/utils/exec.rb +26 -26
  96. data/lib/jekyll/utils/internet.rb +37 -37
  97. data/lib/jekyll/utils/platforms.rb +67 -67
  98. data/lib/jekyll/utils/thread_event.rb +31 -31
  99. data/lib/jekyll/utils/win_tz.rb +46 -75
  100. data/lib/jekyll/utils.rb +371 -367
  101. data/lib/jekyll/version.rb +5 -5
  102. data/lib/jekyll.rb +195 -195
  103. data/lib/site_template/.gitignore +5 -5
  104. data/lib/site_template/404.html +25 -25
  105. data/lib/site_template/_config.yml +55 -55
  106. data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +29 -29
  107. data/lib/site_template/about.markdown +18 -18
  108. data/lib/site_template/index.markdown +6 -6
  109. data/lib/theme_template/CODE_OF_CONDUCT.md.erb +74 -74
  110. data/lib/theme_template/Gemfile +4 -4
  111. data/lib/theme_template/LICENSE.txt.erb +21 -21
  112. data/lib/theme_template/README.md.erb +50 -52
  113. data/lib/theme_template/_layouts/default.html +1 -1
  114. data/lib/theme_template/_layouts/page.html +5 -5
  115. data/lib/theme_template/_layouts/post.html +5 -5
  116. data/lib/theme_template/example/_config.yml.erb +1 -1
  117. data/lib/theme_template/example/_post.md +12 -12
  118. data/lib/theme_template/example/index.html +14 -14
  119. data/lib/theme_template/example/style.scss +7 -7
  120. data/lib/theme_template/gitignore.erb +6 -6
  121. data/lib/theme_template/theme.gemspec.erb +16 -16
  122. data/rubocop/jekyll/assert_equal_literal_actual.rb +149 -149
  123. data/rubocop/jekyll/no_p_allowed.rb +23 -23
  124. data/rubocop/jekyll/no_puts_allowed.rb +23 -23
  125. data/rubocop/jekyll.rb +5 -5
  126. metadata +64 -18
data/lib/jekyll/plugin.rb CHANGED
@@ -1,92 +1,92 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- class Plugin
5
- PRIORITIES = {
6
- :low => -10,
7
- :highest => 100,
8
- :lowest => -100,
9
- :normal => 0,
10
- :high => 10,
11
- }.freeze
12
-
13
- #
14
-
15
- def self.inherited(const)
16
- catch_inheritance(const) do |const_|
17
- catch_inheritance(const_)
18
- end
19
- end
20
-
21
- #
22
-
23
- def self.catch_inheritance(const)
24
- const.define_singleton_method :inherited do |const_|
25
- (@children ||= Set.new).add const_
26
- yield const_ if block_given?
27
- end
28
- end
29
-
30
- #
31
-
32
- def self.descendants
33
- @children ||= Set.new
34
- out = @children.map(&:descendants)
35
- out << self unless superclass == Plugin
36
- Set.new(out).flatten
37
- end
38
-
39
- # Get or set the priority of this plugin. When called without an
40
- # argument it returns the priority. When an argument is given, it will
41
- # set the priority.
42
- #
43
- # priority - The Symbol priority (default: nil). Valid options are:
44
- # :lowest, :low, :normal, :high, :highest
45
- #
46
- # Returns the Symbol priority.
47
- def self.priority(priority = nil)
48
- @priority ||= nil
49
- @priority = priority if priority && PRIORITIES.key?(priority)
50
- @priority || :normal
51
- end
52
-
53
- # Get or set the safety of this plugin. When called without an argument
54
- # it returns the safety. When an argument is given, it will set the
55
- # safety.
56
- #
57
- # safe - The Boolean safety (default: nil).
58
- #
59
- # Returns the safety Boolean.
60
- def self.safe(safe = nil)
61
- @safe = safe unless defined?(@safe) && safe.nil?
62
- @safe || false
63
- end
64
-
65
- # Spaceship is priority [higher -> lower]
66
- #
67
- # other - The class to be compared.
68
- #
69
- # Returns -1, 0, 1.
70
- def self.<=>(other)
71
- PRIORITIES[other.priority] <=> PRIORITIES[priority]
72
- end
73
-
74
- # Spaceship is priority [higher -> lower]
75
- #
76
- # other - The class to be compared.
77
- #
78
- # Returns -1, 0, 1.
79
- def <=>(other)
80
- self.class <=> other.class
81
- end
82
-
83
- # Initialize a new plugin. This should be overridden by the subclass.
84
- #
85
- # config - The Hash of configuration options.
86
- #
87
- # Returns a new instance.
88
- def initialize(config = {})
89
- # no-op for default
90
- end
91
- end
92
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ class Plugin
5
+ PRIORITIES = {
6
+ :low => -10,
7
+ :highest => 100,
8
+ :lowest => -100,
9
+ :normal => 0,
10
+ :high => 10,
11
+ }.freeze
12
+
13
+ #
14
+
15
+ def self.inherited(const)
16
+ catch_inheritance(const) do |const_|
17
+ catch_inheritance(const_)
18
+ end
19
+ end
20
+
21
+ #
22
+
23
+ def self.catch_inheritance(const)
24
+ const.define_singleton_method :inherited do |const_|
25
+ (@children ||= Set.new).add const_
26
+ yield const_ if block_given?
27
+ end
28
+ end
29
+
30
+ #
31
+
32
+ def self.descendants
33
+ @children ||= Set.new
34
+ out = @children.map(&:descendants)
35
+ out << self unless superclass == Plugin
36
+ Set.new(out).flatten
37
+ end
38
+
39
+ # Get or set the priority of this plugin. When called without an
40
+ # argument it returns the priority. When an argument is given, it will
41
+ # set the priority.
42
+ #
43
+ # priority - The Symbol priority (default: nil). Valid options are:
44
+ # :lowest, :low, :normal, :high, :highest
45
+ #
46
+ # Returns the Symbol priority.
47
+ def self.priority(priority = nil)
48
+ @priority ||= nil
49
+ @priority = priority if priority && PRIORITIES.key?(priority)
50
+ @priority || :normal
51
+ end
52
+
53
+ # Get or set the safety of this plugin. When called without an argument
54
+ # it returns the safety. When an argument is given, it will set the
55
+ # safety.
56
+ #
57
+ # safe - The Boolean safety (default: nil).
58
+ #
59
+ # Returns the safety Boolean.
60
+ def self.safe(safe = nil)
61
+ @safe = safe unless defined?(@safe) && safe.nil?
62
+ @safe || false
63
+ end
64
+
65
+ # Spaceship is priority [higher -> lower]
66
+ #
67
+ # other - The class to be compared.
68
+ #
69
+ # Returns -1, 0, 1.
70
+ def self.<=>(other)
71
+ PRIORITIES[other.priority] <=> PRIORITIES[priority]
72
+ end
73
+
74
+ # Spaceship is priority [higher -> lower]
75
+ #
76
+ # other - The class to be compared.
77
+ #
78
+ # Returns -1, 0, 1.
79
+ def <=>(other)
80
+ self.class <=> other.class
81
+ end
82
+
83
+ # Initialize a new plugin. This should be overridden by the subclass.
84
+ #
85
+ # config - The Hash of configuration options.
86
+ #
87
+ # Returns a new instance.
88
+ def initialize(config = {})
89
+ # no-op for default
90
+ end
91
+ end
92
+ end
@@ -1,115 +1,123 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- class PluginManager
5
- attr_reader :site
6
-
7
- # Create an instance of this class.
8
- #
9
- # site - the instance of Jekyll::Site we're concerned with
10
- #
11
- # Returns nothing
12
- def initialize(site)
13
- @site = site
14
- end
15
-
16
- # Require all the plugins which are allowed.
17
- #
18
- # Returns nothing
19
- def conscientious_require
20
- require_theme_deps if site.theme
21
- require_plugin_files
22
- require_gems
23
- deprecation_checks
24
- end
25
-
26
- # Require each of the gem plugins specified.
27
- #
28
- # Returns nothing.
29
- def require_gems
30
- Jekyll::External.require_with_graceful_fail(
31
- site.gems.select { |plugin| plugin_allowed?(plugin) }
32
- )
33
- end
34
-
35
- # Require each of the runtime_dependencies specified by the theme's gemspec.
36
- #
37
- # Returns false only if no dependencies have been specified, otherwise nothing.
38
- def require_theme_deps
39
- return false unless site.theme.runtime_dependencies
40
-
41
- site.theme.runtime_dependencies.each do |dep|
42
- next if dep.name == "jekyll"
43
-
44
- External.require_with_graceful_fail(dep.name) if plugin_allowed?(dep.name)
45
- end
46
- end
47
-
48
- def self.require_from_bundler
49
- if !ENV["JEKYLL_NO_BUNDLER_REQUIRE"] && File.file?("Gemfile")
50
- require "bundler"
51
-
52
- Bundler.setup
53
- required_gems = Bundler.require(:jekyll_plugins)
54
- message = "Required #{required_gems.map(&:name).join(", ")}"
55
- Jekyll.logger.debug("PluginManager:", message)
56
- ENV["JEKYLL_NO_BUNDLER_REQUIRE"] = "true"
57
-
58
- true
59
- else
60
- false
61
- end
62
- end
63
-
64
- # Check whether a gem plugin is allowed to be used during this build.
65
- #
66
- # plugin_name - the name of the plugin
67
- #
68
- # Returns true if the plugin name is in the whitelist or if the site is not
69
- # in safe mode.
70
- def plugin_allowed?(plugin_name)
71
- !site.safe || whitelist.include?(plugin_name)
72
- end
73
-
74
- # Build an array of allowed plugin gem names.
75
- #
76
- # Returns an array of strings, each string being the name of a gem name
77
- # that is allowed to be used.
78
- def whitelist
79
- @whitelist ||= Array[site.config["whitelist"]].flatten
80
- end
81
-
82
- # Require all .rb files if safe mode is off
83
- #
84
- # Returns nothing.
85
- def require_plugin_files
86
- unless site.safe
87
- plugins_path.each do |plugin_search_path|
88
- plugin_files = Utils.safe_glob(plugin_search_path, File.join("**", "*.rb"))
89
- Jekyll::External.require_with_graceful_fail(plugin_files)
90
- end
91
- end
92
- end
93
-
94
- # Public: Setup the plugin search path
95
- #
96
- # Returns an Array of plugin search paths
97
- def plugins_path
98
- if site.config["plugins_dir"].eql? Jekyll::Configuration::DEFAULTS["plugins_dir"]
99
- [site.in_source_dir(site.config["plugins_dir"])]
100
- else
101
- Array(site.config["plugins_dir"]).map { |d| File.expand_path(d) }
102
- end
103
- end
104
-
105
- def deprecation_checks
106
- pagination_included = (site.config["plugins"] || []).include?("jekyll-paginate") ||
107
- defined?(Jekyll::Paginate)
108
- if site.config["paginate"] && !pagination_included
109
- Jekyll::Deprecator.deprecation_message "You appear to have pagination " \
110
- "turned on, but you haven't included the `jekyll-paginate` gem. " \
111
- "Ensure you have `plugins: [jekyll-paginate]` in your configuration file."
112
- end
113
- end
114
- end
115
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ class PluginManager
5
+ attr_reader :site
6
+
7
+ # Create an instance of this class.
8
+ #
9
+ # site - the instance of Jekyll::Site we're concerned with
10
+ #
11
+ # Returns nothing
12
+ def initialize(site)
13
+ @site = site
14
+ end
15
+
16
+ # Require all the plugins which are allowed.
17
+ #
18
+ # Returns nothing
19
+ def conscientious_require
20
+ require_theme_deps if site.theme
21
+ require_plugin_files
22
+ require_gems
23
+ deprecation_checks
24
+ end
25
+
26
+ # Require each of the gem plugins specified.
27
+ #
28
+ # Returns nothing.
29
+ def require_gems
30
+ Jekyll::External.require_with_graceful_fail(
31
+ site.gems.select { |plugin| plugin_allowed?(plugin) }
32
+ )
33
+ end
34
+
35
+ # Require each of the runtime_dependencies specified by the theme's gemspec.
36
+ #
37
+ # Returns false only if no dependencies have been specified, otherwise nothing.
38
+ def require_theme_deps
39
+ return false unless site.theme.runtime_dependencies
40
+
41
+ site.theme.runtime_dependencies.each do |dep|
42
+ next if dep.name == "jekyll"
43
+
44
+ External.require_with_graceful_fail(dep.name) if plugin_allowed?(dep.name)
45
+ end
46
+ end
47
+
48
+ def self.require_from_bundler
49
+ if !ENV["JEKYLL_NO_BUNDLER_REQUIRE"] && gemfile_exists?
50
+ require "bundler"
51
+
52
+ Bundler.setup
53
+ required_gems = Bundler.require(:jekyll_plugins)
54
+ message = "Required #{required_gems.map(&:name).join(", ")}"
55
+ Jekyll.logger.debug("PluginManager:", message)
56
+ ENV["JEKYLL_NO_BUNDLER_REQUIRE"] = "true"
57
+
58
+ true
59
+ else
60
+ false
61
+ end
62
+ end
63
+
64
+ # Check for the existence of a Gemfile.
65
+ #
66
+ # Returns true if a Gemfile exists in the places bundler will look
67
+ def self.gemfile_exists?
68
+ File.file?("Gemfile") || (ENV["BUNDLE_GEMFILE"] && File.file?(ENV["BUNDLE_GEMFILE"]))
69
+ end
70
+
71
+ # Check whether a gem plugin is allowed to be used during this build.
72
+ #
73
+ # plugin_name - the name of the plugin
74
+ #
75
+ # Returns true if the plugin name is in the whitelist or if the site is not
76
+ # in safe mode.
77
+ def plugin_allowed?(plugin_name)
78
+ !site.safe || whitelist.include?(plugin_name)
79
+ end
80
+
81
+ # Build an array of allowed plugin gem names.
82
+ #
83
+ # Returns an array of strings, each string being the name of a gem name
84
+ # that is allowed to be used.
85
+ def whitelist
86
+ @whitelist ||= Array[site.config["whitelist"]].flatten
87
+ end
88
+
89
+ # Require all .rb files if safe mode is off
90
+ #
91
+ # Returns nothing.
92
+ def require_plugin_files
93
+ unless site.safe
94
+ plugins_path.each do |plugin_search_path|
95
+ plugin_files = Utils.safe_glob(plugin_search_path, File.join("**", "*.rb"))
96
+ Jekyll::External.require_with_graceful_fail(plugin_files)
97
+ end
98
+ end
99
+ end
100
+
101
+ # Public: Setup the plugin search path
102
+ #
103
+ # Returns an Array of plugin search paths
104
+ def plugins_path
105
+ if site.config["plugins_dir"].eql? Jekyll::Configuration::DEFAULTS["plugins_dir"]
106
+ [site.in_source_dir(site.config["plugins_dir"])]
107
+ else
108
+ Array(site.config["plugins_dir"]).map { |d| File.expand_path(d) }
109
+ end
110
+ end
111
+
112
+ def deprecation_checks
113
+ pagination_included = (site.config["plugins"] || []).include?("jekyll-paginate") ||
114
+ defined?(Jekyll::Paginate)
115
+ if site.config["paginate"] && !pagination_included
116
+ Jekyll::Deprecator.deprecation_message <<~MSG
117
+ You appear to have pagination turned on, but you haven't included the `jekyll-paginate`
118
+ gem. Ensure you have `plugins: [jekyll-paginate]` in your configuration file.
119
+ MSG
120
+ end
121
+ end
122
+ end
123
+ end
@@ -1,58 +1,51 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- class Profiler
5
- TERMINAL_TABLE_STYLES = {
6
- :alignment => :right,
7
- :border_top => false,
8
- :border_bottom => false,
9
- }.freeze
10
- private_constant :TERMINAL_TABLE_STYLES
11
-
12
- def self.tabulate(table_rows)
13
- require "terminal-table"
14
-
15
- rows = table_rows.dup
16
- header = rows.shift
17
- footer = rows.pop
18
- output = +"\n"
19
-
20
- table = Terminal::Table.new do |t|
21
- t << header
22
- t << :separator
23
- rows.each { |row| t << row }
24
- t << :separator
25
- t << footer
26
- t.style = TERMINAL_TABLE_STYLES
27
- t.align_column(0, :left)
28
- end
29
-
30
- output << table.to_s << "\n"
31
- end
32
-
33
- def initialize(site)
34
- @site = site
35
- end
36
-
37
- def profile_process
38
- profile_data = { "PHASE" => "TIME" }
39
- total_time = 0
40
-
41
- [:reset, :read, :generate, :render, :cleanup, :write].each do |method|
42
- start_time = Time.now
43
- @site.send(method)
44
- end_time = (Time.now - start_time).round(4)
45
- profile_data[method.to_s.upcase] = format("%.4f", end_time)
46
- total_time += end_time
47
- end
48
-
49
- profile_data["TOTAL TIME"] = format("%.4f", total_time)
50
-
51
- Jekyll.logger.info "\nBuild Process Summary:"
52
- Jekyll.logger.info Profiler.tabulate(Array(profile_data))
53
-
54
- Jekyll.logger.info "\nSite Render Stats:"
55
- @site.print_stats
56
- end
57
- end
58
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ class Profiler
5
+ TERMINAL_TABLE_STYLES = {
6
+ :alignment => :right,
7
+ :border_top => false,
8
+ :border_bottom => false,
9
+ }.freeze
10
+ private_constant :TERMINAL_TABLE_STYLES
11
+
12
+ def self.tabulate(table_rows)
13
+ require "terminal-table"
14
+
15
+ rows = table_rows.dup
16
+ header = rows.shift
17
+ output = +"\n"
18
+
19
+ table = Terminal::Table.new do |t|
20
+ t << header
21
+ t << :separator
22
+ rows.each { |row| t << row }
23
+ t.style = TERMINAL_TABLE_STYLES
24
+ t.align_column(0, :left)
25
+ end
26
+
27
+ output << table.to_s << "\n"
28
+ end
29
+
30
+ def initialize(site)
31
+ @site = site
32
+ end
33
+
34
+ def profile_process
35
+ profile_data = { "PHASE" => "TIME" }
36
+
37
+ [:reset, :read, :generate, :render, :cleanup, :write].each do |method|
38
+ start_time = Time.now
39
+ @site.send(method)
40
+ end_time = (Time.now - start_time).round(4)
41
+ profile_data[method.to_s.upcase] = format("%.4f", end_time)
42
+ end
43
+
44
+ Jekyll.logger.info "\nBuild Process Summary:"
45
+ Jekyll.logger.info Profiler.tabulate(Array(profile_data))
46
+
47
+ Jekyll.logger.info "\nSite Render Stats:"
48
+ @site.print_stats
49
+ end
50
+ end
51
+ end
@@ -1,23 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- class Publisher
5
- def initialize(site)
6
- @site = site
7
- end
8
-
9
- def publish?(thing)
10
- can_be_published?(thing) && !hidden_in_the_future?(thing)
11
- end
12
-
13
- def hidden_in_the_future?(thing)
14
- thing.respond_to?(:date) && !@site.future && thing.date.to_i > @site.time.to_i
15
- end
16
-
17
- private
18
-
19
- def can_be_published?(thing)
20
- thing.data.fetch("published", true) || @site.unpublished
21
- end
22
- end
23
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ class Publisher
5
+ def initialize(site)
6
+ @site = site
7
+ end
8
+
9
+ def publish?(thing)
10
+ can_be_published?(thing) && !hidden_in_the_future?(thing)
11
+ end
12
+
13
+ def hidden_in_the_future?(thing)
14
+ thing.respond_to?(:date) && !@site.future && thing.date.to_i > @site.time.to_i
15
+ end
16
+
17
+ private
18
+
19
+ def can_be_published?(thing)
20
+ thing.data.fetch("published", true) || @site.unpublished
21
+ end
22
+ end
23
+ end