How trinistr/gem-template works
Purpose and Scope
This repository is a reusable Ruby gem repository template, not a domain-specific implemented gem. It supplies the conventional packaging, test, typing, documentation, release, and CI structure intended to be renamed and extended by consumers.
Library Entry Points
RubyGems loads lib/gem_template.rb, which defines the top-level GemTemplate namespace. Version identity is isolated in lib/gem_template/version.rb, allowing gem packaging and runtime code to reference a single version source.
Paths:
• lib/gem_template.rb
• lib/gem_template/version.rb
• gem_template.gemspec
Packaging and Release Boundary
gem_template.gemspec is the package contract: a derived project must populate its metadata, dependencies, files, and publication details. The Rakefile is the operational entry point for local validation, installation, version bumps, documentation generation, and release. Release ultimately targets RubyGems.org.
Paths:
• gem_template.gemspec
• Rakefile
• CHANGELOG.md
Quality and Type-Checking Pipeline
The development control flow is task-driven: rake aggregates specs, RuboCop, and RBS validation; optional Steep checking provides stronger static type analysis. Runtime behavior is tested through RSpec, with shared test setup and coverage instrumentation separated from library code. Public type shape is declared in RBS and resolved dependencies are governed by RBS Collection.
Paths:
• spec/gem_template_spec.rb
• sig/gem_template.rbs
• rbs_collection.yaml
Developer Runtime Interfaces
Bundler provides dependency installation and command execution from the root Gemfile. bin/console is an interactive runtime shell for loading and experimenting with the gem; bin/benchmark is a performance-analysis entry point that produces StackProf profiling output.
Paths:
• Gemfile
• bin/console
• bin/benchmark
CI, Compatibility, and Documentation
GitHub Actions is the execution infrastructure. The primary CI workflow validates the repository, while dedicated workflows exercise CRuby, JRuby, and TruffleRuby compatibility. Documentation is generated from YARD annotations and deployed to GitHub Pages; released gem documentation is expected to be served externally by RubyDoc.
Paths:
• .github/workflows/CI.yaml
• .github/workflows/cruby.yaml
• .github/workflows/deploy-docs.yaml
Repository Governance and Security
Template consumers can import GitHub rulesets for default-branch, commit, and tag protection. Zizmor is retained as a GitHub Actions security-analysis boundary to detect unsafe workflow patterns.
Paths:
• .github/Default branch protection.json
• .github/Tag protection.json
• .github/workflows/zizmor.yaml
Main entry points: Rakefile Rake tasks · Gemfile Bundler dependencies · gem_template.gemspec Gem specification · CI.yaml Primary CI
Components 19
Library package
- GemTemplate entry · Defines the top-level namespace.
lib/gem_template.rb - Version source · Central package version identity.
lib/gem_template/version.rb - Gem specification · Defines metadata, dependencies, contents, and publication settings.
gem_template.gemspec - RubyGems.org
Developer tooling
- Rake tasks · Runs validation, installation, versioning, docs, and release operations.
Rakefile - Bundler dependencies
Gemfile - Interactive console
bin/console - Benchmark runner · Produces StackProf profiling output.
bin/benchmark - Changelog
CHANGELOG.md
Quality and types
- RSpec suite
spec/gem_template_spec.rb - Public RBS signatures
sig/gem_template.rbs - RBS Collection
rbs_collection.yaml
CI and documentation
- Primary CI · Validates the repository.
.github/workflows/CI.yaml - CRuby compatibility
.github/workflows/cruby.yaml - Documentation deployment · Generates YARD documentation and deploys it to GitHub Pages.
.github/workflows/deploy-docs.yaml - GitHub Pages
Governance and security
- Branch protection
.github/Default branch protection.json - Tag protection
.github/Tag protection.json - Workflow security scan · Detects unsafe GitHub Actions patterns.
.github/workflows/zizmor.yaml
Connections 19
- Gem specification → GemTemplate entry: packages
- Gem specification → Version source: uses version
- Rake tasks → Gem specification: builds and releases
- Rake tasks → RSpec suite: runs
- Rake tasks → Public RBS signatures: validates
- RBS Collection → Public RBS signatures: resolves external types
- Bundler dependencies → Rake tasks: provides tool dependencies
- Bundler dependencies → Interactive console: executes under Bundler
- Bundler dependencies → Benchmark runner: executes under Bundler
- Interactive console → GemTemplate entry: loads
- Benchmark runner → GemTemplate entry: profiles
- Rake tasks → Changelog: updates for releases
- Rake tasks → RubyGems.org: publishes package
- Primary CI → Rake tasks: runs validation tasks
- CRuby compatibility → RSpec suite: runs on CRuby
- Documentation deployment → GitHub Pages: deploys generated docs
- Workflow security scan → Primary CI: scans workflow patterns
- Branch protection → Primary CI: protects change integration
- Tag protection → Rake tasks: protects release tags