|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for helping improve the Transloadit Ruby SDK! This guide covers local development, testing, and publishing new releases. |
| 4 | + |
| 5 | +## Local Development |
| 6 | + |
| 7 | +After cloning the repository, install dependencies and run the test suite: |
| 8 | + |
| 9 | +```bash |
| 10 | +bundle install |
| 11 | +bundle exec rake test |
| 12 | +``` |
| 13 | + |
| 14 | +To exercise the signature parity suite against the Node.js CLI, make sure `npx transloadit` is available and run: |
| 15 | + |
| 16 | +```bash |
| 17 | +TEST_NODE_PARITY=1 bundle exec rake test |
| 18 | +``` |
| 19 | + |
| 20 | +You can warm the CLI cache ahead of time: |
| 21 | + |
| 22 | +```bash |
| 23 | +TRANSLOADIT_KEY=... TRANSLOADIT_SECRET=... \ |
| 24 | + npx --yes transloadit smart_sig --help |
| 25 | +TRANSLOADIT_KEY=... TRANSLOADIT_SECRET=... \ |
| 26 | + npx --yes transloadit sig --algorithm sha384 --help |
| 27 | +``` |
| 28 | + |
| 29 | +Set `COVERAGE=0` to skip coverage instrumentation if desired: |
| 30 | + |
| 31 | +```bash |
| 32 | +COVERAGE=0 bundle exec rake test |
| 33 | +``` |
| 34 | + |
| 35 | +## Docker Workflow |
| 36 | + |
| 37 | +The repository ships with a helper that runs tests inside a reproducible Docker image: |
| 38 | + |
| 39 | +```bash |
| 40 | +./scripts/test-in-docker.sh |
| 41 | +``` |
| 42 | + |
| 43 | +Pass a custom command to run alternatives (Bundler still installs first): |
| 44 | + |
| 45 | +```bash |
| 46 | +./scripts/test-in-docker.sh bundle exec ruby -Itest test/unit/transloadit/test_request.rb |
| 47 | +``` |
| 48 | + |
| 49 | +The script forwards environment variables such as `TEST_NODE_PARITY` and credentials from `.env`, so you can combine parity checks and integration tests. End-to-end uploads are enabled by default; unset them by running: |
| 50 | + |
| 51 | +```bash |
| 52 | +RUBY_SDK_E2E=0 ./scripts/test-in-docker.sh |
| 53 | +``` |
| 54 | + |
| 55 | +## Live End-to-End Test |
| 56 | + |
| 57 | +To exercise the optional live upload: |
| 58 | + |
| 59 | +```bash |
| 60 | +RUBY_SDK_E2E=1 TRANSLOADIT_KEY=... TRANSLOADIT_SECRET=... \ |
| 61 | + ./scripts/test-in-docker.sh bundle exec ruby -Itest test/integration/test_e2e_upload.rb |
| 62 | +``` |
| 63 | + |
| 64 | +The test uploads `chameleon.jpg`, resizes it, and asserts on a real assembly response. |
| 65 | + |
| 66 | +## Releasing to RubyGems |
| 67 | + |
| 68 | +1. Update the version and changelog: |
| 69 | + - Bump `lib/transloadit/version.rb`. |
| 70 | + - Add a corresponding entry to `CHANGELOG.md`. |
| 71 | +2. Run the full test suite (including Docker, parity, and e2e checks as needed). |
| 72 | +3. Commit the release changes and tag: |
| 73 | + ```bash |
| 74 | + git commit -am "Release X.Y.Z" |
| 75 | + git tag -a vX.Y.Z -m "Release X.Y.Z" |
| 76 | + ``` |
| 77 | +4. Push the commit and tag: |
| 78 | + ```bash |
| 79 | + git push origin main |
| 80 | + git push origin vX.Y.Z |
| 81 | + ``` |
| 82 | +5. Publish the gem using the helper script: |
| 83 | + ```bash |
| 84 | + GEM_HOST_API_KEY=... ./scripts/notify-registry.sh |
| 85 | + ``` |
| 86 | +6. Draft a GitHub release from the new tag and publish the generated notes. |
| 87 | + |
| 88 | +### RubyGems Credentials |
| 89 | + |
| 90 | +- You must belong to the `transloadit` organization on RubyGems with permission to push the `transloadit` gem. |
| 91 | +- Generate an API key with **Push Rubygems** permissions at <https://rubygems.org/profile/edit>. Copy the token and keep it secure. |
| 92 | +- Export the token as `GEM_HOST_API_KEY` in your environment before running `./scripts/notify-registry.sh`. The script refuses to run if the variable is missing. |
| 93 | + |
| 94 | +That’s it! Thank you for contributing. |
| 95 | + |
0 commit comments