jekyll-pagefind 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1b9126064b930d58f4f4d2c7f3a3426431a7e8a28a173b566e4ed05a45affbc5
4
+ data.tar.gz: acad73057c0e4cc468b210617ad9580b357b16d8129fa6cf44e8ee48c7be2df5
5
+ SHA512:
6
+ metadata.gz: f47f5071b76af118f567bec3dd3d01d58522a4a4220cc8fb4b815b2a5a18db8e3344149113ecd7b391dd5984290b422e324fb35f1434fed7468450234fedfaf2
7
+ data.tar.gz: b2e796c3a0ecf01f9e707805be75bda4ef29847b8bb0b610261e390f288376d116e88c64916d0fe1701839460b6ac806a7798e2cb31313faf3f44da1fc9f39d1
@@ -0,0 +1,3 @@
1
+ {
2
+ "cSpell.words": ["autorun"]
3
+ }
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2026-05-14
4
+
5
+ - Initial release
@@ -0,0 +1,10 @@
1
+ # Code of Conduct
2
+
3
+ "jekyll-pagefind" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
4
+
5
+ * Participants will be tolerant of opposing views.
6
+ * Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
7
+ * When interpreting the words and actions of others, participants should always assume good intentions.
8
+ * Behaviour which can be reasonably considered harassment will not be tolerated.
9
+
10
+ If you have any concerns about behaviour within this project, please contact us at ["phothinmg@disroot.org"](mailto:"phothinmg@disroot.org").
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 phothinmg
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # jekyll-pagefind
2
+
3
+ `jekyll-pagefind` is a Jekyll plugin that runs the Pagefind CLI after your site is written. It lets you keep search indexing as part of the normal Jekyll build instead of running a separate manual step.
4
+
5
+ ## Installation
6
+
7
+ Add the gem to your site's Gemfile:
8
+
9
+ ```ruby
10
+ gem "jekyll-pagefind"
11
+ ```
12
+
13
+ Then install dependencies:
14
+
15
+ ```bash
16
+ bundle install
17
+ ```
18
+
19
+ Enable the plugin in your Jekyll configuration:
20
+
21
+ ```yml
22
+ plugins:
23
+ - jekyll-pagefind
24
+ ```
25
+
26
+ This plugin shells out to the Pagefind CLI, so make sure `pagefind` is installed and available on your system. For example:
27
+
28
+ ```bash
29
+ npm install -g pagefind
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ With the plugin enabled, a normal Jekyll build will run Pagefind after the site output has been written:
35
+
36
+ ```bash
37
+ bundle exec jekyll build
38
+ ```
39
+
40
+ By default the plugin executes:
41
+
42
+ ```bash
43
+ ./pagefind --site _site
44
+ ```
45
+
46
+ You can override the Pagefind executable location in `_config.yml`:
47
+
48
+ ```yml
49
+ pagefind:
50
+ pf_location: /path/to/pagefind
51
+ ```
52
+
53
+ That value is used to build the command:
54
+
55
+ ```bash
56
+ /path/to/pagefind --site _site
57
+ ```
58
+
59
+ ## Development
60
+
61
+ After checking out the repository, run:
62
+
63
+ ```bash
64
+ bin/setup
65
+ ```
66
+
67
+ To build the gem locally:
68
+
69
+ ```bash
70
+ gem build jekyll-pagefind.gemspec
71
+ ```
72
+
73
+ To install it into your local Ruby environment:
74
+
75
+ ```bash
76
+ bundle exec rake install
77
+ ```
78
+
79
+ ## Contributing
80
+
81
+ Bug reports and pull requests are welcome at https://github.com/phothinmg/jekyll-pagefind.
82
+
83
+ ## License
84
+
85
+ This project is available under the terms of the [MIT License](https://opensource.org/licenses/MIT).
86
+
87
+ ## Code of Conduct
88
+
89
+ Please review [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) before contributing.
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+ require "rubocop/rake_task"
6
+
7
+ Rake::TestTask.new(:test) do |test|
8
+ test.libs << "lib"
9
+ test.libs << "test"
10
+ test.pattern = "test/**/*_test.rb"
11
+ end
12
+
13
+ RuboCop::RakeTask.new
14
+
15
+ task default: %i[test rubocop]
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Pagefind
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+ require_relative "pagefind/version"
5
+
6
+ module Jekyll
7
+ module Pagefind
8
+ class Error < StandardError; end
9
+
10
+ # Jekyll::Pagefind::PagefindGenerator
11
+ class PagefindGenerator < Jekyll::Generator
12
+ safe true
13
+ priority :lowest
14
+
15
+ def generate(site)
16
+ pf = site.config["pagefind"] || {}
17
+ pf_file = pf["pf_location"] || "./pagefind"
18
+ dest_dir = site.dest
19
+ Jekyll::Hooks.register :site, :post_write do |_site|
20
+ command = "#{pf_file} --site #{dest_dir}"
21
+ puts "Running: #{command}"
22
+ system(command)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,6 @@
1
+ module Jekyll
2
+ module Pagefind
3
+ VERSION: String
4
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+ end
6
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "minitest/autorun"
4
+ require "jekyll"
5
+ require_relative "../lib/jekyll/pagefind"
6
+
7
+ module SystemCapture
8
+ class << self
9
+ attr_reader :commands
10
+
11
+ def reset!
12
+ @commands = []
13
+ end
14
+ end
15
+
16
+ def system(command) # rubocop:disable Naming/PredicateMethod
17
+ SystemCapture.commands << command
18
+ true
19
+ end
20
+ end
21
+
22
+ Kernel.prepend(SystemCapture) unless Kernel.ancestors.include?(SystemCapture)
23
+
24
+ class PagefindGeneratorTest < Minitest::Test
25
+ SiteStub = Struct.new(:config, :dest)
26
+
27
+ def setup
28
+ SystemCapture.reset!
29
+ @registry = Jekyll::Hooks.instance_variable_get(:@registry)
30
+ @hook_priority = Jekyll::Hooks.instance_variable_get(:@hook_priority)
31
+ @original_post_write_hooks = @registry[:site][:post_write].dup
32
+ @original_hook_priority = @hook_priority.dup
33
+ end
34
+
35
+ def teardown
36
+ @registry[:site][:post_write] = @original_post_write_hooks
37
+ Jekyll::Hooks.instance_variable_set(:@hook_priority, @original_hook_priority)
38
+ end
39
+
40
+ def test_runs_pagefind_with_configured_executable_after_site_write
41
+ site = SiteStub.new({ "pagefind" => { "pf_location" => "/tmp/pagefind" } }, "_site")
42
+
43
+ Jekyll::Pagefind::PagefindGenerator.new.generate(site)
44
+ Jekyll::Hooks.trigger(:site, :post_write, site)
45
+
46
+ assert_equal ["/tmp/pagefind --site _site"], SystemCapture.commands
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-pagefind
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - phothinmg
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: jekyll
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '4.4'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '5.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '4.4'
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '5.0'
32
+ description: A Jekyll plugin that runs the Pagefind CLI after the site is written
33
+ so search indexes are generated alongside the built site.
34
+ email:
35
+ - phothinmg@disroot.org
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - ".vscode/settings.json"
41
+ - CHANGELOG.md
42
+ - CODE_OF_CONDUCT.md
43
+ - LICENSE.txt
44
+ - README.md
45
+ - Rakefile
46
+ - lib/jekyll/pagefind.rb
47
+ - lib/jekyll/pagefind/version.rb
48
+ - sig/jekyll/pagefind.rbs
49
+ - test/pagefind_generator_test.rb
50
+ homepage: https://github.com/phothinmg/jekyll-pagefind
51
+ licenses:
52
+ - MIT
53
+ metadata:
54
+ homepage_uri: https://github.com/phothinmg/jekyll-pagefind
55
+ source_code_uri: https://github.com/phothinmg/jekyll-pagefind/tree/main
56
+ changelog_uri: https://github.com/phothinmg/jekyll-pagefind/blob/main/CHANGELOG.md
57
+ rubygems_mfa_required: 'true'
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 3.2.0
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 4.0.11
73
+ specification_version: 4
74
+ summary: Integrates Pagefind indexing into Jekyll builds.
75
+ test_files: []