Closed deiga closed 10 years ago
Transcribing message here that I put on the gist:
The ADD_TO_PATH
variable is for directories you'd like to add to the PATH
variable. Notice on line 33, PATH
has the RBENV_VERSION
in it.
Instead, this should be its own key-value pair, so:
...
'seeing-is-believing':
'add-to-env':
'RBENV_VERSION': '2.1.2'
'ruby-command': '/usr/local/var/rbenv/shims/ruby'
Let me know if that works, I haven't used rbenv in a while, so would be good to get some confirmation.
Updated gist, still not working
What happens when you run env RBENV_VERSION=2.1.2 /usr/local/var/rbenv/shims/ruby -v
? Here I am checking if your version and path to Ruby are set correctly. If it prints a version out (presumably 2.1.2), then what about env RBENV_VERSION=2.1.2 /usr/local/var/rbenv/shims/ruby -S gem list seeing
this one is to test if you've installed the gem. If it doesn't list it, you need to env RBENV_VERSION=2.1.2 /usr/local/var/rbenv/shims/ruby -S gem install seeing_is_believing
to install it, and then rbenv rehash
to make the shim.
In general, notice that it logs the command its trying to run, you can take that and try running it on the console to get context about where it's wrong. You'll have to grab the relevant env vars yourself, though, as it doesn't really know which ones are relevant.
$ env RBENV_VERSION=2.1.2 /usr/local/var/rbenv/shims/ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
$ env RBENV_VERSION=2.1.2 /usr/local/var/rbenv/shims/ruby -S gem list seeing
*** LOCAL GEMS ***
seeing_is_believing (2.1.4)
$ env RBENV_VERSION=2.1.2 /usr/local/var/rbenv/shims/ruby -S seeing_is_believing --alignment-strategy chunk --number-of-captures 300 --line-length 1000 --timeout 12
ruby: no Ruby script found in input (LoadError)
This is way too weird...
env RBENV_VERSION=2.1.2 /usr/local/var/rbenv/shims/ruby -S seeing_is_believing -v
Gives the SiB version?
Then it's got to be that it's not hooked up to the file, I assume this one works:
env RBENV_VERSION=2.1.2 /usr/local/var/rbenv/shims/ruby -S seeing_is_believing -e "1+1"
What about this:
echo "1+1" | env RBENV_VERSION=2.1.2 /usr/local/var/rbenv/shims/ruby -S seeing_is_believing --alignment-strategy chunk --number-of-captures 300 --line-length 1000 --timeout 12
$ env RBENV_VERSION=2.1.2 /usr/local/var/rbenv/shims/ruby -S seeing_is_believing -v
ruby: no Ruby script found in input (LoadError)
env RBENV_VERSION=2.1.2 /usr/local/var/rbenv/shims/ruby -S seeing_is_believing -e "1+1"
ruby: no Ruby script found in input (LoadError)
echo "1+1" | env RBENV_VERSION=2.1.2 /usr/local/var/rbenv/shims/ruby -S seeing_is_believing --alignment-strategy chunk --number-of-captures 300 --line-length 1000 --timeout 12
ruby: no Ruby script found in input (LoadError)
I'm thinking that my ruby executable doesn't see the seeing_is_believing executable
You did do rbenv rehash
?
Yes I did. It works when I run it straight without the ruby interpreter.
$ env RBENV_VERSION=2.1.2 seeing_is_believing -v
2.1.4
I believe that this is because the seeing_is_believing in our $PATH is actually a rbenv shim, which is a bash script and not the real ruby script that the gem installs.
I added: /usr/local/opt/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/seeing_is_believing-2.1.4/bin/
to the ADD_TO_PATH settings, and now it seems to work.
I'm beginning to wonder why the seeing_is_believing
even has to be passed to ruby
. I mean, it's an executable which works fine on it's own and (at least with rbenv) the system knows which ruby to use, without actually pointing to it.
I don't know, give me some time to digest that. It's not entirely true that it "works fine on its own", it is evaluated by a given Ruby, within a given gemset and so forth. If you're using Atom, I've set defaults that will "just work" if you launch Atom from the command-line (b/c you inherit the env vars), but It might or might not be true that it can exist independently of this environmental setup. I need to let it ferment in my mind for a week or two, but I have enough competing interests at the moment that this hasn't happened yet.
This is really weird, is just tested resolving the path prior to running and it works then.
$ echo "1+1" | env RBENV_VERSION=2.1.2 /usr/local/var/rbenv/shims/ruby -S $(rbenv which seeing_is_believing) --alignment-strategy chunk --number-of-captures 300 --line-length 1000 --timeout 12
1+1 # => 2
I tried using command substitution inside the plugin, but I couldn't find a way to use it in NodeJS
So this was resolved by running gem pristine seeing_is_believing --only-executables
I open a new buffer in atom, type
1+1
and run SiB and it doesn't work. https://gist.github.com/deiga/71f17be89e33f248995b