summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authorSchneems <richard.schneeman+foo@gmail.com>2025-05-29 11:11:48 -0500
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-08-18 12:31:51 +0900
commit813603994a388ad8f22ab831d2b554671dfd23b6 (patch)
treebdfc7800fbaa4a0b88e74843cd41180b76613413 /transcode.c
parent8d5f00c5371ff71f33ef57b1419fd8d4b1aa9074 (diff)
[rubygems/rubygems] Introduce `bundle list --format=json`
The `bundle list` command is a convenient way for human to know what gems and versions are available. By introducing a `--format=json` option, we can provide the same information to machines in a stable format that is robust to UI additions or modifications. It indirectly supports `Gemfile.lock` modifications by discouraging external tools from attempting to parse that format. This addition allows for the scripting of installation tools, such as buildpacks, that wish to branch logic based on gem versions. For example: ```ruby require "json" command = "bundle list --format=json" output = `#{command}` raise "Command `#{command}` errored: #{output}" unless $?.success? railties = JSON.parse(output).find {|gem| gem["name"] == railties } if railties && Gem::Version.new(railties["version"]) >= Gem::Version.new("7") puts "Using Rails greater than 7!" end ``` The top level is an object with a single key, "gems", this structure allows us to add other information in the future (should we desire) without having to change the json schema. https://github.com/rubygems/rubygems/commit/9e081b0689
Diffstat (limited to 'transcode.c')
0 files changed, 0 insertions, 0 deletions