Issue #10065 has been updated by David MacMahon.


Eric Hodel wrote:
> I don't understand the value of loading the output of `gem env` as YAML when you can query the fields directly from RubyGems itself.

In "Ruby-only" or "Ruby-dominant" environments I agree that there is little value.  It would allow passing the RubyGems config to something (e.g. a diagnostic logger) that doesn't know about the RubyGems API.

In "Ruby-barely-tolerated" environments it is one small way to make RubyGems "play nicely" with the less enlightened.

> I don't want to encourage parsing the output as YAML

Not encouraging and actively preventing are two different things.  One of the great things about Ruby (IMHO) is that it gives developers lots of freedom to do what they want (even if it's not the "right" way to do things).

If you still feel strongly about actively preventing it from being valid YAML, then please feel free to reject this feature request.


----------------------------------------
Feature #10065: Make `gem env` command output valid YAML
https://bugs.ruby-lang.org/issues/10065#change-47942

* Author: David MacMahon
* Status: Feedback
* Priority: Normal
* Assignee: Eric Hodel
* Category: lib/rubygems
* Target version: 
----------------------------------------
The output of `gem environment` is close to being valid YAML, but the `GEM CONFIGURATION` section uses `key => value` instead of `key: value` so the output cannot be parsed by YAML.  The attached patch changes just one line to make the output of `gem environment` be valid YAML.

I could not find a specification for the output of the `gem environment` command so I am filing this as a feature request rather than as a bug.

The attached patch is the minimum change necessary to create valid YAML.  I think the structure of the resulting YAML output is not optimal.  It is currently a one element Hash whose only value is an Array of one element Hashes.  Is it preferable to address that in a separate feature request or as an expansion of this one?


---Files--------------------------------
0001-Make-gem-env-command-output-valid-YAML.patch (1.12 KB)


-- 
https://bugs.ruby-lang.org/