Small wrapper around curl for hitting the RailsBump compatibility API
without writing the JSON body by hand.
- A running RailsBump app (locally:
bin/dev). jqinstalled (brew install jq).- For local use,
api.localhostresolves to127.0.0.1on macOS by default. The dev environment forcestld_length = 0so Rails treatsapi.localhostas having subdomainapi(seeconfig/environments/development.rb).
bin/api_check_lockfile spec/fixtures/Gemfile.lockSends the file's contents as the lockfile.content field in a
POST /lockfiles request, then pretty-prints the JSON response:
{
"slug": "abc123…",
"status": "pending",
"status_url": "http://api.localhost:3000/lockfiles/abc123…",
"retry_after_seconds": 103,
"message": "Compatibility check is running. Wait ~103 seconds, then GET …"
}The compatibility check runs asynchronously in Sidekiq. Use the slug to fetch results once the suggested wait elapses.
bin/api_check_lockfile --show abc123…Issues GET /lockfiles/:slug and pretty-prints:
{
"slug": "abc123…",
"status": "pending",
"lockfile_checks": [
{
"target_rails_version": "7.2",
"ruby_version": "3.3.0",
"bundler_version": "2.5.0",
"rubygems_version": "3.5.0",
"status": "pending",
"gem_checks": [
{
"name": "puma",
"locked_version": "6.4.0",
"status": "complete",
"result": "compatible",
"earliest_compatible_version": null,
"error_message": null
}
]
}
]
}Top-level status flips to "complete" once every nested
gem_check.status is "complete".
Set API_HOST:
API_HOST=api.railsbump.org bin/api_check_lockfile path/to/Gemfile.lockScheme auto-selects based on the host: http for localhost/127.0.0.1,
https for everything else. Override with API_SCHEME only if needed
(e.g. hitting a remote host over plain HTTP for debugging):
API_HOST=staging.example.com API_SCHEME=http \
bin/api_check_lockfile path/to/Gemfile.lockA typical end-to-end flow from the shell:
SLUG=$(bin/api_check_lockfile path/to/Gemfile.lock | jq -r '.slug')
sleep 60
bin/api_check_lockfile --show "$SLUG"For more rigorous timing, see the gitignored bin/api_benchmark helper
(documented in docs/api-poll-after-seconds.md).