docx is a Ruby gem (ruby-docx/docx) for reading and editing .docx files: a
thin wrapper over rubyzip + Nokogiri.
originpoints directly at the upstream repogithub.com/ruby-docx/docx(not a fork). The user is a maintainer with push access, so branches and tags can be pushed tooriginand PRs merged directly.
- Local Ruby is 4.0.x where
bundle exec rake specfails (ostructis no longer a default gem). Run tests withbundle exec rspec specinstead (or a single example with-e). - Test output is noisy with rubygems warnings; filter for readability:
... 2>&1 | grep -vE 'warning:|previous definition'.
- Always work test-first. Every behavior change (feature or bug fix) follows
the
tdd-developmentskill: write a failing test, confirm red, implement, confirm green + full suite, then branch → PR → CI → merge → cleanup. - Keep new constructor arguments optional (
def initialize(node, props = {}, doc = nil)) to preserve backward compatibility for existing callers. - Be honest about scope. When a report spans multiple causes, separate gem-side logic bugs (fix them) from raw exceptions thrown by rubyzip/Nokogiri on genuinely corrupt input (out of scope) — and say which is which.
- Don't claim something is done before it is. Order operations so any comment or status is true at the moment it's posted.
- Releases are tag-driven; use the
release-docxskill. Confirm the version with the user first (RubyGems publish is irreversible; a new public method is a minor bump). Do not editCHANGELOG.md(stale since v0.7.0; the GitHub auto-generated notes are the source of truth). - Auto-generated release notes credit each PR by its title and its opener (the
maintainer). To get an original contributor's handle into the notes, embed
the handle in the PR title (e.g. "... (original work by @user in #NN)") and
add a
Co-authored-by:trailer — co-authors alone do not appear in the notes.
- Shipped: header/footer reading (
#headers/#footers), write-back on save, and bookmark scanning in headers/footers. All bug-labeled issues are resolved; the only open issues are question/enhancement (#157, #91). - Not yet done (good next work):
- Resolve the main document part name via
[Content Types].xmlinstead of globbingword/document*.xml;#updatecurrently writes back to a hardcodedword/document.xml, so Office 365document2.xmlis not updated. - Numbering support (
word/numbering.xml) — requested in #73.
- Resolve the main document part name via
release-docx— cut a new gem release (version bump → tag → CI publishes).tdd-development— the test-first workflow for any code change here.