Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

v0.5.0 broke chruby compatibility when lunching from CLI #168

Open
pecigonzalo opened this issue Sep 29, 2016 · 13 comments
Open

v0.5.0 broke chruby compatibility when lunching from CLI #168

pecigonzalo opened this issue Sep 29, 2016 · 13 comments

Comments

@pecigonzalo
Copy link

On version 0.4.7 lunching Atom from the CLI allowed it to use the CLI path/env variables.
These seems to be broken on 0.5.0

@Arcanemagus
Copy link
Member

@steelbrain Looks like this is a consistent-env issue, you would know better than I how to debug this.

@steelbrain
Copy link
Contributor

@pecigonzalo Can you tell us your OS, shell and the env variables in question?

@pecigonzalo
Copy link
Author

Archlinux, ZSH (with zplug).
The envs are GEM_HOME and GEM_PATH, if it doesnt import them, it breaks rubocop from chruby. If you need the output of this or gem env i can provide tomorrow.

I tried looking at the code, but tbh i dont know much about atom plug deployment or how are you importing the envs, so i couldnt figure out what is different.

@steelbrain
Copy link
Contributor

Can you do echo $GEM_HOME from terminal and show output of process.env.GEN_HOME from Atom dev tools window?

@pecigonzalo
Copy link
Author

Unfortunately my laptop if out of juice at the moment and i dont have the adapter with me (the device i initially tested with).
I can provide that output tomorrow.

@goronfreeman
Copy link

goronfreeman commented Oct 3, 2016

I wanted to chime in on this issue as well. I'm seeing the same thing. macOS 10.12 with ZSH (oh-my-zsh).

$ echo $GEM_HOME
/Users/<username>/.gem/ruby/2.3.1
$ process.env.GEM_HOME
undefined

If I launch Atom from the command line, then process.env.GEM_HOME shows what it should.

EDIT: Looks like I read this wrong. My environment variables load correctly when launched from CLI, but not when launched through a GUI method. You can ignore my comment.

@pecigonzalo
Copy link
Author

pecigonzalo commented Oct 4, 2016

As agreed:

GEM_HOME

Shell

➔ echo $GEM_HOME
/home/gonzalop/.gem/ruby/2.2.5

Atom console

process.env.GEM_HOME
"/home/gonzalop/.gem/ruby/2.2.5"

GEM_PATH

Shell

➔ echo $GEM_PATH
/home/gonzalop/.gem/ruby/2.2.5:/home/gonzalop/.rubies/ruby-2.2.5/lib/ruby/gems/2.2.0

Atom console

process.env.GEM_PATH
"/home/gonzalop/.gem/ruby/2.2.5:/home/gonzalop/.rubies/ruby-2.2.5/lib/ruby/gems/2.2.0"

Error

Error: /home/gonzalop/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'rubocop' (>= 0) among 9 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/.gem/ruby/2.2.0:/home/gonzalop/.rubies/ruby-2.2.5/lib/ruby/gems/2.2.0', execute `gem env` for more information
    from /home/gonzalop/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
    from /home/gonzalop/.rubies/ruby-2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /home/gonzalop/.gem/ruby/2.2.5/bin/rubocop:22:in `<main>'
    at /home/gonzalop/.atom/packages/linter-rubocop/lib/index.coffee:57:15

and gem env important bits

RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.5.1
  - RUBY VERSION: 2.2.5 (2016-04-26 patchlevel 319) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/gonzalop/.gem/ruby/2.2.5
  - RUBY EXECUTABLE: /home/gonzalop/.rubies/ruby-2.2.5/bin/ruby
  - EXECUTABLE DIRECTORY: /home/gonzalop/.gem/ruby/2.2.5/bin
  - SPEC CACHE DIRECTORY: /home/gonzalop/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /home/gonzalop/.rubies/ruby-2.2.5/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/gonzalop/.gem/ruby/2.2.5
     - /home/gonzalop/.rubies/ruby-2.2.5/lib/ruby/gems/2.2.0
  - SHELL PATH:
     - /home/gonzalop/.gem/ruby/2.2.5/bin
     - /home/gonzalop/.rubies/ruby-2.2.5/lib/ruby/gems/2.2.0/bin
     - /home/gonzalop/.rubies/ruby-2.2.5/bin

@steelbrain
Copy link
Contributor

@goronfreeman Yes Mac apps have that issue. Therefore we fix it with consistent-env when spawning. Can you see if the result is in require('/Users/[name]/.atom/packages/linter-rubocop/node_modules/consistent-env')().GEM_HOME?

@pecigonzalo Thanks that was very helpful, can you show the output of require('/Users/[name]/.atom/packages/linter-rubocop/node_modules/consistent-env')() (make sure to remove anything sensitive like s3 keys and stuff, never post them on public forums :)

@pecigonzalo
Copy link
Author

{USER: "gonzalop", PATH: "/home/gonzalop/.gem/ruby/2.2.5/bin:/home/gonzalop/…ndor_perl:/usr/bin/core_perl:/bin:/usr/sbin:/sbin", OLDPWD: "/home/gonzalop/Workspace/Zenmate/chef", PWD: "/home/gonzalop/Workspace/Zenmate/chef"}

@goronfreeman
Copy link

@steelbrain When launching from the GUI, that command outputs undefined. Let me know if this isn't the thread to discuss this, but I appreciate the help. Thanks!

@5t111111
Copy link

I use zplug too and have a similar issue with v0.5.0, when it runs linter-rubocop, I encounter the following error:

Error: couldn't find HOME environment -- expanding `~'
  • Downgrading linter-rubocop to v0.4.7
  • Removing zplug from my .zshrc

Either of the above two fixes the problem.

OS: OS X 10.11.6
Shell: Zsh

@5t111111
Copy link

After some further investigation, I've found that the problem in the above comment is occurs only when I use a specific plugin (in my case, that is emoji-cli) via zplug.

Although I still don't know why the problem occurs only after upgrading linter-rubocop v0.5.0, either I'm not sure if other plugins rather than emoji-cli also cause errors, maybe I should investigate emoji-cli for the moment.

@joshRpowell
Copy link

@5t111111 I can confirm that this issue still exists with emoji-cli via zplug. were you able to make any progress on this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants