lifer 0.14.0 → 0.15.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4416a9edb890d8d98adc06d1baf7e58b695d85da827b48005d7285b6f5a1dbe
4
- data.tar.gz: 0c45a40304601d473c946315ddea56860041339e029467f8bcecb603ca70a58a
3
+ metadata.gz: 77ae4b570449457ff719f5376089d578acd28e3cdd9e488c01b4948e94c7cc37
4
+ data.tar.gz: f016806b8615fd54792ea974eedba56988a5ec45cfdb3874370f9dade6b4e0b7
5
5
  SHA512:
6
- metadata.gz: b8aa3c53f350191b59ff5105ac1130c62c4a2f690aca83794877b933e7d7bfa23e501d2c91bd90dfc4954a4db9edf57b5db8ea4c4bf75fe78aa3e3e3e7e20e0c
7
- data.tar.gz: f9b729936ec8ef025d9bc6dc8b6deab6d4d63c1d281da50e99df5932cd1f245c581c911378a703f1ddb7e6a5167f21fa746a780ac9e9ad72f29721d93bf34215
6
+ metadata.gz: 75781a84cac83ab375a2e899ec0d9dc9dc1299308638a2afa546eb534570b8529713145dd64516d336fce7e28f6447084b31a689e5334ee8bc891c83d99608d1
7
+ data.tar.gz: f010be935ca56e945895ca9eb4441b30f944cd56a32b278c1cef2d0b854822b9d4cfed18f3745b4e4f191e6fa1d90ec79f2b9cd9c48949daea403d554ac97d4a
data/CHANGELOG.md CHANGED
@@ -1,4 +1,30 @@
1
1
  ## Next
2
+ ## v0.15.1
3
+
4
+ In this release:
5
+
6
+ - Entry IDs and permalinks are no longer equivalent. This helps us build out
7
+ entries (or something with the same interface as entries) that aren't
8
+ represented by a file on disk.
9
+ - The `node_modules` directory is now ignored at build time.
10
+
11
+ ## v0.15.0
12
+
13
+ The theme for this release is improved error messaging
14
+
15
+ - If the project root is equal to the `Lifer.gem_root`, we now exit before
16
+ attempting to build. This is just a quality-of-life improvement for
17
+ developers, to ensure that the project and Lifer development environment
18
+ are isolated from each other.
19
+ - When building HTML from Liquid templates, we now use the `:strict2`
20
+ error mode and the error-raising `#render!` method for Liquid documents
21
+ now. This results in build failing early rather than Liquid builds succeeding
22
+ with entry contents that include strings like "Liquid error: blah blah."
23
+ - When any entry fails to build for some reason, we now rescue the error,
24
+ inject an error message and entry context into STDOUT, and then re-raise
25
+ the original error. This should improve the experience of debugging template
26
+ bugs in projects.
27
+
2
28
  ## v0.14.0
3
29
 
4
30
  This release includes some really nice improvements and bug fixes:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lifer (0.14.0)
4
+ lifer (0.15.1)
5
5
  base64
6
6
  i18n (< 2)
7
7
  kramdown (~> 2.4)
@@ -11,6 +11,14 @@ class Lifer::Builder
11
11
  # @return [String] The rendered entry.
12
12
  def build(entry:)
13
13
  new(entry: entry).build
14
+ rescue => error
15
+ Lifer::Message.error "builder.catchall_failure", context: {
16
+ entry_path: entry.path,
17
+ collection: entry.collection,
18
+ layout_file: entry.collection&.layout_file,
19
+ error_message: error.message
20
+ }.to_json
21
+ raise(error)
14
22
  end
15
23
  end
16
24
 
@@ -16,7 +16,7 @@ class Lifer::Builder::HTML::FromLiquid
16
16
  # @return [Lifer::Environment]
17
17
  def self.global
18
18
  Liquid::Environment.build do |environment|
19
- environment.error_mode = :strict
19
+ environment.error_mode = :strict2
20
20
 
21
21
  environment.file_system =
22
22
  Liquid::LocalFileSystem.new(Lifer.root, "%s.html.liquid")
@@ -40,7 +40,7 @@ class Lifer::Builder::HTML
40
40
  )
41
41
  document = Liquid::Template
42
42
  .parse(layout_file_contents, **parse_options)
43
- .render(document_context, **render_options)
43
+ .render!(document_context, **render_options)
44
44
 
45
45
  return document unless (relative_layout_path = frontmatter[:layout])
46
46
 
@@ -83,7 +83,7 @@ class Lifer::Builder::HTML
83
83
  def parse_options
84
84
  {
85
85
  environment: liquid_environment,
86
- error_mode: :strict
86
+ error_mode: :strict2
87
87
  }
88
88
  end
89
89
 
@@ -117,7 +117,7 @@ class Lifer::Builder
117
117
  # by the end of this procedure.
118
118
  def json_feed_entry(feed_object, lifer_entry, lifer_collection)
119
119
  feed_item_object = {
120
- id: lifer_entry.permalink,
120
+ id: lifer_entry.identifier,
121
121
  url: lifer_entry.permalink,
122
122
  external_url: lifer_entry.frontmatter[:external_url],
123
123
  title: lifer_entry.title,
@@ -216,7 +216,7 @@ class Lifer::Builder::RSS < Lifer::Builder
216
216
  if (authors = lifer_entry.authors).any?
217
217
  rss_feed_item.author = authors.join(", ")
218
218
  end
219
- rss_feed_item.id = lifer_entry.permalink
219
+ rss_feed_item.id = lifer_entry.identifier
220
220
  rss_feed_item.link = lifer_entry.permalink
221
221
  rss_feed_item.title = lifer_entry.title
222
222
  rss_feed_item.summary = lifer_entry.summary
data/lib/lifer/cli.rb CHANGED
@@ -66,6 +66,11 @@ module Lifer
66
66
  parser.parse! args
67
67
 
68
68
  brain = Lifer.brain(**{root: @root, config_file: @config_file}.compact)
69
+ if brain.root == Lifer.gem_root
70
+ Lifer::Message.error("cli.pwd_is_gem_root", root: brain.root)
71
+ return
72
+ end
73
+
69
74
  brain.require_user_provided_ruby_files!
70
75
 
71
76
  case subcommand
data/lib/lifer/entry.rb CHANGED
@@ -205,6 +205,12 @@ module Lifer
205
205
  @full_text ||= File.readlines(file).join if file
206
206
  end
207
207
 
208
+ # A unique identifier for the current entry. For all entry types (so far)
209
+ # it makes sense to use the permalink.
210
+ #
211
+ # @return [String] The permalink (using the defafult global host argument).
212
+ def identifier = permalink
213
+
208
214
  # The file extension to be used when at the entry's build time. For
209
215
  # example, a Markdown file should be built to HTML.
210
216
  #
data/lib/lifer/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lifer
2
- VERSION = "0.14.0"
2
+ VERSION = "0.15.1"
3
3
  end
data/lib/lifer.rb CHANGED
@@ -13,6 +13,7 @@ module Lifer
13
13
  IGNORE_DIRECTORIES = [
14
14
  "assets",
15
15
  "bin",
16
+ "node_modules",
16
17
  "vendor"
17
18
  ]
18
19
 
data/locales/en.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  en:
2
2
  builder:
3
+ catchall_failure: "Something failed during the build! Context:\n%{context}."
3
4
  file_conflict_error: "Cannot build HTML file because `%{path}` already exists."
4
5
  prebuild_failure: >
5
6
  Lifer failed to complete building... A prebuild step failed to execute: %{exception}
@@ -21,6 +22,7 @@ en:
21
22
  dump_default_config: Print the default configuration file to STDOUT and exit.
22
23
  port: Specify a custom port for the dev server.
23
24
  root: Specify the path to the Lifer project root.
25
+ pwd_is_gem_root: "Cannot build project at gem root: %{root}."
24
26
  subcommands:
25
27
  build: Build the Lifer project as configured in your Lifer configuration file.
26
28
  help: Display help text for the Lifer commandline interface.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lifer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - benjamin wil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-17 00:00:00.000000000 Z
11
+ date: 2026-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -229,8 +229,8 @@ licenses:
229
229
  - MIT
230
230
  metadata:
231
231
  allowed_push_host: https://rubygems.org
232
- homepage_uri: https://github.com/benjaminwil/lifer/blob/v0.14.0/README.md
233
- source_code_uri: https://github.com/benjaminwil/lifer/tree/v0.14.0
232
+ homepage_uri: https://github.com/benjaminwil/lifer/blob/v0.15.1/README.md
233
+ source_code_uri: https://github.com/benjaminwil/lifer/tree/v0.15.1
234
234
  changelog_uri: https://github.com/benjaminwil/lifer/blob/main/CHANGELOG.md
235
235
  post_install_message:
236
236
  rdoc_options: []