jekyll 3.9.1 → 4.0.0.pre.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +27 -50
  3. data/LICENSE +1 -1
  4. data/README.markdown +46 -17
  5. data/lib/blank_template/_config.yml +3 -0
  6. data/lib/blank_template/_layouts/default.html +12 -0
  7. data/lib/blank_template/_sass/main.scss +9 -0
  8. data/lib/blank_template/assets/css/main.scss +4 -0
  9. data/lib/blank_template/index.md +8 -0
  10. data/lib/jekyll.rb +5 -0
  11. data/lib/jekyll/cache.rb +183 -0
  12. data/lib/jekyll/cleaner.rb +2 -1
  13. data/lib/jekyll/collection.rb +78 -8
  14. data/lib/jekyll/command.rb +31 -6
  15. data/lib/jekyll/commands/build.rb +11 -20
  16. data/lib/jekyll/commands/clean.rb +2 -0
  17. data/lib/jekyll/commands/doctor.rb +15 -8
  18. data/lib/jekyll/commands/help.rb +1 -1
  19. data/lib/jekyll/commands/new.rb +37 -39
  20. data/lib/jekyll/commands/new_theme.rb +30 -28
  21. data/lib/jekyll/commands/serve.rb +46 -80
  22. data/lib/jekyll/commands/serve/live_reload_reactor.rb +6 -10
  23. data/lib/jekyll/commands/serve/servlet.rb +9 -11
  24. data/lib/jekyll/configuration.rb +26 -26
  25. data/lib/jekyll/converters/identity.rb +18 -0
  26. data/lib/jekyll/converters/markdown.rb +49 -40
  27. data/lib/jekyll/converters/markdown/kramdown_parser.rb +1 -10
  28. data/lib/jekyll/converters/smartypants.rb +34 -14
  29. data/lib/jekyll/convertible.rb +11 -13
  30. data/lib/jekyll/deprecator.rb +1 -3
  31. data/lib/jekyll/document.rb +44 -41
  32. data/lib/jekyll/drops/collection_drop.rb +2 -3
  33. data/lib/jekyll/drops/document_drop.rb +2 -1
  34. data/lib/jekyll/drops/drop.rb +3 -6
  35. data/lib/jekyll/drops/excerpt_drop.rb +4 -0
  36. data/lib/jekyll/drops/site_drop.rb +4 -13
  37. data/lib/jekyll/drops/unified_payload_drop.rb +1 -0
  38. data/lib/jekyll/drops/url_drop.rb +1 -0
  39. data/lib/jekyll/entry_filter.rb +2 -1
  40. data/lib/jekyll/excerpt.rb +45 -34
  41. data/lib/jekyll/external.rb +10 -5
  42. data/lib/jekyll/filters.rb +72 -31
  43. data/lib/jekyll/filters/date_filters.rb +6 -3
  44. data/lib/jekyll/filters/grouping_filters.rb +1 -2
  45. data/lib/jekyll/filters/url_filters.rb +6 -1
  46. data/lib/jekyll/frontmatter_defaults.rb +35 -19
  47. data/lib/jekyll/hooks.rb +2 -3
  48. data/lib/jekyll/liquid_extensions.rb +0 -2
  49. data/lib/jekyll/liquid_renderer.rb +13 -1
  50. data/lib/jekyll/liquid_renderer/file.rb +14 -3
  51. data/lib/jekyll/liquid_renderer/table.rb +67 -65
  52. data/lib/jekyll/log_adapter.rb +5 -1
  53. data/lib/jekyll/page.rb +10 -11
  54. data/lib/jekyll/page_without_a_file.rb +0 -4
  55. data/lib/jekyll/plugin.rb +5 -11
  56. data/lib/jekyll/plugin_manager.rb +2 -0
  57. data/lib/jekyll/reader.rb +38 -8
  58. data/lib/jekyll/readers/data_reader.rb +7 -9
  59. data/lib/jekyll/readers/layout_reader.rb +2 -12
  60. data/lib/jekyll/readers/post_reader.rb +29 -17
  61. data/lib/jekyll/readers/static_file_reader.rb +1 -1
  62. data/lib/jekyll/readers/theme_assets_reader.rb +7 -5
  63. data/lib/jekyll/regenerator.rb +4 -12
  64. data/lib/jekyll/renderer.rb +14 -25
  65. data/lib/jekyll/site.rb +78 -34
  66. data/lib/jekyll/static_file.rb +47 -11
  67. data/lib/jekyll/stevenson.rb +2 -3
  68. data/lib/jekyll/tags/highlight.rb +22 -52
  69. data/lib/jekyll/tags/include.rb +22 -38
  70. data/lib/jekyll/tags/link.rb +11 -7
  71. data/lib/jekyll/tags/post_url.rb +17 -16
  72. data/lib/jekyll/theme.rb +12 -23
  73. data/lib/jekyll/theme_builder.rb +91 -89
  74. data/lib/jekyll/url.rb +3 -2
  75. data/lib/jekyll/utils.rb +5 -4
  76. data/lib/jekyll/utils/ansi.rb +1 -1
  77. data/lib/jekyll/utils/exec.rb +0 -1
  78. data/lib/jekyll/utils/internet.rb +2 -4
  79. data/lib/jekyll/utils/platforms.rb +8 -8
  80. data/lib/jekyll/utils/thread_event.rb +1 -5
  81. data/lib/jekyll/utils/win_tz.rb +1 -1
  82. data/lib/jekyll/version.rb +1 -1
  83. data/lib/site_template/.gitignore +2 -0
  84. data/lib/site_template/404.html +1 -0
  85. data/lib/site_template/_config.yml +17 -5
  86. data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +5 -1
  87. data/lib/site_template/{about.md → about.markdown} +0 -0
  88. data/lib/site_template/{index.md → index.markdown} +0 -0
  89. data/lib/theme_template/gitignore.erb +1 -0
  90. data/rubocop/jekyll/assert_equal_literal_actual.rb +149 -0
  91. metadata +85 -51
  92. data/lib/jekyll/converters/markdown/rdiscount_parser.rb +0 -37
  93. data/lib/jekyll/converters/markdown/redcarpet_parser.rb +0 -112
  94. data/lib/jekyll/utils/rouge.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8438a4ebfcd825d8500646d91205a6f10cf7539e1d659e425b29de27576047e9
4
- data.tar.gz: 58762696b5382761dea9315a60e619c3130bbf560be2f3237576b855d89f63c3
3
+ metadata.gz: 1510de5e88a3e6d48fa5eb7686dfafc1cf94b820cd9b44fdd635bff9c306d98b
4
+ data.tar.gz: e4f444b21baf087d33f3dd7040c17b2fa00f5ed4a32f3602ee26722d4270ebc3
5
5
  SHA512:
6
- metadata.gz: 7fda7be3b450dcff1a509faf177c06a0e2c03a06530aace708e4717ac650a815917aa345bc5e22ee4d9544ac05798e86db3685aa6c6cfbdad60771dbae2885b1
7
- data.tar.gz: 1e30e0db8868ec2d0bf216681f1737121513aee96b5bc6a9e91c600358782ed2125a03e6cc3206a4cac3fd369be72a9db951863ff9d0f1a0d419bf5645a974e0
6
+ metadata.gz: 854691fcc3090fe0292767b7aaa5c20504d5d11c08c9f301398cc5af70d387c002ad804fdf20a1583ab4a93d326425aff205b89554860c6babb84f6154923b85
7
+ data.tar.gz: ef22dd4eea32776ef7f25748241f1236431b8fd566bb377d8d66a657ade71e5de836ea149f7c7e0ff3483f471e8da801915261c6e0a110e97a43970707b3b05c
data/.rubocop.yml CHANGED
@@ -8,9 +8,10 @@ Jekyll/NoPutsAllowed:
8
8
  - rake/*.rake
9
9
 
10
10
  AllCops:
11
- TargetRubyVersion: 2.1
11
+ TargetRubyVersion: 2.3
12
12
  Include:
13
13
  - lib/**/*.rb
14
+ - test/**/*.rb
14
15
  Exclude:
15
16
  - bin/**/*
16
17
  - exe/**/*
@@ -18,30 +19,14 @@ AllCops:
18
19
  - script/**/*
19
20
  - vendor/**/*
20
21
  - tmp/**/*
21
- Layout/AlignArray:
22
- Enabled: false
23
22
  Layout/AlignHash:
24
23
  EnforcedHashRocketStyle: table
25
- Layout/AlignParameters:
26
- Enabled: false
27
- Layout/EmptyLinesAroundAccessModifier:
28
- Enabled: false
29
- Layout/EmptyLinesAroundModuleBody:
30
- Enabled: false
31
- Layout/EndOfLine:
32
- EnforcedStyle: native
33
- Layout/ExtraSpacing:
34
- AllowForAlignment: true
35
- Layout/FirstParameterIndentation:
36
- EnforcedStyle: consistent
37
24
  Layout/IndentationWidth:
38
25
  Severity: error
39
26
  Layout/IndentArray:
40
27
  EnforcedStyle: consistent
41
28
  Layout/IndentHash:
42
29
  EnforcedStyle: consistent
43
- Layout/IndentHeredoc:
44
- Enabled: false
45
30
  Layout/MultilineMethodCallIndentation:
46
31
  EnforcedStyle: indented
47
32
  Layout/MultilineOperationIndentation:
@@ -53,14 +38,11 @@ Layout/EmptyComment:
53
38
  Enabled: false
54
39
  Layout/EndAlignment:
55
40
  Severity: error
56
- Lint/SplatKeywordArguments:
57
- Enabled: false
58
41
  Lint/UnreachableCode:
59
42
  Severity: error
60
- Lint/UselessAccessModifier:
61
- Enabled: false
62
43
  Lint/Void:
63
- Enabled: false
44
+ Exclude:
45
+ - lib/jekyll/site.rb
64
46
  Metrics/AbcSize:
65
47
  Max: 21
66
48
  Metrics/BlockLength:
@@ -68,22 +50,26 @@ Metrics/BlockLength:
68
50
  - test/**/*.rb
69
51
  - lib/jekyll/configuration.rb
70
52
  - rake/*.rake
71
- - jekyll.gemspec
72
53
  Metrics/ClassLength:
73
54
  Exclude:
74
55
  - !ruby/regexp /features\/.*.rb$/
75
56
  - !ruby/regexp /test\/.*.rb$/
76
- Max: 300
57
+ - lib/jekyll/document.rb
58
+ - lib/jekyll/site.rb
59
+ - lib/jekyll/commands/serve.rb
60
+ - lib/jekyll/configuration.rb
61
+ Max: 240
77
62
  Metrics/CyclomaticComplexity:
78
- Max: 9
63
+ Exclude:
64
+ - lib/jekyll/utils.rb
65
+ - lib/jekyll/commands/serve.rb
79
66
  Metrics/LineLength:
80
67
  Exclude:
81
68
  - !ruby/regexp /features\/.*.rb/
82
69
  - Rakefile
83
70
  - rake/*.rake
84
71
  - Gemfile
85
- - jekyll.gemspec
86
- Max: 90
72
+ Max: 100
87
73
  Severity: warning
88
74
  Metrics/MethodLength:
89
75
  CountComments: false
@@ -98,15 +84,14 @@ Metrics/PerceivedComplexity:
98
84
  Naming/FileName:
99
85
  Enabled: false
100
86
  Naming/HeredocDelimiterNaming:
101
- Enabled: false
87
+ Exclude:
88
+ - test/**/*.rb
102
89
  Naming/MemoizedInstanceVariableName:
103
90
  Exclude:
104
- - lib/jekyll/page_without_a_file.rb
105
- - lib/jekyll/drops/unified_payload_drop.rb
91
+ - lib/jekyll/convertible.rb
106
92
  - lib/jekyll/drops/site_drop.rb
107
- Naming/UncommunicativeMethodParamName:
108
- AllowedNames:
109
- - _
93
+ - lib/jekyll/drops/unified_payload_drop.rb
94
+ - lib/jekyll/page_without_a_file.rb
110
95
  Security/MarshalLoad:
111
96
  Exclude:
112
97
  - !ruby/regexp /test\/.*.rb$/
@@ -115,20 +100,19 @@ Security/YAMLLoad:
115
100
  Exclude:
116
101
  - !ruby/regexp /features\/.*.rb/
117
102
  - !ruby/regexp /test\/.*.rb$/
118
- Style/Alias:
103
+ Style/AccessModifierDeclarations:
119
104
  Enabled: false
105
+ Style/Alias:
106
+ EnforcedStyle: prefer_alias_method
120
107
  Style/AndOr:
121
108
  Severity: error
122
- Style/BracesAroundHashParameters:
123
- Enabled: false
124
109
  Style/ClassAndModuleChildren:
125
- Enabled: false
110
+ Exclude:
111
+ - test/**/*.rb
126
112
  Style/FrozenStringLiteralComment:
127
113
  EnforcedStyle: always
128
114
  Style/Documentation:
129
115
  Enabled: false
130
- Exclude:
131
- - !ruby/regexp /features\/.*.rb$/
132
116
  Style/DoubleNegation:
133
117
  Enabled: false
134
118
  Style/FormatStringToken:
@@ -139,10 +123,6 @@ Style/GuardClause:
139
123
  Style/HashSyntax:
140
124
  EnforcedStyle: hash_rockets
141
125
  Severity: error
142
- Style/IfUnlessModifier:
143
- Enabled: false
144
- Style/InverseMethods:
145
- Enabled: false
146
126
  Style/MixinUsage:
147
127
  Exclude:
148
128
  - test/helper.rb
@@ -159,24 +139,21 @@ Style/PercentLiteralDelimiters:
159
139
  "%w": "()"
160
140
  "%W": "()"
161
141
  "%x": "()"
162
- Style/RedundantReturn:
163
- Enabled: false
164
- Style/RedundantSelf:
165
- Enabled: false
166
142
  Style/RegexpLiteral:
167
143
  EnforcedStyle: percent_r
168
144
  Style/RescueModifier:
169
145
  Enabled: false
146
+ Style/SafeNavigation:
147
+ Exclude:
148
+ - lib/jekyll/document.rb
170
149
  Style/SignalException:
171
150
  EnforcedStyle: only_raise
172
- Style/SingleLineMethods:
173
- Enabled: false
174
151
  Style/StringLiterals:
175
152
  EnforcedStyle: double_quotes
176
153
  Style/StringLiteralsInInterpolation:
177
154
  EnforcedStyle: double_quotes
178
155
  Style/SymbolArray:
179
- Enabled: false
156
+ EnforcedStyle: brackets
180
157
  Style/TrailingCommaInArrayLiteral:
181
158
  EnforcedStyleForMultiline: consistent_comma
182
159
  Style/TrailingCommaInHashLiteral:
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2008-2018 Tom Preston-Werner and Jekyll contributors
3
+ Copyright (c) 2008-present Tom Preston-Werner and Jekyll contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.markdown CHANGED
@@ -3,13 +3,13 @@
3
3
  [![Gem Version](https://img.shields.io/gem/v/jekyll.svg)][ruby-gems]
4
4
  [![Linux Build Status](https://img.shields.io/travis/jekyll/jekyll/master.svg?label=Linux%20build)][travis]
5
5
  [![Windows Build status](https://img.shields.io/appveyor/ci/jekyll/jekyll/master.svg?label=Windows%20build)][appveyor]
6
- [![Maintainability](https://api.codeclimate.com/v1/badges/8ba0cb5b17bb9848e128/maintainability)](codeclimate)
7
- [![Test Coverage](https://api.codeclimate.com/v1/badges/8ba0cb5b17bb9848e128/test_coverage)](coverage)
8
- [![Dependency Status](https://img.shields.io/gemnasium/jekyll/jekyll.svg)][gemnasium]
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/8ba0cb5b17bb9848e128/maintainability)][codeclimate]
7
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/8ba0cb5b17bb9848e128/test_coverage)][coverage]
9
8
  [![Security](https://hakiri.io/github/jekyll/jekyll/master.svg)][hakiri]
9
+ [![Backers on Open Collective](https://opencollective.com/jekyll/backers/badge.svg)](#backers)
10
+ [![Sponsors on Open Collective](https://opencollective.com/jekyll/sponsors/badge.svg)](#sponsors)
10
11
 
11
12
  [ruby-gems]: https://rubygems.org/gems/jekyll
12
- [gemnasium]: https://gemnasium.com/jekyll/jekyll
13
13
  [codeclimate]: https://codeclimate.com/github/jekyll/jekyll
14
14
  [coverage]: https://codeclimate.com/github/jekyll/jekyll/coverage
15
15
  [hakiri]: https://hakiri.io/github/jekyll/jekyll/master
@@ -24,18 +24,28 @@ Jekyll does what you tell it to do — no more, no less. It doesn't try to outs
24
24
 
25
25
  See: https://jekyllrb.com/philosophy
26
26
 
27
- ## Having trouble?
28
-
29
- See: https://jekyllrb.com/docs/troubleshooting/
30
-
31
27
  ## Getting Started
32
28
 
33
29
  * [Install](https://jekyllrb.com/docs/installation/) the gem
34
30
  * Read up about its [Usage](https://jekyllrb.com/docs/usage/) and [Configuration](https://jekyllrb.com/docs/configuration/)
35
- * Take a gander at some existing [Sites](https://wiki.github.com/jekyll/jekyll/sites)
31
+ * Take a gander at some existing [Sites](https://github.com/jekyll/jekyll/wiki/sites)
36
32
  * [Fork](https://github.com/jekyll/jekyll/fork) and [Contribute](https://jekyllrb.com/docs/contributing/) your own modifications
37
33
  * Have questions? Check out our official forum community [Jekyll Talk](https://talk.jekyllrb.com/) or [`#jekyll` on irc.freenode.net](https://botbot.me/freenode/jekyll/)
38
34
 
35
+ ## Diving In
36
+
37
+ * [Migrate](http://import.jekyllrb.com/docs/home/) from your previous system
38
+ * Learn how [Front Matter](https://jekyllrb.com/docs/front-matter/) works
39
+ * Put information on your site with [Variables](https://jekyllrb.com/docs/variables/)
40
+ * Customize the [Permalinks](https://jekyllrb.com/docs/permalinks/) your posts are generated with
41
+ * Use the built-in [Liquid Extensions](https://jekyllrb.com/docs/templates/) to make your life easier
42
+ * Use custom [Plugins](https://jekyllrb.com/docs/plugins/) to generate content specific to your site
43
+ * Watch [video tutorials from Giraffe Academy](https://jekyllrb.com/tutorials/video-walkthroughs/)
44
+
45
+ ## Need help?
46
+
47
+ If you don't find the answer to your problem in our [docs](https://jekyllrb.com/docs/), or in the [troubleshooting section](https://jekyllrb.com/docs/troubleshooting/), ask the [community](https://jekyllrb.com/docs/community/) for help.
48
+
39
49
  ## Code of Conduct
40
50
 
41
51
  In order to have a more open and welcoming community, Jekyll adheres to a
@@ -45,16 +55,35 @@ conduct.
45
55
  Please adhere to this code of conduct in any interactions you have in the
46
56
  Jekyll community. It is strictly enforced on all official Jekyll
47
57
  repositories, websites, and resources. If you encounter someone violating
48
- these terms, please let one of our core team members [Olivia](mailto:olivia@jekyllrb.com?subject=Jekyll%20CoC%20Violation), [Pat](mailto:pat@jekyllrb.com?subject=Jekyll%20CoC%20Violation), [Matt](mailto:matt@jekyllrb.com?subject=Jekyll%20CoC%20Violation) or [Parker](mailto:parker@jekyllrb.com?subject=Jekyll%20CoC%20Violation) know and we will address it as soon as possible.
58
+ these terms, please let one of our [core team members](https://jekyllrb.com/team/#core-team) know and we will address it as soon as possible.
49
59
 
50
- ## Diving In
60
+ ## Credits
51
61
 
52
- * [Migrate](http://import.jekyllrb.com/docs/home/) from your previous system
53
- * Learn how the [YAML Front Matter](https://jekyllrb.com/docs/frontmatter/) works
54
- * Put information on your site with [Variables](https://jekyllrb.com/docs/variables/)
55
- * Customize the [Permalinks](https://jekyllrb.com/docs/permalinks/) your posts are generated with
56
- * Use the built-in [Liquid Extensions](https://jekyllrb.com/docs/templates/) to make your life easier
57
- * Use custom [Plugins](https://jekyllrb.com/docs/plugins/) to generate content specific to your site
62
+ ### Sponsors
63
+
64
+ Support this project by becoming a sponsor. Your logo will show up in this README with a link to your website. [Become a sponsor!](https://opencollective.com/jekyll#sponsor)
65
+
66
+ <a href="https://opencollective.com/jekyll/sponsor/0/website" target="_blank"><img src="https://opencollective.com/jekyll/sponsor/0/avatar.svg" /></a>
67
+ <a href="https://opencollective.com/jekyll/sponsor/1/website" target="_blank"><img src="https://opencollective.com/jekyll/sponsor/1/avatar.svg" /></a>
68
+ <a href="https://opencollective.com/jekyll/sponsor/2/website" target="_blank"><img src="https://opencollective.com/jekyll/sponsor/2/avatar.svg" /></a>
69
+ <a href="https://opencollective.com/jekyll/sponsor/3/website" target="_blank"><img src="https://opencollective.com/jekyll/sponsor/3/avatar.svg" /></a>
70
+ <a href="https://opencollective.com/jekyll/sponsor/4/website" target="_blank"><img src="https://opencollective.com/jekyll/sponsor/4/avatar.svg" /></a>
71
+ <a href="https://opencollective.com/jekyll/sponsor/5/website" target="_blank"><img src="https://opencollective.com/jekyll/sponsor/5/avatar.svg" /></a>
72
+ <a href="https://opencollective.com/jekyll/sponsor/6/website" target="_blank"><img src="https://opencollective.com/jekyll/sponsor/6/avatar.svg" /></a>
73
+ <a href="https://opencollective.com/jekyll/sponsor/7/website" target="_blank"><img src="https://opencollective.com/jekyll/sponsor/7/avatar.svg" /></a>
74
+ <a href="https://opencollective.com/jekyll/sponsor/8/website" target="_blank"><img src="https://opencollective.com/jekyll/sponsor/8/avatar.svg" /></a>
75
+ <a href="https://opencollective.com/jekyll/sponsor/9/website" target="_blank"><img src="https://opencollective.com/jekyll/sponsor/9/avatar.svg" /></a>
76
+
77
+ ### Contributors
78
+
79
+ This project exists thanks to all the people who contribute.
80
+ <a href="../../graphs/contributors"><img src="https://opencollective.com/jekyll/contributors.svg?width=890&button=false" /></a>
81
+
82
+ ### Backers
83
+
84
+ Thank you to all our backers! 🙏 [Become a backer](https://opencollective.com/jekyll#backer)
85
+
86
+ <a href="https://opencollective.com/jekyll#backers" target="_blank"><img src="https://opencollective.com/jekyll/backers.svg?width=890" /></a>
58
87
 
59
88
  ## License
60
89
 
@@ -0,0 +1,3 @@
1
+ url: "" # the base hostname & protocol for your site, e.g. http://example.com
2
+ baseurl: "" # the subpath of your site, e.g. /blog
3
+ title: "" # the name of your site, e.g. ACME Corp.
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="{{ site.lang | default: "en-US" }}">
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <meta charset="utf-8">
6
+ <title>{{ page.title }} - {{ site.title }}</title>
7
+ <link rel="stylesheet" href="{{ "/assets/css/main.css" | relative_url }}">
8
+ </head>
9
+ <body>
10
+ {{ content}}
11
+ </body>
12
+ </html>
@@ -0,0 +1,9 @@
1
+ $backgroundColor: #ffffff;
2
+ $bodyColor: #000000;
3
+ $bodyFont: -apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";
4
+
5
+ body {
6
+ background: $backgroundColor;
7
+ color: $bodyColor;
8
+ font-family: $bodyFont;
9
+ }
@@ -0,0 +1,4 @@
1
+ ---
2
+ ---
3
+
4
+ @import "main";
@@ -0,0 +1,8 @@
1
+ ---
2
+ layout: default
3
+ title: "Happy Jekylling!"
4
+ ---
5
+
6
+ ## You're ready to go!
7
+
8
+ Start developing your Jekyll website.
data/lib/jekyll.rb CHANGED
@@ -54,6 +54,7 @@ module Jekyll
54
54
  autoload :FrontmatterDefaults, "jekyll/frontmatter_defaults"
55
55
  autoload :Hooks, "jekyll/hooks"
56
56
  autoload :Layout, "jekyll/layout"
57
+ autoload :Cache, "jekyll/cache"
57
58
  autoload :CollectionReader, "jekyll/readers/collection_reader"
58
59
  autoload :DataReader, "jekyll/readers/data_reader"
59
60
  autoload :LayoutReader, "jekyll/readers/layout_reader"
@@ -175,6 +176,10 @@ module Jekyll
175
176
 
176
177
  return clean_path if clean_path.eql?(base_directory)
177
178
 
179
+ # remove any remaining extra leading slashes not stripped away by calling
180
+ # `File.expand_path` above.
181
+ clean_path.squeeze!("/")
182
+
178
183
  if clean_path.start_with?(base_directory.sub(%r!\z!, "/"))
179
184
  clean_path
180
185
  else
@@ -0,0 +1,183 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "digest"
4
+
5
+ module Jekyll
6
+ class Cache
7
+ # rubocop:disable Style/ClassVars
8
+ @@caches = {}
9
+ @@disk_cache_enabled = true
10
+
11
+ # Get an existing named cache, or create a new one if none exists
12
+ #
13
+ # name - name of the cache
14
+ #
15
+ # Returns nothing.
16
+ def initialize(name)
17
+ @cache = @@caches[name] ||= {}
18
+ @name = name.gsub(%r![^\w\s-]!, "-")
19
+ end
20
+
21
+ # Set class-wide base_dir
22
+ def self.base_dir=(dir_path)
23
+ @@base_dir = dir_path
24
+ end
25
+
26
+ # Disable Marshaling cached items to disk
27
+ def self.disable_disk_cache!
28
+ @@disk_cache_enabled = false
29
+ end
30
+ # rubocop:enable Style/ClassVars
31
+
32
+ # Clear all caches
33
+ def self.clear
34
+ delete_cache_files
35
+ @@caches.each_value(&:clear)
36
+ end
37
+
38
+ # Clear this particular cache
39
+ def clear
40
+ delete_cache_files
41
+ @cache.clear
42
+ end
43
+
44
+ # Retrieve a cached item
45
+ # Raises if key does not exist in cache
46
+ #
47
+ # Returns cached value
48
+ def [](key)
49
+ return @cache[key] if @cache.key?(key)
50
+
51
+ path = path_to(hash(key))
52
+ if @@disk_cache_enabled && File.file?(path) && File.readable?(path)
53
+ @cache[key] = load(path)
54
+ else
55
+ raise
56
+ end
57
+ end
58
+
59
+ # Add an item to cache
60
+ #
61
+ # Returns nothing.
62
+ def []=(key, value)
63
+ @cache[key] = value
64
+ return unless @@disk_cache_enabled
65
+
66
+ path = path_to(hash(key))
67
+ value = new Hash(value) if value.is_a?(Hash) && !value.default.nil?
68
+ dump(path, value)
69
+ rescue TypeError
70
+ Jekyll.logger.debug "Cache:", "Cannot dump object #{key}"
71
+ end
72
+
73
+ # If an item already exists in the cache, retrieve it
74
+ # Else execute code block, and add the result to the cache, and return that
75
+ # result
76
+ def getset(key)
77
+ self[key]
78
+ rescue StandardError
79
+ value = yield
80
+ self[key] = value
81
+ value
82
+ end
83
+
84
+ # Remove one particular item from the cache
85
+ #
86
+ # Returns nothing.
87
+ def delete(key)
88
+ @cache.delete(key)
89
+ return unless @@disk_cache_enabled
90
+
91
+ path = path_to(hash(key))
92
+ File.delete(path)
93
+ end
94
+
95
+ # Check if `key` already exists in this cache
96
+ #
97
+ # Returns true if key exists in the cache, false otherwise
98
+ def key?(key)
99
+ # First, check if item is already cached in memory
100
+ return true if @cache.key?(key)
101
+ # Otherwise, it might be cached on disk
102
+ # but we should not consider the disk cache if it is disabled
103
+ return false unless @@disk_cache_enabled
104
+
105
+ path = path_to(hash(key))
106
+ File.file?(path) && File.readable?(path)
107
+ end
108
+
109
+ # Compare the current config to the cached config
110
+ # If they are different, clear all caches
111
+ #
112
+ # Returns nothing.
113
+ def self.clear_if_config_changed(config)
114
+ config = config.inspect
115
+ cache = Jekyll::Cache.new "Jekyll::Cache"
116
+ return if cache.key?("config") && cache["config"] == config
117
+
118
+ clear
119
+ cache = Jekyll::Cache.new "Jekyll::Cache"
120
+ cache["config"] = config
121
+ nil
122
+ end
123
+
124
+ private
125
+
126
+ # Given a hashed key, return the path to where this item would be saved on
127
+ # disk
128
+ def path_to(hash = nil)
129
+ @base_dir ||= File.join(@@base_dir, @name)
130
+ return @base_dir if hash.nil?
131
+
132
+ File.join(@base_dir, hash[0..1], hash[2..-1]).freeze
133
+ end
134
+
135
+ # Given a key, return a SHA2 hash that can be used for caching this item to
136
+ # disk
137
+ def hash(key)
138
+ Digest::SHA2.hexdigest(key).freeze
139
+ end
140
+
141
+ # Remove all this caches items from disk
142
+ #
143
+ # Returns nothing.
144
+ def delete_cache_files
145
+ FileUtils.rm_rf(path_to) if @@disk_cache_enabled
146
+ end
147
+
148
+ # Delete all cached items from all caches
149
+ #
150
+ # Returns nothing.
151
+ def self.delete_cache_files
152
+ FileUtils.rm_rf(@@base_dir) if @@disk_cache_enabled
153
+ end
154
+ private_class_method :delete_cache_files
155
+
156
+ # Load `path` from disk and return the result
157
+ # This MUST NEVER be called in Safe Mode
158
+ # rubocop:disable Security/MarshalLoad
159
+ def load(path)
160
+ raise unless @@disk_cache_enabled
161
+
162
+ cached_file = File.open(path, "rb")
163
+ value = Marshal.load(cached_file)
164
+ cached_file.close
165
+ value
166
+ end
167
+ # rubocop:enable Security/MarshalLoad
168
+
169
+ # Given a path and a value, save value to disk at path
170
+ # This should NEVER be called in Safe Mode
171
+ #
172
+ # Returns nothing.
173
+ def dump(path, value)
174
+ return unless @@disk_cache_enabled
175
+
176
+ dir = File.dirname(path)
177
+ FileUtils.mkdir_p(dir)
178
+ File.open(path, "wb") do |cached_file|
179
+ Marshal.dump(value, cached_file)
180
+ end
181
+ end
182
+ end
183
+ end