sghtmltopdf 0.6.1 → 0.7.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 +4 -4
- data/Cargo.lock +2 -2
- data/README.md +12 -3
- data/ext/sghtmltopdf/Cargo.toml +1 -1
- data/ext/sghtmltopdf/extconf.rb +5 -4
- data/lib/sghtmltopdf/options.rb +8 -0
- data/lib/sghtmltopdf/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ccb7358464b7e2b54de35755d1aaf2a278b59dddee9716101cdf3715eebf51cc
|
|
4
|
+
data.tar.gz: 4c653cda8ba36f061a2d2253f59b4877ee39e2f9f7157cc84e05ab4ec978ad1f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f861dc645c65f74dee61b47a000395e10da29746bb27941079bdb0e34a69828fd424b2033f67692679f3500f6386ee0c2c5ada72bb048fdae593a167f35051a
|
|
7
|
+
data.tar.gz: 616b41944d6a37a7110cf807dab0d2feaf3aeda1861d5c254276d6c59ace03e530c29c03a07b10cff4131ed6f04e4dcd2f284abb6cfcf1c6ff48d87a8f3c6170
|
data/Cargo.lock
CHANGED
|
@@ -1050,7 +1050,7 @@ dependencies = [
|
|
|
1050
1050
|
|
|
1051
1051
|
[[package]]
|
|
1052
1052
|
name = "sghtmltopdf"
|
|
1053
|
-
version = "0.
|
|
1053
|
+
version = "0.7.0"
|
|
1054
1054
|
dependencies = [
|
|
1055
1055
|
"base64",
|
|
1056
1056
|
"clap",
|
|
@@ -1077,7 +1077,7 @@ dependencies = [
|
|
|
1077
1077
|
|
|
1078
1078
|
[[package]]
|
|
1079
1079
|
name = "sghtmltopdf-ruby"
|
|
1080
|
-
version = "0.
|
|
1080
|
+
version = "0.7.0"
|
|
1081
1081
|
dependencies = [
|
|
1082
1082
|
"magnus",
|
|
1083
1083
|
"rb-sys",
|
data/README.md
CHANGED
|
@@ -13,13 +13,22 @@ The engine runs inside your process through a native extension (magnus + rb-sys)
|
|
|
13
13
|
gem "sghtmltopdf"
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
Precompiled native gems are published for `x86_64-linux`, `aarch64-linux`, `x86_64-linux-musl`, `aarch64-linux-musl`, `arm64-darwin`, and `
|
|
16
|
+
Precompiled native gems are published for `x86_64-linux`, `aarch64-linux`, `x86_64-linux-musl`, `aarch64-linux-musl`, `arm64-darwin`, `x86_64-darwin`, and Windows `x64-mingw-ucrt`.
|
|
17
17
|
There is no build step on those platforms.
|
|
18
18
|
|
|
19
|
-
Elsewhere
|
|
19
|
+
Elsewhere the source gem does not carry the Rust core and will refuse to build with an explanatory message.
|
|
20
20
|
Point those environments at a separate `sghtmltopdf server` process instead; see [Delegating to a server](#delegating-to-a-server).
|
|
21
21
|
|
|
22
|
-
Requires Ruby >= 3.2.
|
|
22
|
+
Requires Ruby >= 3.2. The precompiled gems bundle extensions for Ruby 3.2, 3.3,
|
|
23
|
+
3.4, and 4.0. On Windows, use 64-bit RubyInstaller UCRT (`x64-mingw-ucrt`).
|
|
24
|
+
|
|
25
|
+
For contributors building from a repository checkout on Windows, use RubyInstaller
|
|
26
|
+
with its Devkit, the Rust GNU toolchain (`stable-x86_64-pc-windows-gnu`), and LLVM
|
|
27
|
+
with `libclang.dll`. Set `RUSTUP_TOOLCHAIN=stable-x86_64-pc-windows-gnu`, set
|
|
28
|
+
`LIBCLANG_PATH` to the LLVM `bin` directory, add it to `PATH`, and set
|
|
29
|
+
`BINDGEN_EXTRA_CLANG_ARGS=--target=x86_64-w64-windows-gnu`.
|
|
30
|
+
Run the build through `ridk exec bundle exec rake compile`. The precompiled gem
|
|
31
|
+
does not need these tools.
|
|
23
32
|
|
|
24
33
|
## Usage
|
|
25
34
|
|
data/ext/sghtmltopdf/Cargo.toml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# The package name differs from the library name on purpose: the core crate is published as
|
|
3
3
|
# `sghtmltopdf`, and two packages with the same name cannot be written to one lockfile.
|
|
4
4
|
name = "sghtmltopdf-ruby"
|
|
5
|
-
version = "0.
|
|
5
|
+
version = "0.7.0"
|
|
6
6
|
edition = "2021"
|
|
7
7
|
publish = false
|
|
8
8
|
description = "Ruby binding for sghtmltopdf (see bindings/ruby)"
|
data/ext/sghtmltopdf/extconf.rb
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "mkmf"
|
|
4
|
-
require "rb_sys/mkmf"
|
|
5
|
-
|
|
6
3
|
core = File.expand_path("../../../../core", __dir__)
|
|
7
4
|
unless File.exist?(File.join(core, "Cargo.toml"))
|
|
8
5
|
abort <<~MESSAGE
|
|
@@ -13,9 +10,13 @@ unless File.exist?(File.join(core, "Cargo.toml"))
|
|
|
13
10
|
so a build from source was attempted, but the source gem does not include the
|
|
14
11
|
Rust core and cannot be built.
|
|
15
12
|
|
|
16
|
-
Supported platforms: x86_64-linux / aarch64-linux / x86_64-linux-musl / aarch64-linux-musl / arm64-darwin / x86_64-darwin
|
|
13
|
+
Supported platforms: x86_64-linux / aarch64-linux / x86_64-linux-musl / aarch64-linux-musl / arm64-darwin / x86_64-darwin / x64-mingw-ucrt
|
|
14
|
+
Supported Ruby ABIs: 3.2 / 3.3 / 3.4 / 4.0
|
|
17
15
|
MESSAGE
|
|
18
16
|
end
|
|
19
17
|
|
|
18
|
+
require "mkmf"
|
|
19
|
+
require "rb_sys/mkmf"
|
|
20
|
+
|
|
20
21
|
# Built as `lib/sghtmltopdf/sghtmltopdf.so`.
|
|
21
22
|
create_rust_makefile("sghtmltopdf/sghtmltopdf")
|
data/lib/sghtmltopdf/options.rb
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "date"
|
|
4
|
+
# `Time#iso8601` comes from here before Ruby 3.4 (Rails loads it, a plain Ruby script may not).
|
|
5
|
+
require "time"
|
|
3
6
|
require "uri"
|
|
4
7
|
|
|
5
8
|
module Sghtmltopdf
|
|
@@ -78,6 +81,11 @@ module Sghtmltopdf
|
|
|
78
81
|
when true then [[name, nil]]
|
|
79
82
|
# An array means the same option repeated. The same rule applies to each element.
|
|
80
83
|
when Array then value.flat_map { |element| pairs_for(key, element) }
|
|
84
|
+
# `creation_date:` takes a moment in time. The CLI wants it as ISO 8601, so it is
|
|
85
|
+
# converted to UTC here rather than left to `to_s`, which would drop the zone for a Time
|
|
86
|
+
# and the subsecond part of a DateTime.
|
|
87
|
+
when Time, DateTime then [[name, value.to_time.getutc.iso8601]]
|
|
88
|
+
when Date then [[name, value.iso8601]]
|
|
81
89
|
when Hash
|
|
82
90
|
# Nesting such as wicked_pdf's `margin: {top: 10}` is not accepted. There is no
|
|
83
91
|
# corresponding CLI flag, and flattening it mechanically would let even misspelled
|
data/lib/sghtmltopdf/version.rb
CHANGED