Skip to content

Latest commit

 

History

History

README.md

structuredmerge Logo by Aboling0, CC BY-SA 4.0

💎 Ast::Template

Version GitHub tag (latest SemVer) License: AGPL-3.0-only OR PolyForm-Small-Business-1.0.0 Downloads Rank CI Current

if ci_badges.map(&:color).detect { it != "green"} ☝️ let me know, as I may have missed the discord notification.


if ci_badges.map(&:color).all? { it == "green"} 👇️ send money so I can do more of this. FLOSS maintenance is now my full-time job.

Sponsor Me on Github Liberapay Goal Progress Donate on PayPal Buy me a coffee Donate at ko-fi.com

👣 How will this project approach the September 2025 hostile takeover of RubyGems? 🚑️

I've summarized my thoughts in this blog post.

🌻 Synopsis Galtzo FLOSS Logo by Aboling0, CC BY-SA 4.0 ruby-lang Logo, Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5

ast-template applies StructuredMerge templates to package directories. It plans template entries, runs package-directory sessions, preserves destination-owned README sections, and reports convergence without requiring callers to wire the lower-level merge primitives by hand.

Key Features

  • Template tree planning and application.
  • Package-directory session requests and reports.
  • README section replacement through structured Markdown owners.
  • Adapter-family registry checks for template applicability.
  • Dry-run and apply workflows for repeatable template updates.

💡 Info you can shake a stick at

Tokens to Remember Gem name Gem namespace
Works with MRI Ruby 4 Ruby current Compat
Support & Community Join Me on Daily.dev's RubyFriends Live Chat on Discord Get help from me on Upwork Get help from me on Codementor
Source Source on GitLab.com Source on CodeBerg.org Source on Github.com The best SHA: dQw4w9WgXcQ!
Documentation Current release on RubyDoc.info YARD on Galtzo.com Maintainer Blog GitLab Wiki GitHub Wiki
Compliance License: AGPL-3.0-only OR PolyForm-Small-Business-1.0.0 Apache license compatibility: Category X 📄ilo-declaration-img Security Policy Contributor Covenant 2.1 SemVer 2.0.0
Style Enforced Code Style Linter Keep-A-Changelog 1.0.0 Gitmoji Commits Compatibility appraised by: appraisal2
Maintainer 🎖️ Follow Me on LinkedIn Follow Me on Ruby.Social Follow Me on Bluesky Contact Maintainer My technical writing
... 💖 Find Me on WellFound: Find Me on CrunchBase My LinkTree More About Me 🧊 🐙 🛖 🧪

Compatibility

Compatible with MRI Ruby 4.0.0+, and concordant releases of JRuby, and TruffleRuby. CI workflows and Appraisals are generated for MRI Ruby 4.0.0+. This test floor is configured by ruby.test_minimum in .kettle-jem.yml and may be higher than the gem's runtime compatibility floor when legacy Rubies are not practical for the current toolchain.

kettle-dev Logo by Aboling0, CC BY-SA 4.0

The amazing test matrix is powered by the kettle-dev stack.

How kettle-dev manages complexity in tests
Gem Source Role Daily download rank
appraisal2 GitHub multi-dependency Appraisal matrix generation Daily download rank for appraisal2
appraisal2-rubocop GitHub RuboCop Appraisal generator integration Daily download rank for appraisal2-rubocop
kettle-dev GitHub development, release, and CI workflow tooling Daily download rank for kettle-dev
kettle-jem GitHub Appraisals & CI workflow templates Daily download rank for kettle-jem
kettle-soup-cover GitHub SimpleCov coverage policy and reporting Daily download rank for kettle-soup-cover
kettle-test GitHub standard test runner and coverage harness Daily download rank for kettle-test
rubocop-lts GitHub Ruby-version-aware linting Daily download rank for rubocop-lts
turbo_tests2 GitHub parallel test execution Daily download rank for turbo_tests2

✨ Installation

Install the gem and add to the application's Gemfile by executing:

bundle add ast-template

If bundler is not being used to manage dependencies, install the gem by executing:

gem install ast-template

⚙️ Configuration

Configure ast-template with a template root, a destination root, and optional session options that control dry-run behavior, adapter selection, and report detail.

Template-specific package facts are normally supplied by the caller that owns the package metadata. For Ruby gems, kettle-jem is that caller.

🔧 Basic Usage

require "ast/template"

request = Ast::Template.package_directory_session_request(
  template_root: "template",
  destination_root: ".",
  mode: "plan",
)

report = Ast::Template.run_package_directory_session(request)
puts report.fetch(:mode)

🔐 Security

See SECURITY.md.

🤝 Contributing

If you need some ideas of where to help, you could work on adding more code coverage, or if it is already 💯 (see below) check issues or PRs, or use the gem and think about how it could be better.

We Keep A Changelog so if you make changes, remember to update it.

See CONTRIBUTING.md for more detailed instructions.

📌 Versioning

This library follows Semantic Versioning 2.0.0 for its public API where practical. For most applications, prefer the Pessimistic Version Constraint with two digits of precision.

For example:

spec.add_dependency("ast-template", "~> 7.0")
📌 Is "Platform Support" part of the public API? More details inside.

Dropping support for a platform can be a breaking change for affected users. If a release changes supported platforms, it should be called out clearly in the changelog and versioned with that impact in mind.

To get a better understanding of how SemVer is intended to work over a project's lifetime, read this article from the creator of SemVer:

See CHANGELOG.md for a list of releases.

📄 License

The gem is available under the following licenses: AGPL-3.0-only, PolyForm-Small-Business-1.0.0. See LICENSE.md for details.

If none of the available licenses suit your use case, please contact us to discuss a custom commercial license.