gel icon indicating copy to clipboard operation
gel copied to clipboard

Implements gel env command

Open JuanitoFatas opened this issue 5 years ago • 2 comments

gel env prints the information in markdown format for debugging, gel env --full for people to report bugs.

  • I only print things that are available from ENV or built-in constant, I probably miss a lot of things, will investigate and add more
  • We can also implement other formatters for Plain Text, YAML, or JSON.
  • Using Etc is cross-platform compatible and not rely on ENV['HOME'] to be set

gel env will print the following markdown:

Example gel env output

Gel

  • GEL_VERSION: 0.3.0

User

  • SHELL: /bin/zsh

Ruby

  • GEM_HOME: /Users/juanitofatas/.gem/ruby/2.6.1
  • GEM_PATH: /Users/juanitofatas/.gem/ruby/2.6.1:/opt/rubies/2.6.1/lib/ruby/gems/2.6.0
  • GEM_ROOT: /opt/rubies/2.6.1/lib/ruby/gems/2.6.0
  • RUBY_ENGINE: ruby
  • RUBY_ENGINE_VERSION: 2.6.1
  • RUBY_ROOT: /opt/rubies/2.6.1
  • RUBY_VERSION: 2.6.1
  • [x] I tested this change ./exe/gel env
  • [x] tests are passing locallybin/rake
  • [x] tests are passing on CI

JuanitoFatas avatar May 22 '19 14:05 JuanitoFatas

I'd like to consider omitting the "relevant files" section... or maybe relegate it to a --full option or something. What do you think?

I see the advantage in having a single command to use for support requests ("please run this, paste us the result")... but personally I've used bundle env more often locally, to confirm it's using the right versions/paths/etc. And for that case, dumping out massive Gemfile(.lock) just seems to get in the way.

Also, does Bundler include those server auth details here? That seems to go against the idea of it being something people can paste for debugging. :confused:

matthewd avatar Jun 01 '19 15:06 matthewd

I'd like to consider omitting the "relevant files" section... or maybe relegate it to a --full option or something. What do you think?

Sounds good 👍 We can add an issue template that advice people when reporting for bugs, run gel env --full.

Also, does Bundler include those server auth details here? That seems to go against the idea of it being something people can paste for debugging. 😕

Yes 😰

bundle env on this project at local:

Output of `bundle env` Warning: the running version of Bundler (1.17.3) is older than the version that created the lockfile (1.999). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. ## Environment
Bundler       1.17.3
  Platforms   ruby, x86_64-darwin-18
Ruby          2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin18]
  Full Path   /opt/rubies/2.6.1/bin/ruby
  Config Dir  /opt/rubies/2.6.1/etc
RubyGems      3.0.2
  Gem Home    /Users/juanitofatas/.gem/ruby/2.6.1
  Gem Path    /Users/juanitofatas/.gem/ruby/2.6.1:/opt/rubies/2.6.1/lib/ruby/gems/2.6.0
  User Path   /Users/juanitofatas/.gem/ruby/2.6.0
  Bin Dir     /Users/juanitofatas/.gem/ruby/2.6.1/bin
Tools
  Git         2.19.1
  RVM         not installed
  rbenv       not installed
  chruby      not installed

Bundler Build Metadata

Built At          2019-01-01
Git SHA           d7089abb6
Released Version  false

Bundler settings

packages.shopify.io
  Set for the current user (/Users/juanitofatas/.bundle/config): "abcdefg1234567890"
gem.test
  Set for the current user (/Users/juanitofatas/.bundle/config): "rspec"
gem.mit
  Set for the current user (/Users/juanitofatas/.bundle/config): true
gem.coc
  Set for the current user (/Users/juanitofatas/.bundle/config): true

Gemfile

Gemfile

source "https://rubygems.org"

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in gel.gemspec
gemspec

gem "rake", "~> 12.0"
gem "minitest", "~> 5.0"
gem "mocha"
gem "webmock"

gem "ronn", platform: :ruby

Gemfile.lock

PATH
  remote: .
  specs:
    gel (0.3.0)

GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.6.0)
      public_suffix (>= 2.0.2, < 4.0)
    crack (0.4.3)
      safe_yaml (~> 1.0.0)
    hashdiff (0.3.8)
    hpricot (0.8.6)
    metaclass (0.0.4)
    minitest (5.11.3)
    mocha (1.8.0)
      metaclass (~> 0.0.1)
    mustache (1.1.0)
    pub_grub (0.5.0)
    public_suffix (3.0.3)
    rake (12.3.2)
    rdiscount (2.2.0.1)
    ronn (0.7.3)
      hpricot (>= 0.8.2)
      mustache (>= 0.7.0)
      rdiscount (>= 1.5.8)
    safe_yaml (1.0.5)
    webmock (3.5.1)
      addressable (>= 2.3.6)
      crack (>= 0.3.2)
      hashdiff

PLATFORMS
  ruby

DEPENDENCIES
  gel!
  minitest (~> 5.0)
  mocha
  pub_grub (>= 0.5.0)
  rake (~> 12.0)
  ronn
  webmock

BUNDLED WITH
   1.999

Gemspecs

gel.gemspec

# frozen_string_literal: true

require_relative "lib/gel/version"

Gem::Specification.new do |spec|
  spec.name          = "gel"
  spec.version       = Gel::VERSION
  spec.authors       = ["Gel Authors"]
  spec.email         = ["[email protected]"]

  spec.summary       = "A modern gem manager"
  spec.homepage      = "https://gel.dev"
  spec.license       = "MIT"

  spec.files         = `git ls-files -z exe lib *.md *.txt`.split("\x0") +
    Dir["man/man?/*.?"]
  spec.bindir        = "exe"
  spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
  spec.require_paths = ["lib"]

  spec.add_development_dependency "pub_grub", ">= 0.5.0"
end

gel env (16b69d0) on this project at local:

Output of `gel env`

Gel

  • GEL_VERSION: 0.3.0

User

  • SHELL: /bin/zsh

Ruby

  • GEM_HOME: /Users/juanitofatas/.gem/ruby/2.6.1
  • GEM_PATH: /Users/juanitofatas/.gem/ruby/2.6.1:/opt/rubies/2.6.1/lib/ruby/gems/2.6.0
  • GEM_ROOT: /opt/rubies/2.6.1/lib/ruby/gems/2.6.0
  • RUBY_ENGINE: ruby
  • RUBY_ENGINE_VERSION: 2.6.1
  • RUBY_ROOT: /opt/rubies/2.6.1
  • RUBY_VERSION: 2.6.1

Bundler include those server auth details here? That seems to go against the idea of it being something people can paste for debugging.

I also worry people will paste their token when opening an issue :sweat: Issue template can also warn them to redact their credentials. Should we ignore the config file from relevant files?

but personally I've used bundle env more often locally, to confirm it's using the right versions/paths/etc.

Is there any common ENV, path you always look at for debugging that is missing from current gel env? We should add them 😅

JuanitoFatas avatar Jun 08 '19 02:06 JuanitoFatas