forme-ruby 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: 863572f23813b5d5090e945bbfcd36d225584aa728aaed8ff1c3e7ca73e4cdd6
4
+ data.tar.gz: b152a91177bffc61c05cdacabc76fb85262ed70947ba831da4109baf3d435724
5
+ SHA512:
6
+ metadata.gz: 7e785dc05aa0846e664610eba4a013c9006731ea5b5e4295bd0b517527e70fdde7df931a6778c31b2097395630b152a98ffe8dfc85c129cb7a25dd9e3c8c7ea2
7
+ data.tar.gz: 8361e47d81f21658f310384205290cb6590ab1c0b663ce6543c324f16270dfdee1d1002d2bdb11ccd685757bd0b4fa7e845fb1dee2bffcf585607019016d90fc
data/CHANGELOG.md ADDED
@@ -0,0 +1,35 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (unreleased)
4
+
5
+ ### Added
6
+
7
+ - Native HTML-to-PDF rendering with binary output and preserved warnings/pass counts.
8
+ - CSS and local TTF options, typed load/render errors and explicit startup verification.
9
+ - Independent native result ownership, cleanup and concurrent rendering.
10
+ - Optional Rails template adapter with caller-owned permissions and responses.
11
+ - Source and native packaging for macOS ARM64 and Linux AMD64 glibc.
12
+ - Ruby CI across 3.2, 3.3, 3.4 and 4.0; clean source/native package installs
13
+ on Ruby 3.3 and distribution qualification jobs.
14
+ - Public installation, rendering, Rails, development, security and release guides.
15
+
16
+ ### Hardened
17
+
18
+ - Preserve result ownership during Ruby thread cancellation and metadata failures.
19
+ - Replace rebuilt libraries atomically and retain runtime-user read permissions.
20
+ - Reject empty package verification runs and missing third-party license text.
21
+
22
+ ### Native baseline
23
+
24
+ - Forme HTML 0.24.0 at `f408920e632c59da0651b5b6d32f8c1397477673`.
25
+ - Build toolchain: Rust 1.94.0; target minimums macOS 15 and glibc 2.28.
26
+ - RubyGems publication and qualification of the final release commit are pending.
27
+
28
+ ### Release preparation
29
+
30
+ - Prepare macOS ARM native packages and a glibc 2.28 Linux AMD64 build, with
31
+ qualification jobs for UBI 8/9/10, Ubuntu 24.04/26.04 and Arch Linux.
32
+ - Add pinned GitHub Actions, dependency/security checks, contribution templates
33
+ and validated trusted publishing with release attestations.
34
+ - Document narrowly scoped native dependency audit exceptions and repository setup.
35
+ - Deduplicate and sort license files so notices match across macOS and Linux.
@@ -0,0 +1,18 @@
1
+ # Community Code of Conduct
2
+
3
+ Forme Ruby welcomes contributors of every background and experience level.
4
+ Treat people with respect, give specific and constructive feedback, and make
5
+ room for different perspectives. Discuss the code and ideas without attacking
6
+ the person. Respect privacy and use synthetic data in public examples.
7
+
8
+ Harassment, discriminatory language, threats, unwanted sexual attention,
9
+ publishing private information, and sustained disruption are unacceptable.
10
+ These expectations apply in repository discussions, issues, pull requests and
11
+ other spaces where someone represents the project.
12
+
13
+ Report concerns privately to ajaya@clearstack.io. Include relevant links and
14
+ context without sharing more personal information than necessary. Maintainers
15
+ will review reports discreetly, consider the affected people's needs, and may
16
+ request changes, remove content, restrict participation or ban participants.
17
+ Maintainers are expected to follow these standards too. Reporters may request
18
+ reconsideration by replying with additional context.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,67 @@
1
+ # Contributing to Forme Ruby
2
+
3
+ This guide covers local builds, verification and the boundary of the public gem.
4
+ Use synthetic documents and assets that can be redistributed.
5
+
6
+ ## Set up a checkout
7
+
8
+ Use CRuby 3.2+ and Rust/Cargo 1.94.0, a native linker and make. From the repository:
9
+
10
+ ```bash
11
+ bundle install
12
+ bundle exec rake compile
13
+ bundle exec rspec
14
+ cargo test --locked --manifest-path ext/forme_pdf/Cargo.toml
15
+ bundle exec standardrb
16
+ bundle exec bundler-audit check --update
17
+ cargo install cargo-audit --version 0.22.2 --locked
18
+ cargo audit --file ext/forme_pdf/Cargo.lock
19
+ ```
20
+
21
+ `compile` retains Cargo build output for subsequent development. Source-gem
22
+ installation removes its temporary target directory. Build the extension before
23
+ running Ruby examples; the loader never compiles during `require`.
24
+
25
+ ## Understand the code
26
+
27
+ - `lib/forme_pdf.rb` is the public facade; `lib/forme_pdf/` contains loading,
28
+ rendering, immutable results, errors and the explicit Rails adapter.
29
+ - `ext/forme_pdf/` owns the Rust C ABI and locked upstream dependencies.
30
+ - `spec/` tests Ruby behavior and ownership; Rust tests cover the native boundary.
31
+ - `script/` and `.github/workflows/` own notices, installed-package checks and releases.
32
+
33
+ Keep consumer templates, logos, data access and infrastructure conventions out
34
+ of the gem. Preserve per-render ownership, explicit lengths and cleanup in
35
+ `ensure`. Do not introduce global result buffers or runtime downloads.
36
+
37
+ ## Test packaging
38
+
39
+ ```bash
40
+ ruby script/notices.rb
41
+ bundle exec rake 'package[source]'
42
+ bundle exec rake 'package[native]'
43
+ ruby script/test_packages.rb
44
+ ```
45
+
46
+ The installed-package script installs every package in `pkg/` into temporary
47
+ GEM_HOME directories, then renders outside the checkout. Keep only packages for
48
+ the local platform and source in that directory. Pass package filenames as arguments to test only those artifacts.
49
+ It fails if no packages exist.
50
+ CI performs clean source/native installation on the supported platforms.
51
+
52
+ Regenerate and review notices after dependency changes. Notice generation fails
53
+ when a dependency has no license text; documented version-specific fallbacks live
54
+ under `script/licenses/`. Retain fixture font licenses as well.
55
+
56
+ ## Submit a change
57
+
58
+ Explain the user-visible behavior, rationale and checks run. Add meaningful
59
+ regression coverage for behavior changes. Use StandardRB and update guides and
60
+ CHANGELOG when the public API, installation or support matrix changes.
61
+ See [release preparation](docs/releasing.md) before packaging a version.
62
+
63
+ Validate workflow changes with `actionlint`. Linux package reproduction uses
64
+ `script/ci/build-linux.sh` inside the pinned UBI 8 image in `ci.yml`; do not run
65
+ that container setup script directly on your workstation. Review
66
+ [security exceptions](docs/security-exceptions.md) whenever dependencies or the
67
+ native API change.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ajaya Agrawalla
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/NOTICE ADDED
@@ -0,0 +1,5 @@
1
+ forme-ruby is an independent binding, not an official Forme project.
2
+ Forme: https://github.com/danmolitor/forme
3
+ Pinned revision: f408920e632c59da0651b5b6d32f8c1397477673
4
+ Forme is MIT licensed. Native distributions must include upstream and dependency
5
+ license notices generated during their build (see third-party notices).
data/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # forme-ruby
2
+
3
+ [![CI](https://github.com/clearstackio/forme-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/clearstackio/forme-ruby/actions/workflows/ci.yml)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
+
6
+ Render HTML and print CSS to PDF inside Ruby, using the Rust
7
+ [Forme](https://github.com/danmolitor/forme) engine. No browser, Node.js,
8
+ WebAssembly or separate rendering service is needed.
9
+
10
+ This is an independent MIT-licensed binding maintained by
11
+ [ClearStack](https://github.com/clearstackio), not an official upstream project.
12
+ **0.1.0 is in preparation; RubyGems publication is pending.**
13
+
14
+ ## Getting started
15
+
16
+ Until the first RubyGems release, use the Git repository and commit the resolved
17
+ lockfile. Git installation compiles the native extension and requires Rust/Cargo
18
+ 1.94.0, a linker and make:
19
+
20
+ ```ruby
21
+ gem "forme-ruby", github: "clearstackio/forme-ruby", branch: "main", require: "forme_pdf"
22
+ ```
23
+
24
+ ```ruby
25
+ require "forme_pdf"
26
+
27
+ pdf = FormePDF.render_html("<h1>Hello from Ruby</h1>")
28
+ File.binwrite("hello.pdf", pdf)
29
+ ```
30
+
31
+ Ruby 3.2 or later is required. Planned native packages target Apple Silicon macOS
32
+ 15+ and Linux AMD64 glibc 2.28+ and need no compiler. Source installs require
33
+ network access to locked upstream dependencies. See [installation](docs/installation.md).
34
+
35
+ ## Native platform targets
36
+
37
+ | Native gem | Qualification environments |
38
+ | --- | --- |
39
+ | `arm64-darwin` | Apple Silicon macOS 15 and 26 |
40
+ | `x86_64-linux-gnu` | Red Hat UBI 8, 9 and 10; Ubuntu 24.04 and 26.04; Arch Linux rolling |
41
+
42
+ These are the release CI targets; qualification of this prepared commit is
43
+ pending. Red Hat testing uses official UBI images, not RHEL certification.
44
+ Linux ARM64, Windows and Alpine/musl binaries are not provided. See the
45
+ [installation guide](docs/installation.md) for Ruby and source-build requirements.
46
+
47
+ ## Using Rails
48
+
49
+ Authorize and select application data first, then render explicitly:
50
+
51
+ ```ruby
52
+ html = render_to_string(template: "invoices/pdf", layout: "pdf", formats: [:html])
53
+ send_data FormePDF.render_html(html),
54
+ type: "application/pdf", disposition: "inline", filename: "invoice.pdf"
55
+ ```
56
+
57
+ Rails is optional. The [Rails guide](docs/rails.md) also covers the opt-in
58
+ `FormePDF::Rails` adapter. The gem installs no middleware or routes.
59
+
60
+ ## Learn more
61
+
62
+ - [Rendering guide](docs/rendering.md): CSS, fonts, diagnostics and error handling.
63
+ - [Development](CONTRIBUTING.md): build, test and contribute.
64
+ - [Community guidelines](CODE_OF_CONDUCT.md): participating respectfully.
65
+ - [Release guide](docs/releasing.md): package qualification and future publication.
66
+ - [Changelog](CHANGELOG.md), [license](LICENSE) and [third-party notices](THIRD_PARTY_LICENSES.txt).
67
+
68
+ Use trusted HTML and assets. The engine can read local image paths and is not a
69
+ sandbox for untrusted documents. See [security](SECURITY.md). Report reproducible
70
+ bugs through [GitHub issues](https://github.com/clearstackio/forme-ruby/issues)
71
+ with synthetic input, Ruby/platform versions and renderer diagnostics.
data/SECURITY.md ADDED
@@ -0,0 +1,17 @@
1
+ # Security
2
+
3
+ Render trusted HTML and caller-selected assets only. Forme can read local image
4
+ paths and consumes CPU/memory in the host process. It is not an HTML sandbox;
5
+ thread cancellation is not a reliable rendering timeout.
6
+
7
+ Keep confidential documents out of logs and public issue attachments. Use a
8
+ minimal synthetic reproduction when reporting a problem. Send potential
9
+ security vulnerabilities privately to ajaya@clearstack.io rather than posting
10
+ sensitive details publicly. No response-time guarantee is offered.
11
+
12
+ The initial 0.1.0 release is still in preparation. Before deployment, qualify the
13
+ exact package and pinned native dependencies on your application's target.
14
+
15
+ Dependency audit exceptions and their call-path evidence are recorded in
16
+ [the security review](docs/security-exceptions.md). They must be re-reviewed
17
+ when the pinned engine or public native interface changes.