lifer 0.11.0 → 0.12.3
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.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +2 -2
- data/CHANGELOG.md +34 -1
- data/Gemfile.lock +64 -59
- data/lib/lifer/builder/html/from_any.rb +1 -1
- data/lib/lifer/builder/html/from_erb.rb +52 -3
- data/lib/lifer/builder/html/from_liquid.rb +4 -4
- data/lib/lifer/builder/html.rb +16 -3
- data/lib/lifer/dev/response.rb +57 -9
- data/lib/lifer/utilities.rb +2 -2
- data/lib/lifer/version.rb +1 -1
- data/lifer.gemspec +1 -0
- metadata +19 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 71407123cb005d99c9ffc1cde0c263921d0c45c22936c95b0ccced6bc189cb54
|
|
4
|
+
data.tar.gz: 2b4a5ba58c99283e8df136e492c653bd04761c0b07ea643e7de7ed00216bfb37
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4dfed0a714043b38b861c0dbdae8f12d22c0b3fb4dda11f494dfed56cb346e6abcdfb87ce270dd9b17b2259751ef99b05516eee039c933b2d4b53c45897c9456
|
|
7
|
+
data.tar.gz: 42a12372430de5c6a2e96ddeb211b82e9c82fde78be316d4cc4b5fbbdfaa87877fce7940e32dfb49bbc69ceb0e64a4b57f228a6a53ba536c017e3c92aa06a83e
|
data/.github/workflows/main.yml
CHANGED
|
@@ -7,11 +7,11 @@ jobs:
|
|
|
7
7
|
name: Run RSpec test suite
|
|
8
8
|
runs-on: ubuntu-latest
|
|
9
9
|
steps:
|
|
10
|
-
- uses: actions/checkout@
|
|
10
|
+
- uses: actions/checkout@v6
|
|
11
11
|
- name: Set up Ruby
|
|
12
12
|
uses: ruby/setup-ruby@v1
|
|
13
13
|
with:
|
|
14
|
-
ruby-version: 3.
|
|
14
|
+
ruby-version: 3.4
|
|
15
15
|
bundler-cache: true
|
|
16
16
|
- name: Run the default task
|
|
17
17
|
run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
## Next
|
|
2
2
|
|
|
3
|
+
## v0.12.3
|
|
4
|
+
|
|
5
|
+
This release just resolves some issues I was having with the platform in
|
|
6
|
+
the gem specification being set wrong. Unfortunately, it was set wrong for
|
|
7
|
+
both the 0.12.1 and 0.12.2 releases. So, this release is just a resolution
|
|
8
|
+
to this little issue.
|
|
9
|
+
|
|
10
|
+
## v0.12.2
|
|
11
|
+
|
|
12
|
+
This release makes minor improvements to the development server by adding
|
|
13
|
+
additional servable MIME types. That's all.
|
|
14
|
+
|
|
15
|
+
## v0.12.1
|
|
16
|
+
|
|
17
|
+
This patch release resolves a couple of issues that may affect users:
|
|
18
|
+
|
|
19
|
+
- This release makes the implicit dependency on `base64` explicit. This
|
|
20
|
+
is necessary because as of Ruby 3.4, `base64` is no longer part of Ruby's
|
|
21
|
+
standard library.
|
|
22
|
+
- Resolves errors when `Lifer::Utilities#stringify_keys` or `#symbolize_keys`
|
|
23
|
+
are passed `nil` or an empty hash.
|
|
24
|
+
|
|
25
|
+
## v0.12.0
|
|
26
|
+
|
|
27
|
+
This release adds a new `#render` method that can be used in any ERB files being
|
|
28
|
+
built into HTML documents. It matches the functionality of Liquid's builtiin
|
|
29
|
+
`render` functionality. So:
|
|
30
|
+
|
|
31
|
+
{% render "my_partial.html.liquid" with local_variable: "some-value" %}
|
|
32
|
+
|
|
33
|
+
is equivalent to:
|
|
34
|
+
|
|
35
|
+
<%= render "my_partial.html.erb", local_variable: "some-value" %>
|
|
36
|
+
|
|
3
37
|
## v0.11.0
|
|
4
38
|
|
|
5
39
|
This release adds new functionality to our URI strategies, adding
|
|
@@ -36,7 +70,6 @@ trash.
|
|
|
36
70
|
The summary is meant to be ideal for things like `<meta>` description tags,
|
|
37
71
|
which should only contain plain text.
|
|
38
72
|
|
|
39
|
-
|
|
40
73
|
## v0.10.0
|
|
41
74
|
|
|
42
75
|
This release lets all layout files (either Liquid or ERB files) provide a
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
lifer (0.
|
|
4
|
+
lifer (0.12.3)
|
|
5
|
+
base64
|
|
5
6
|
i18n (< 2)
|
|
6
7
|
kramdown (~> 2.4)
|
|
7
8
|
liquid (~> 5.6, < 6)
|
|
@@ -14,9 +15,10 @@ PATH
|
|
|
14
15
|
GEM
|
|
15
16
|
remote: https://rubygems.org/
|
|
16
17
|
specs:
|
|
17
|
-
addressable (2.8.
|
|
18
|
-
public_suffix (>= 2.0.2, <
|
|
19
|
-
|
|
18
|
+
addressable (2.8.8)
|
|
19
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
20
|
+
base64 (0.3.0)
|
|
21
|
+
bigdecimal (4.0.1)
|
|
20
22
|
bump (0.10.0)
|
|
21
23
|
capybara (3.40.0)
|
|
22
24
|
addressable
|
|
@@ -27,96 +29,99 @@ GEM
|
|
|
27
29
|
rack-test (>= 0.6.3)
|
|
28
30
|
regexp_parser (>= 1.5, < 3.0)
|
|
29
31
|
xpath (~> 3.2)
|
|
30
|
-
concurrent-ruby (1.3.
|
|
31
|
-
|
|
32
|
+
concurrent-ruby (1.3.6)
|
|
33
|
+
date (3.5.1)
|
|
34
|
+
debug (1.11.1)
|
|
32
35
|
irb (~> 1.10)
|
|
33
36
|
reline (>= 0.3.8)
|
|
34
|
-
diff-lcs (1.
|
|
35
|
-
|
|
36
|
-
ffi (1.17.
|
|
37
|
-
|
|
38
|
-
i18n (1.14.7)
|
|
37
|
+
diff-lcs (1.6.2)
|
|
38
|
+
erb (6.0.1)
|
|
39
|
+
ffi (1.17.3)
|
|
40
|
+
i18n (1.14.8)
|
|
39
41
|
concurrent-ruby (~> 1.0)
|
|
40
|
-
io-console (0.
|
|
41
|
-
irb (1.
|
|
42
|
+
io-console (0.8.2)
|
|
43
|
+
irb (1.16.0)
|
|
44
|
+
pp (>= 0.6.0)
|
|
42
45
|
rdoc (>= 4.0.0)
|
|
43
46
|
reline (>= 0.4.2)
|
|
44
|
-
kramdown (2.5.
|
|
45
|
-
rexml (>= 3.
|
|
46
|
-
language_server-protocol (3.17.0.
|
|
47
|
-
liquid (5.
|
|
47
|
+
kramdown (2.5.2)
|
|
48
|
+
rexml (>= 3.4.4)
|
|
49
|
+
language_server-protocol (3.17.0.5)
|
|
50
|
+
liquid (5.11.0)
|
|
48
51
|
bigdecimal
|
|
49
52
|
strscan (>= 3.1.1)
|
|
50
|
-
listen (3.
|
|
53
|
+
listen (3.10.0)
|
|
54
|
+
logger
|
|
51
55
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
52
56
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
53
|
-
logger (1.
|
|
54
|
-
matrix (0.4.
|
|
57
|
+
logger (1.7.0)
|
|
58
|
+
matrix (0.4.3)
|
|
55
59
|
mini_mime (1.1.5)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
racc (~> 1.4)
|
|
61
|
-
nokogiri (1.16.7-x86_64-linux)
|
|
60
|
+
mini_portile2 (2.8.9)
|
|
61
|
+
nio4r (2.7.5)
|
|
62
|
+
nokogiri (1.19.0)
|
|
63
|
+
mini_portile2 (~> 2.8.2)
|
|
62
64
|
racc (~> 1.4)
|
|
63
|
-
parallel (1.
|
|
64
|
-
parallel_tests (
|
|
65
|
+
parallel (1.27.0)
|
|
66
|
+
parallel_tests (5.5.0)
|
|
65
67
|
parallel
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
pp (0.6.3)
|
|
69
|
+
prettyprint
|
|
70
|
+
prettyprint (0.2.0)
|
|
71
|
+
prism (1.9.0)
|
|
72
|
+
psych (5.3.1)
|
|
73
|
+
date
|
|
68
74
|
stringio
|
|
69
|
-
public_suffix (
|
|
70
|
-
puma (6.6.
|
|
75
|
+
public_suffix (7.0.2)
|
|
76
|
+
puma (6.6.1)
|
|
71
77
|
nio4r (~> 2.0)
|
|
72
78
|
racc (1.8.1)
|
|
73
|
-
rack (3.
|
|
74
|
-
rack-test (2.
|
|
79
|
+
rack (3.2.4)
|
|
80
|
+
rack-test (2.2.0)
|
|
75
81
|
rack (>= 1.3)
|
|
76
|
-
rake (13.
|
|
82
|
+
rake (13.3.1)
|
|
77
83
|
rb-fsevent (0.11.2)
|
|
78
84
|
rb-inotify (0.11.1)
|
|
79
85
|
ffi (~> 1.0)
|
|
80
|
-
rbs (3.
|
|
86
|
+
rbs (3.10.3)
|
|
81
87
|
logger
|
|
82
|
-
|
|
88
|
+
tsort
|
|
89
|
+
rdoc (7.1.0)
|
|
90
|
+
erb
|
|
83
91
|
psych (>= 4.0.0)
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
tsort
|
|
93
|
+
regexp_parser (2.11.3)
|
|
94
|
+
reline (0.6.3)
|
|
86
95
|
io-console (~> 0.5)
|
|
87
|
-
rexml (3.4.
|
|
88
|
-
rspec (3.13.
|
|
96
|
+
rexml (3.4.4)
|
|
97
|
+
rspec (3.13.2)
|
|
89
98
|
rspec-core (~> 3.13.0)
|
|
90
99
|
rspec-expectations (~> 3.13.0)
|
|
91
100
|
rspec-mocks (~> 3.13.0)
|
|
92
|
-
rspec-core (3.13.
|
|
101
|
+
rspec-core (3.13.6)
|
|
93
102
|
rspec-support (~> 3.13.0)
|
|
94
|
-
rspec-expectations (3.13.
|
|
103
|
+
rspec-expectations (3.13.5)
|
|
95
104
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
96
105
|
rspec-support (~> 3.13.0)
|
|
97
|
-
rspec-mocks (3.13.
|
|
106
|
+
rspec-mocks (3.13.7)
|
|
98
107
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
99
108
|
rspec-support (~> 3.13.0)
|
|
100
|
-
rspec-support (3.13.
|
|
101
|
-
rss (0.3.
|
|
109
|
+
rspec-support (3.13.7)
|
|
110
|
+
rss (0.3.2)
|
|
102
111
|
rexml
|
|
103
|
-
ruby-lsp (0.
|
|
112
|
+
ruby-lsp (0.26.5)
|
|
104
113
|
language_server-protocol (~> 3.17.0)
|
|
105
|
-
prism (
|
|
106
|
-
rbs (>= 3, <
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
strscan (3.1.5)
|
|
114
|
+
prism (>= 1.2, < 2.0)
|
|
115
|
+
rbs (>= 3, < 5)
|
|
116
|
+
stringio (3.2.0)
|
|
117
|
+
strscan (3.1.7)
|
|
118
|
+
tsort (0.2.0)
|
|
111
119
|
xpath (3.2.0)
|
|
112
120
|
nokogiri (~> 1.8)
|
|
113
|
-
yard (0.9.
|
|
121
|
+
yard (0.9.38)
|
|
114
122
|
|
|
115
123
|
PLATFORMS
|
|
116
|
-
|
|
117
|
-
x86_64-darwin-21
|
|
118
|
-
x86_64-darwin-22
|
|
119
|
-
x86_64-linux
|
|
124
|
+
ruby
|
|
120
125
|
|
|
121
126
|
DEPENDENCIES
|
|
122
127
|
bump
|
|
@@ -131,4 +136,4 @@ DEPENDENCIES
|
|
|
131
136
|
yard
|
|
132
137
|
|
|
133
138
|
BUNDLED WITH
|
|
134
|
-
2.
|
|
139
|
+
2.6.9
|
|
@@ -11,6 +11,8 @@ class Lifer::Builder::HTML
|
|
|
11
11
|
# </head>
|
|
12
12
|
#
|
|
13
13
|
# <body>
|
|
14
|
+
# <%= partial "_layouts/header.html.erb" %>
|
|
15
|
+
#
|
|
14
16
|
# <h1><%= my_collection.name %></h1>
|
|
15
17
|
#
|
|
16
18
|
# <% my_collection.entries.each do |entry| %>
|
|
@@ -20,22 +22,31 @@ class Lifer::Builder::HTML
|
|
|
20
22
|
# <a href="<%= entry.permalink %>">Read more</a>
|
|
21
23
|
# </section>
|
|
22
24
|
# <% end %>
|
|
25
|
+
#
|
|
26
|
+
# <%= partial "_layouts/footer.html.erb" %>
|
|
23
27
|
# </body>
|
|
24
28
|
# </html>
|
|
25
29
|
#
|
|
26
30
|
class FromERB < FromAny
|
|
27
31
|
# Reads the entry as ERB, given our renderer context (see the documentation
|
|
28
|
-
# for `#build_binding_context`) and
|
|
32
|
+
# for `#build_binding_context`) and builds the production-ready entry.
|
|
29
33
|
#
|
|
30
|
-
# @return [String] The
|
|
31
|
-
def
|
|
34
|
+
# @return [String] The resulting HTML entry.
|
|
35
|
+
def build
|
|
32
36
|
document = ERB.new(layout_file_contents).result context
|
|
33
37
|
|
|
34
38
|
return document unless (relative_layout_path = frontmatter[:layout])
|
|
35
39
|
|
|
36
40
|
document_binding = binding.tap { |binding|
|
|
41
|
+
context.local_variables.each do |variable|
|
|
42
|
+
next if variable == :content
|
|
43
|
+
|
|
44
|
+
binding.local_variable_set variable,
|
|
45
|
+
context.local_variable_get(variable)
|
|
46
|
+
end
|
|
37
47
|
binding.local_variable_set :content, document
|
|
38
48
|
}
|
|
49
|
+
|
|
39
50
|
layout_path = "%s/%s" % [Lifer.root, relative_layout_path]
|
|
40
51
|
ERB.new(File.read layout_path).result(document_binding)
|
|
41
52
|
end
|
|
@@ -95,6 +106,11 @@ class Lifer::Builder::HTML
|
|
|
95
106
|
binding.local_variable_set :tags, tags
|
|
96
107
|
binding.local_variable_set :content,
|
|
97
108
|
ERB.new(entry.to_html).result(binding)
|
|
109
|
+
|
|
110
|
+
define_singleton_method :render,
|
|
111
|
+
-> (relative_path_to_template, locals = {}) {
|
|
112
|
+
partial_render_method relative_path_to_template, locals
|
|
113
|
+
}
|
|
98
114
|
}
|
|
99
115
|
end
|
|
100
116
|
|
|
@@ -105,5 +121,38 @@ class Lifer::Builder::HTML
|
|
|
105
121
|
def tag_context_class
|
|
106
122
|
@tag_context_class ||= Class.new(Array) do end
|
|
107
123
|
end
|
|
124
|
+
|
|
125
|
+
# @private
|
|
126
|
+
# If the end user should want to render a partial from an entry or a layout
|
|
127
|
+
# file, this method provides the functionality for the `#partial` method
|
|
128
|
+
# provided to the ERB template context, complete with all of the information
|
|
129
|
+
# one might want want about the entry, project collections, and so on, that's
|
|
130
|
+
# available from entry and layout templates.
|
|
131
|
+
#
|
|
132
|
+
# @example Usage
|
|
133
|
+
# <%= partial "_layouts/my_partial.html.erb", id: "123" %>
|
|
134
|
+
# @param relative_path_to_template [String] The path, from the Lifer root,
|
|
135
|
+
# to the partial layout file.
|
|
136
|
+
# @param locals [Hash] Additional data that should be passed along for
|
|
137
|
+
# rendering the partial.
|
|
138
|
+
# @return [String] The rendered partial document.
|
|
139
|
+
def partial_render_method(relative_path_to_template, locals)
|
|
140
|
+
template_path = File.join(Lifer.root, relative_path_to_template)
|
|
141
|
+
|
|
142
|
+
partial_binding = binding.tap { |binding|
|
|
143
|
+
context.local_variables.each do |variable|
|
|
144
|
+
next if variable == :content
|
|
145
|
+
|
|
146
|
+
binding.local_variable_set variable,
|
|
147
|
+
context.local_variable_get(variable)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
locals.each do |key, value|
|
|
151
|
+
binding.local_variable_set key.to_sym, value
|
|
152
|
+
end
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
ERB.new(File.read template_path).result(partial_binding)
|
|
156
|
+
end
|
|
108
157
|
end
|
|
109
158
|
end
|
|
@@ -28,11 +28,11 @@ class Lifer::Builder::HTML
|
|
|
28
28
|
require_relative "from_liquid/filters"
|
|
29
29
|
require_relative "from_liquid/liquid_env"
|
|
30
30
|
|
|
31
|
-
# Reads the entry
|
|
32
|
-
#
|
|
31
|
+
# Reads the Liquid entry, given our document context, and builds an HTML
|
|
32
|
+
# document.
|
|
33
33
|
#
|
|
34
|
-
# @return [String] The
|
|
35
|
-
def
|
|
34
|
+
# @return [String] The resulting HTML entry.
|
|
35
|
+
def build
|
|
36
36
|
document_context = context.merge!(
|
|
37
37
|
"content" => Liquid::Template
|
|
38
38
|
.parse(entry.to_html, **parse_options)
|
data/lib/lifer/builder/html.rb
CHANGED
|
@@ -7,9 +7,22 @@ require "fileutils"
|
|
|
7
7
|
# ERB[1] or Liquid[2] template files. The layout file yields entry contents
|
|
8
8
|
# via a `content` call that is parsed by ERB or Liquid.
|
|
9
9
|
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
10
|
+
# It is normal to have templates that render other templates. So normal, in
|
|
11
|
+
# fact, that Liquid provides a built-in `render` function that allows us to render
|
|
12
|
+
# partials from other Liquid files:
|
|
13
|
+
#
|
|
14
|
+
# {% render "path/to/my/partial.html.liquid" with local_variable: "value" %}
|
|
15
|
+
#
|
|
16
|
+
# And we've ensured a similar `render` function exists for our ERB HTML builder:
|
|
17
|
+
#
|
|
18
|
+
# <%= render "path/to/my/partial.html.erb", local_variable: "value" %>
|
|
19
|
+
#
|
|
20
|
+
# The entry being built will include contextual data about the current project,
|
|
21
|
+
# so that the user can build out normal website features like navigation links,
|
|
22
|
+
# indexes, and so on. Note that with the current Liquid implementation, you may
|
|
23
|
+
# need to explicitly pass context from layouts to the partials that require it via
|
|
24
|
+
# `with`. Meanwhile, the ERB implementation provides a bunch of context globally.
|
|
25
|
+
# Context includes:
|
|
13
26
|
#
|
|
14
27
|
# - `my_collection_name`: Or, any collection by name.
|
|
15
28
|
#
|
data/lib/lifer/dev/response.rb
CHANGED
|
@@ -21,9 +21,7 @@ module Lifer::Dev
|
|
|
21
21
|
# 3. The HTTP body response.
|
|
22
22
|
#
|
|
23
23
|
# @return [Array] A Rack-compatible response.
|
|
24
|
-
def build
|
|
25
|
-
[status, {"Content-Type": content_type}, contents]
|
|
26
|
-
end
|
|
24
|
+
def build = [status, {"Content-Type": content_type}, contents]
|
|
27
25
|
|
|
28
26
|
private
|
|
29
27
|
|
|
@@ -33,28 +31,78 @@ module Lifer::Dev
|
|
|
33
31
|
[File.read(path)]
|
|
34
32
|
end
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
|
|
35
|
+
# The MIME type for the current path. Because Lifer only offers a server
|
|
36
|
+
# for development mode, this is just a simple map based on common known
|
|
37
|
+
# MIME types. We recommend submitting a patch or monkey-patching this
|
|
38
|
+
# method if it does not suit your needs in development. For more
|
|
39
|
+
# information:
|
|
40
|
+
#
|
|
41
|
+
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types/Common_types
|
|
42
|
+
#
|
|
43
|
+
# @fixme It would be very nice to not manually manage this list of
|
|
37
44
|
# content types. Is there a nice, dependency-free way to do this?
|
|
38
45
|
#
|
|
46
|
+
# @return [String] The MIME type for the current path's file extension.
|
|
39
47
|
def content_type
|
|
40
48
|
case File.extname(path)
|
|
49
|
+
when ".aac" then "audio/aac"
|
|
50
|
+
when ".apng" then "image/apng"
|
|
51
|
+
when ".avi" then "video/x-msvideo"
|
|
52
|
+
when ".avif" then "image/avif"
|
|
53
|
+
when ".bin" then "application/octet-stream"
|
|
54
|
+
when ".bmp" then "image/bmp"
|
|
41
55
|
when ".css" then "text/css"
|
|
56
|
+
when ".csv" then "text/csv"
|
|
57
|
+
when ".epub" then "application/epub+zip"
|
|
58
|
+
when ".gz" then "application/gzip"
|
|
59
|
+
when ".gif" then "image/gif"
|
|
42
60
|
when ".html" then "text/html"
|
|
43
61
|
when ".ico" then "image/ico"
|
|
62
|
+
when ".ics" then "text/calendar"
|
|
63
|
+
when ".jpeg", ".jpg" then "image/jpg"
|
|
44
64
|
when ".js" then "text/javascript"
|
|
65
|
+
when ".json" then "application/json"
|
|
66
|
+
when ".jsonld" then "application/ld+json"
|
|
67
|
+
when ".mid", ".midi" then "audio/midi"
|
|
45
68
|
when ".map" then "application/json"
|
|
69
|
+
when ".mpkg" then "application/vnd.apple.installer+xml"
|
|
70
|
+
when ".mp3" then "audio/mpeg"
|
|
71
|
+
when ".mp4" then "video/mp4"
|
|
72
|
+
when ".mpeg" then "video/mpeg"
|
|
73
|
+
when ".oga" then "audio/ogg"
|
|
74
|
+
when ".ogv" then "video/ogg"
|
|
75
|
+
when ".ogx" then "application/ogg"
|
|
76
|
+
when ".opus" then "audio/ogg"
|
|
77
|
+
when ".otf" then "font/otf"
|
|
78
|
+
when ".pdf" then "application/pdf"
|
|
79
|
+
when ".png" then "image/png"
|
|
80
|
+
when ".rar" then "application/vnd.rar"
|
|
81
|
+
when ".rtf" then "application/rtf"
|
|
82
|
+
when ".sh" then "application/x-sh"
|
|
83
|
+
when ".svg" then "image/svg+xml"
|
|
84
|
+
when ".tar" then "application/x-tar"
|
|
85
|
+
when ".tif", ".tiff" then "image/tiff"
|
|
86
|
+
when ".ttf" then "font/tff"
|
|
46
87
|
when ".txt" then "text/plain"
|
|
47
|
-
when ".
|
|
48
|
-
when ".
|
|
88
|
+
when ".wav" then "audio/wav"
|
|
89
|
+
when ".weba" then "audio/webm"
|
|
90
|
+
when ".webm" then "video/webm"
|
|
91
|
+
when ".webmanifest" then "application/manifest+json"
|
|
92
|
+
when ".webp" then "image/webp"
|
|
93
|
+
when ".woff", ".woff2" then "application/font-woff2"
|
|
94
|
+
when ".xml" then "application/xml"
|
|
95
|
+
when ".xhtml" then "application/xhtml+xml"
|
|
49
96
|
when ".xml" then "application/xml"
|
|
97
|
+
when ".xul" then "application/vnd.mozilla.xul+xml"
|
|
98
|
+
when ".zip" then "application/zip"
|
|
99
|
+
when ".7z" then "application/x-7z-compressed"
|
|
50
100
|
else
|
|
51
101
|
raise NotImplementedError,
|
|
52
102
|
I18n.t("dev.router.content_type_not_implemented", path:)
|
|
53
103
|
end
|
|
54
104
|
end
|
|
55
105
|
|
|
56
|
-
def status
|
|
57
|
-
File.exist?(path) ? 200 : 404
|
|
58
|
-
end
|
|
106
|
+
def status = File.exist?(path) ? 200 : 404
|
|
59
107
|
end
|
|
60
108
|
end
|
data/lib/lifer/utilities.rb
CHANGED
|
@@ -101,7 +101,7 @@ module Lifer::Utilities
|
|
|
101
101
|
def stringify_keys(hash)
|
|
102
102
|
stringified_hash = {}
|
|
103
103
|
|
|
104
|
-
hash
|
|
104
|
+
hash&.each do |key, value|
|
|
105
105
|
stringified_hash[(key.to_s rescue key) || key] =
|
|
106
106
|
value.is_a?(Hash) ? stringify_keys(value) : value
|
|
107
107
|
|
|
@@ -119,7 +119,7 @@ module Lifer::Utilities
|
|
|
119
119
|
def symbolize_keys(hash)
|
|
120
120
|
symbolized_hash = {}
|
|
121
121
|
|
|
122
|
-
hash
|
|
122
|
+
hash&.each do |key, value|
|
|
123
123
|
symbolized_hash[(key.to_sym rescue key) || key] =
|
|
124
124
|
value.is_a?(Hash) ? symbolize_keys(value) : value
|
|
125
125
|
|
data/lib/lifer/version.rb
CHANGED
data/lifer.gemspec
CHANGED
|
@@ -36,6 +36,7 @@ Gem::Specification.new do |spec|
|
|
|
36
36
|
spec.files.grep(%r{\Abin/}) { |bin_file| File.basename(bin_file) }
|
|
37
37
|
spec.require_paths = ["lib"]
|
|
38
38
|
|
|
39
|
+
spec.add_dependency "base64"
|
|
39
40
|
spec.add_dependency "i18n", "< 2"
|
|
40
41
|
spec.add_dependency "kramdown", "~> 2.4"
|
|
41
42
|
spec.add_dependency "liquid", ["~> 5.6", "< 6"]
|
metadata
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lifer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.12.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- benjamin wil
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-02-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: base64
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
13
27
|
- !ruby/object:Gem::Dependency
|
|
14
28
|
name: i18n
|
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -210,8 +224,8 @@ licenses:
|
|
|
210
224
|
- MIT
|
|
211
225
|
metadata:
|
|
212
226
|
allowed_push_host: https://rubygems.org
|
|
213
|
-
homepage_uri: https://github.com/benjaminwil/lifer/blob/v0.
|
|
214
|
-
source_code_uri: https://github.com/benjaminwil/lifer/tree/v0.
|
|
227
|
+
homepage_uri: https://github.com/benjaminwil/lifer/blob/v0.12.3/README.md
|
|
228
|
+
source_code_uri: https://github.com/benjaminwil/lifer/tree/v0.12.3
|
|
215
229
|
changelog_uri: https://github.com/benjaminwil/lifer/blob/main/CHANGELOG.md
|
|
216
230
|
post_install_message:
|
|
217
231
|
rdoc_options: []
|
|
@@ -228,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
228
242
|
- !ruby/object:Gem::Version
|
|
229
243
|
version: '0'
|
|
230
244
|
requirements: []
|
|
231
|
-
rubygems_version: 3.5.
|
|
245
|
+
rubygems_version: 3.5.22
|
|
232
246
|
signing_key:
|
|
233
247
|
specification_version: 4
|
|
234
248
|
summary: Minimal static weblog generator.
|