pagefind 1.5.2-x64-mingw-ucrt

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: b379b7e3fea66c1be618514b9b55ef3094cfe4efff15885b7875319ace1d28eb
4
+ data.tar.gz: 91ee33e8bcd0d2b2e3e558c5245d086ec2d16129eee4e8b9961a6b43912f89b6
5
+ SHA512:
6
+ metadata.gz: a3329a22461a1bbac500ca17270d6e2fbda1514247afab7113a295d788631b0f9b4faa5a28833864b0e2bc9c3f656ef63ad7001f2dc8ba3e4bb594ef591b46ea
7
+ data.tar.gz: f600c3f28647e57a81097dffeaa83f31c4bba058a7e5cd07f0f052bd8eefebde0af1c3358a3a289b248c8c6c94b5f186e18cb0341e9394068ac2a8e8414cb9a0
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # pagefind-ruby changelog
2
+
3
+ ## v1.5.2
4
+
5
+ * Initial release
@@ -0,0 +1,10 @@
1
+ # Code of Conduct
2
+
3
+ "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 ["bangseongbeom@gmail.com"](mailto:"bangseongbeom@gmail.com").
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,29 @@
1
+ # Contributing to pagefind-ruby
2
+
3
+ This doc is a brief introduction on modifying and maintaining this gem.
4
+
5
+ ## Updating to the latest upstream pagefind version
6
+
7
+ We have a Github Actions workflow that runs once a day to check for new upstream versions, and will
8
+ create a new pull request with the bump. You only need to review and merged it!
9
+
10
+ If you really need to do it manually, you can use the `bin/bump-upstream` script, however, we may
11
+ not be keeping that up to date, and you should double-check everything.
12
+
13
+ ## Cutting a release of pagefind-ruby
14
+
15
+ - Manual release
16
+ - [ ] update `lib/pagefind/version.rb`
17
+ - [ ] update `CHANGELOG.md`
18
+ - [ ] `git commit`
19
+ - [ ] `git tag`
20
+ - [ ] `bundle exec rake clobber` (if needed to clean up old pagefind executables)
21
+ - [ ] `bundle exec rake package`
22
+ - [ ] `for g in pkg/*.gem ; do gem push $g ; done`
23
+ - Automated release with Github Actions workflows
24
+ - [ ] merge the pull request generated by the [upstream workflow](https://github.com/bangseongbeom/pagefind-ruby/actions/workflows/upstream.yml)
25
+ - [ ] `git tag`
26
+ - [ ] `git push && git push --tags`
27
+ - [ ] run the [release workflow](https://github.com/bangseongbeom/pagefind-ruby/actions/workflows/release.yml), passing in the git tag as input
28
+ - Announce
29
+ - [ ] create a release at https://github.com/bangseongbeom/pagefind-ruby/releases (we could automated this, too)
@@ -0,0 +1,11 @@
1
+ pagefind-ruby may redistribute executables from the https://github.com/Pagefind/pagefind project
2
+
3
+ The license for that software can be found at https://github.com/Pagefind/pagefind/blob/main/LICENSE which is reproduced here for your convenience:
4
+
5
+ Copyright 2022 Pagefind
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020-2024 Mike Dalessio, David Heinemeier Hansson
4
+ Copyright (c) 2026 방성범 (Bang Seongbeom)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,149 @@
1
+ # Pagefind
2
+
3
+ A self-contained `pagefind` executable, wrapped up in a ruby gem. That's it. Nothing else.
4
+
5
+
6
+ ## Installation
7
+
8
+ This gem wraps [the precompiled binary](https://pagefind.app/docs/installation/#downloading-a-precompiled-binary) of Pagefind. These binaries are platform specific, so there are actually separate underlying gems per platform, but the correct gem will automatically be picked for your platform.
9
+
10
+ Supported platforms are:
11
+
12
+ - arm64-darwin (aarch64-apple-darwin)
13
+ - x86_64-darwin (x86_64-apple-darwin)
14
+ - x64-mingw-ucrt (x86_64-pc-windows-msvc)
15
+ - aarch64-mingw-ucrt (aarch64-pc-windows-msvc)
16
+ - x86_64-linux (x86_64-unknown-linux-musl)
17
+ - aarch64-linux (aarch64-unknown-linux-musl)
18
+ - amd64-freebsd (x86_64-unknown-freebsd)
19
+
20
+ Install the gem and add to the application's Gemfile by executing:
21
+
22
+ ```bash
23
+ bundle add pagefind
24
+ ```
25
+
26
+ If bundler is not being used to manage dependencies, install the gem by executing:
27
+
28
+ ```bash
29
+ gem install pagefind
30
+ ```
31
+
32
+ ### Using a local installation of `pagefind`
33
+
34
+ If you are not able to use the vendored precompiled binaries (for example, if you're on an unsupported platform), you can use a [local installation](https://pagefind.app/docs/installation/) of the `pagefind` binary by setting an environment variable named `PAGEFIND_INSTALL_DIR` to the directory path containing the binary.
35
+
36
+ For example, if you've [built Pagefind from source](https://pagefind.app/docs/installation/#building-from-source) with `cargo install pagefind` so that the binary is found at `$HOME/.cargo/bin/pagefind`, then you should set your environment variable like so:
37
+
38
+ ``` sh
39
+ PAGEFIND_INSTALL_DIR=$HOME/.cargo/bin
40
+ ```
41
+
42
+ or, if you've installed the [npm wrapper package](https://pagefind.app/docs/installation/#running-via-npx) so that the executable is found at a relative path like `./node_modules/.bin/pagefind`:
43
+
44
+ ``` sh
45
+ PAGEFIND_INSTALL_DIR=node_modules/.bin
46
+ ```
47
+
48
+
49
+ ## Versioning
50
+
51
+ This gem will always have the same version number as the underlying Pagefind release. For example, the gem with version v1.5.2 will package upstream Pagefind v1.5.2.
52
+
53
+ If there ever needs to be multiple releases for the same version of Pagefind, the version will contain an additional digit. For example, if we re-released Pagefind v1.5.2, it might be shipped in gem version v1.5.2.1 or v1.5.2.2.
54
+
55
+
56
+ ## Usage
57
+
58
+ ### Ruby
59
+
60
+ The gem makes available `Pagefind.executable` which is the path to the vendored standalone executable.
61
+
62
+ ``` ruby
63
+ require "pagefind"
64
+ Pagefind.executable
65
+ # => "/path/to/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/pagefind-1.5.2-x86_64-linux/exe/x86_64-linux/pagefind"
66
+ ```
67
+
68
+
69
+ ### Command line
70
+
71
+ This gem provides an executable `pagefind` shim that will run the vendored standalone executable.
72
+
73
+ ``` bash
74
+ # where is the shim?
75
+ $ bundle exec which pagefind
76
+ /path/to/installs/ruby/3.3/bin/pagefind
77
+
78
+ # run the actual executable through the shim
79
+ $ bundle exec pagefind --help
80
+ ["/path/to/installs/installs/ruby/3.4.2/lib/ruby/gems/3.4.0/gems/pagefind-1.5.2-x86_64-linux/exe/x86_64-linux/pagefind", "--help"]
81
+ Implement search on any static website.
82
+
83
+ Usage: pagefind [OPTIONS]
84
+
85
+ Options:
86
+ -s, --site <SITE>
87
+ The location of your built static website
88
+ --output-subdir <OUTPUT_SUBDIR>
89
+ Where to output the search bundle, relative to the processed site
90
+ --output-path <OUTPUT_PATH>
91
+ Where to output the search bundle, relative to the working directory of the command
92
+ ...
93
+ ```
94
+
95
+
96
+ ## Troubleshooting
97
+
98
+ ### `ERROR: Cannot find the pagefind executable` for supported platform
99
+
100
+ Some users are reporting this error even when running on one of the supported native platforms:
101
+
102
+ - arm64-darwin
103
+ - x86_64-darwin
104
+ - x64-mingw-ucrt
105
+ - aarch64-mingw-ucrt
106
+ - x86_64-linux
107
+ - aarch64-linux
108
+ - amd64-freebsd
109
+
110
+ #### Check Bundler PLATFORMS
111
+
112
+ A possible cause of this is that Bundler has not been told to include native gems for your current platform. Please check your `Gemfile.lock` file to see whether your native platform is included in the `PLATFORMS` section. If necessary, run:
113
+
114
+ ``` sh
115
+ bundle lock --add-platform <platform-name>
116
+ ```
117
+
118
+ and re-bundle.
119
+
120
+
121
+ #### Check BUNDLE_FORCE_RUBY_PLATFORM
122
+
123
+ Another common cause of this is that bundler is configured to always use the "ruby" platform via the
124
+ `BUNDLE_FORCE_RUBY_PLATFORM` config parameter being set to `true`. Please remove this configuration:
125
+
126
+ ``` sh
127
+ bundle config unset force_ruby_platform
128
+ # or
129
+ bundle config set --local force_ruby_platform false
130
+ ```
131
+
132
+ and re-bundle.
133
+
134
+ See https://bundler.io/man/bundle-config.1.html for more information.
135
+
136
+
137
+ ## Contributing
138
+
139
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bangseongbeom/pagefind-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/bangseongbeom/pagefind-ruby/blob/main/CODE_OF_CONDUCT.md).
140
+
141
+ ## License
142
+
143
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
144
+
145
+ Pagefind is [released under the MIT License](https://github.com/Pagefind/pagefind/blob/main/LICENSE).
146
+
147
+ ## Code of Conduct
148
+
149
+ Everyone interacting in the Pagefind project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/bangseongbeom/pagefind-ruby/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require "standard/rake"
9
+
10
+ task default: %i[test standard]
data/exe/pagefind ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ # because rubygems shims assume a gem's executables are Ruby
3
+
4
+ require "pagefind"
5
+
6
+ begin
7
+ command = [Pagefind.executable, *ARGV]
8
+ puts command.inspect
9
+ if Gem.win_platform?
10
+ # use system rather than exec as exec inexplicably fails to find the executable on Windows
11
+ # see related https://github.com/rubys/sprockets-esbuild/pull/4
12
+ system(*command, exception: true)
13
+ else
14
+ exec(*command)
15
+ end
16
+ rescue Pagefind::UnsupportedPlatformException, Pagefind::ExecutableNotFoundException => e
17
+ warn("ERROR: " + e.message)
18
+ exit 1
19
+ end
Binary file
@@ -0,0 +1,16 @@
1
+ module Pagefind
2
+ module Upstream
3
+ VERSION = "v1.5.2"
4
+
5
+ # rubygems platform name => upstream release target
6
+ NATIVE_PLATFORMS = {
7
+ "arm64-darwin" => "aarch64-apple-darwin",
8
+ "x86_64-darwin" => "x86_64-apple-darwin",
9
+ "x64-mingw-ucrt" => "x86_64-pc-windows-msvc",
10
+ "aarch64-mingw-ucrt" => "aarch64-pc-windows-msvc",
11
+ "x86_64-linux" => "x86_64-unknown-linux-musl",
12
+ "aarch64-linux" => "aarch64-unknown-linux-musl",
13
+ "amd64-freebsd" => "x86_64-unknown-freebsd"
14
+ }
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pagefind
4
+ VERSION = "1.5.2"
5
+ end
data/lib/pagefind.rb ADDED
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "pagefind/version"
4
+ require_relative "pagefind/upstream"
5
+
6
+ module Pagefind
7
+ DEFAULT_DIR = File.expand_path(File.join(__dir__, "..", "exe"))
8
+ GEM_NAME = "pagefind"
9
+
10
+ # raised when the host platform is not supported by upstream pagefind's binary releases
11
+ class UnsupportedPlatformException < StandardError
12
+ end
13
+
14
+ # raised when the pagefind executable could not be found where we expected it to be
15
+ class ExecutableNotFoundException < StandardError
16
+ end
17
+
18
+ # raised when PAGEFIND_INSTALL_DIR does not exist
19
+ class DirectoryNotFoundException < StandardError
20
+ end
21
+
22
+ class << self
23
+ def platform
24
+ [:cpu, :os].map { |m| Gem::Platform.local.send(m) }.join("-")
25
+ end
26
+
27
+ def executable(exe_path: DEFAULT_DIR)
28
+ pagefind_install_dir = ENV["PAGEFIND_INSTALL_DIR"]
29
+ if pagefind_install_dir
30
+ if File.directory?(pagefind_install_dir)
31
+ warn "NOTE: using PAGEFIND_INSTALL_DIR to find pagefind executable: #{pagefind_install_dir}"
32
+ exe_path = pagefind_install_dir
33
+ exe_file = (Gem.win_platform? ? %w[pagefind.exe pagefind.cmd pagefind] : %w[pagefind])
34
+ .map { |file_name| File.expand_path(File.join(pagefind_install_dir, file_name)) }
35
+ .find { |file_name| File.exist?(file_name) }
36
+ else
37
+ raise DirectoryNotFoundException, <<~MESSAGE
38
+ PAGEFIND_INSTALL_DIR is set to #{pagefind_install_dir}, but that directory does not exist.
39
+ MESSAGE
40
+ end
41
+ else
42
+ if Pagefind::Upstream::NATIVE_PLATFORMS.keys.none? { |p| Gem::Platform.match_gem?(Gem::Platform.new(p), GEM_NAME) }
43
+ raise UnsupportedPlatformException, <<~MESSAGE
44
+ #{GEM_NAME} does not support the #{platform} platform
45
+ See https://github.com/bangseongbeom/pagefind-ruby#using-a-local-installation-of-pagefind
46
+ for more details.
47
+ MESSAGE
48
+ end
49
+
50
+ exe_file = Dir.glob(File.expand_path(File.join(exe_path, "*", "pagefind"))).find do |f|
51
+ Gem::Platform.match_gem?(Gem::Platform.new(File.basename(File.dirname(f))), GEM_NAME)
52
+ end
53
+ end
54
+
55
+ if exe_file.nil? || !File.exist?(exe_file)
56
+ raise ExecutableNotFoundException, <<~MESSAGE
57
+ Cannot find the pagefind executable for #{platform} in #{exe_path}
58
+
59
+ If you're using bundler, please make sure you're on the latest bundler version:
60
+
61
+ gem install bundler
62
+ bundle update --bundler
63
+
64
+ Then make sure your lock file includes this platform by running:
65
+
66
+ bundle lock --add-platform #{platform}
67
+ bundle install
68
+
69
+ See `bundle lock --help` output for details.
70
+
71
+ If you're still seeing this message after taking those steps, try running
72
+ `bundle config` and ensure `force_ruby_platform` isn't set to `true`. See
73
+ https://github.com/bangseongbeom/pagefind-ruby#check-bundle_force_ruby_platform
74
+ for more details.
75
+ MESSAGE
76
+ end
77
+
78
+ exe_file
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,160 @@
1
+ #
2
+ # Rake tasks to manage native gem packages with binary executables from Pagefind/pagefind
3
+ #
4
+ # TL;DR: run "rake package"
5
+ #
6
+ # The native platform gems (defined by Pagefind::Upstream::NATIVE_PLATFORMS) will each contain
7
+ # the pagefind binary executable in addition to what the vanilla ruby gem contains:
8
+ #
9
+ # exe/
10
+ # ├── pagefind # generic ruby script to find and run the binary
11
+ # └── <Gem::Platform architecture name>/
12
+ # └── pagefind # the pagefind binary executable
13
+ #
14
+ # The ruby script `exe/pagefind` is installed into the user's path, and it simply locates the
15
+ # binary and executes it. Note that this script is required because rubygems requires that
16
+ # executables declared in a gemspec must be Ruby scripts.
17
+ #
18
+ # As a concrete example, an x86_64-linux system will see these files on disk after installing
19
+ # pagefind-1.x.x-x86_64-linux.gem:
20
+ #
21
+ # exe/
22
+ # ├── pagefind
23
+ # └── x86_64-linux/
24
+ # └── pagefind
25
+ #
26
+ # So the full set of gem files created will be:
27
+ #
28
+ # - pkg/pagefind-1.0.0.gem
29
+ # - pkg/pagefind-1.0.0-aarch64-linux.gem
30
+ # - pkg/pagefind-1.0.0-aarch64-mingw-ucrt.gem
31
+ # - pkg/pagefind-1.0.0-amd64-freebsd.gem
32
+ # - pkg/pagefind-1.0.0-arm64-darwin.gem
33
+ # - pkg/pagefind-1.0.0-x64-mingw-ucrt.gem
34
+ # - pkg/pagefind-1.0.0-x86_64-darwin.gem
35
+ # - pkg/pagefind-1.0.0-x86_64-linux.gem
36
+ #
37
+ # Note that in addition to the native gems, a vanilla "ruby" gem will also be created with the
38
+ # `exe/pagefind` script but without a binary executable present.
39
+ #
40
+ #
41
+ # New rake tasks created:
42
+ #
43
+ # - rake gem:ruby # Build the ruby gem
44
+ # - rake gem:aarch64-linux # Build the aarch64-linux gem
45
+ # - rake gem:aarch64-mingw-ucrt # Build the aarch64-mingw-ucrt gem
46
+ # - rake gem:amd64-freebsd # Build the amd64-freebsd gem
47
+ # - rake gem:arm64-darwin # Build the arm64-darwin gem
48
+ # - rake gem:x64-mingw-ucrt # Build the x64-mingw-ucrt gem
49
+ # - rake gem:x86_64-darwin # Build the x86_64-darwin gem
50
+ # - rake gem:x86_64-linux # Build the x86_64-linux gem
51
+ # - rake download # Download all pagefind binaries
52
+ #
53
+ # Modified rake tasks:
54
+ #
55
+ # - rake gem # Build all the gem files
56
+ # - rake package # Build all the gem files (same as `gem`)
57
+ # - rake repackage # Force a rebuild of all the gem files
58
+ #
59
+ # Note also that the binary executables will be lazily downloaded when needed, but you can
60
+ # explicitly download them with the `rake download` command.
61
+ #
62
+ require "rubygems/package_task"
63
+ require "rubygems/package"
64
+ require "open-uri"
65
+ require "digest"
66
+ require "zlib"
67
+ require_relative "../lib/pagefind/upstream"
68
+
69
+ PAGEFIND_ARCHIVE_DIR = "tmp"
70
+
71
+ def pagefind_archive_filename(target)
72
+ "pagefind-#{Pagefind::Upstream::VERSION}-#{target}.tar.gz"
73
+ end
74
+
75
+ def pagefind_download_url(filename)
76
+ "https://github.com/Pagefind/pagefind/releases/download/#{Pagefind::Upstream::VERSION}/#{filename}"
77
+ end
78
+
79
+ PAGEFIND_RUBY_GEMSPEC = Bundler.load_gemspec("pagefind.gemspec")
80
+
81
+ # prepend the download task before the Gem::PackageTask tasks
82
+ task package: :download
83
+
84
+ gem_path = Gem::PackageTask.new(PAGEFIND_RUBY_GEMSPEC).define
85
+ desc "Build the ruby gem"
86
+ task "gem:ruby" => [gem_path]
87
+
88
+ directory PAGEFIND_ARCHIVE_DIR
89
+ archivepaths = Pagefind::Upstream::NATIVE_PLATFORMS.values.map do |target|
90
+ archivepath = File.join(PAGEFIND_ARCHIVE_DIR, pagefind_archive_filename(target))
91
+
92
+ file archivepath => [PAGEFIND_ARCHIVE_DIR] do
93
+ release_url = pagefind_download_url(File.basename(archivepath))
94
+ warn "Downloading #{archivepath} from #{release_url} ..."
95
+
96
+ # lazy, but fine for now.
97
+ URI.open(release_url) do |remote| # standard:disable Security/Open
98
+ File.binwrite(archivepath, remote.read)
99
+ end
100
+ end
101
+
102
+ archivepath
103
+ end
104
+
105
+ exepaths = []
106
+ Pagefind::Upstream::NATIVE_PLATFORMS.each do |platform, target|
107
+ PAGEFIND_RUBY_GEMSPEC.dup.tap do |gemspec|
108
+ exedir = File.join(gemspec.bindir, platform) # "exe/x86_64-linux"
109
+ exepath = File.join(exedir, "pagefind") # "exe/x86_64-linux/pagefind"
110
+ archivepath = File.join(PAGEFIND_ARCHIVE_DIR, pagefind_archive_filename(target)) # "tmp/pagefind-v1.5.2-x86_64-unknown-linux-musl.tar.gz"
111
+ exepaths << exepath
112
+
113
+ # modify a copy of the gemspec to include the native executable
114
+ gemspec.platform = platform
115
+ gemspec.files += [exepath, "LICENSE-DEPENDENCIES"]
116
+
117
+ # create a package task
118
+ gem_path = Gem::PackageTask.new(gemspec).define
119
+ desc "Build the #{platform} gem"
120
+ task "gem:#{platform}" => [gem_path]
121
+
122
+ directory exedir
123
+ file exepath => [exedir, archivepath] do
124
+ warn "Extracting #{exepath} from #{archivepath} ..."
125
+
126
+ Zlib::GzipReader.open(archivepath) do |gz|
127
+ Gem::Package::TarReader.new(gz) do |tar|
128
+ entry = tar.find { |entry| %w[pagefind pagefind.exe].include?(entry.full_name) }
129
+ abort "Cannot find the pagefind executable in #{archivepath}" unless entry
130
+
131
+ File.binwrite(exepath, entry.read)
132
+ end
133
+ end
134
+
135
+ FileUtils.chmod(0o755, exepath, verbose: true)
136
+ end
137
+ end
138
+ end
139
+
140
+ desc "Validate checksums for pagefind archives"
141
+ task "check" => archivepaths do
142
+ archivepaths.each do |archivepath|
143
+ sha_url = pagefind_download_url("#{File.basename(archivepath)}.sha256")
144
+
145
+ local_sha256 = Digest::SHA256.file(archivepath).hexdigest
146
+ remote_sha256 = URI.open(sha_url).read.split.first # standard:disable Security/Open
147
+
148
+ if local_sha256 == remote_sha256
149
+ puts "Checksum OK for #{archivepath} (#{local_sha256})"
150
+ else
151
+ abort "Checksum mismatch for #{archivepath} (#{local_sha256} != #{remote_sha256})"
152
+ end
153
+ end
154
+ end
155
+
156
+ desc "Download all pagefind binaries"
157
+ task "download" => [:check, *exepaths]
158
+
159
+ CLOBBER.add(exepaths.map { |p| File.dirname(p) })
160
+ CLOBBER.add(archivepaths)
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pagefind
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.5.2
5
+ platform: x64-mingw-ucrt
6
+ authors:
7
+ - 방성범 (Bang Seongbeom)
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: A self-contained `pagefind` executable, wrapped up in a ruby gem. That's
13
+ it. Nothing else.
14
+ email:
15
+ - bangseongbeom@gmail.com
16
+ executables:
17
+ - pagefind
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - CHANGELOG.md
22
+ - CODE_OF_CONDUCT.md
23
+ - CONTRIBUTING.md
24
+ - LICENSE-DEPENDENCIES
25
+ - LICENSE.txt
26
+ - README.md
27
+ - Rakefile
28
+ - exe/pagefind
29
+ - exe/x64-mingw-ucrt/pagefind
30
+ - lib/pagefind.rb
31
+ - lib/pagefind/upstream.rb
32
+ - lib/pagefind/version.rb
33
+ - rakelib/package.rake
34
+ homepage: https://github.com/bangseongbeom/pagefind-ruby
35
+ licenses:
36
+ - MIT
37
+ metadata:
38
+ allowed_push_host: https://rubygems.org
39
+ homepage_uri: https://github.com/bangseongbeom/pagefind-ruby
40
+ source_code_uri: https://github.com/bangseongbeom/pagefind-ruby
41
+ changelog_uri: https://github.com/bangseongbeom/pagefind-ruby/blob/main/CHANGELOG.md
42
+ rubygems_mfa_required: 'true'
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 3.2.0
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubygems_version: 4.0.16
58
+ specification_version: 4
59
+ summary: A self-contained `pagefind` executable.
60
+ test_files: []