Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open gems managed by rbenv #43

Open
tylernm14 opened this issue Jul 29, 2016 · 5 comments
Open

Unable to open gems managed by rbenv #43

tylernm14 opened this issue Jul 29, 2016 · 5 comments

Comments

@tylernm14
Copy link

tylernm14 commented Jul 29, 2016

I'm using vim 7.4, vim-rbenv, and the latest vim-bundler code, and I'm having trouble with :Bopen <GEM_NAME>. :Bundle works for me as expected but :Bopen is returning the error "Gem <GEM_NAME> is in bundle but not installed". Also in my Gemfile.lock all ruby gems are highlighted as not being installed. Heres the output of two commands run from within vim:

 !ruby -rubygems -e "print Gem.path.join(';')"
/Users/tylernm/.gem/ruby/2.3.0;/Users/tylernm/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
:!ruby -rrbconfig -e "print RbConfig::CONFIG[\"ruby_version\"]"
2.3.0

which is the exact same output as on my command line shell (zsh). All this seems to point to a gem_path issue. Do you have any tips on how to debug this further? Unfortunately I'm very new to vimscript. Thanks.

@tpope
Copy link
Owner

tpope commented Jul 30, 2016

That first one looks strange; can you confirm it's as expected?

@tylernm14
Copy link
Author

tylernm14 commented Jul 31, 2016

Happily. I'm not exactly sure what it's supposed to look like; however, the first directory /Users/tylernm/.gem/ruby/2.3.0 doesn't actually exist. I have a /Users/tylernm/.gem/ directory with a credentials file and a "spec" folder, but no "ruby" folder. The second directory is actually present and has my ruby 2.3.1 gems.

Heres the output of gem environment on the command line:

gem environment                                                                                                                                                                                                                   [master]
RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.1
  - RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-darwin15]
  - INSTALLATION DIRECTORY: /Users/tylernm/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
  - USER INSTALLATION DIRECTORY: /Users/tylernm/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /Users/tylernm/.rbenv/versions/2.3.1/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/tylernm/.rbenv/versions/2.3.1/bin
  - SPEC CACHE DIRECTORY: /Users/tylernm/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/tylernm/.rbenv/versions/2.3.1/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-15
  - GEM PATHS:
     - /Users/tylernm/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
     - /Users/tylernm/.gem/ruby/2.3.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["https://rubygems.org/"]
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/tylernm/.rbenv/versions/2.3.1/bin
     - /usr/local/Cellar/rbenv/1.0.0/libexec
     - /Users/tylernm/.rbenv/shims
     - /usr/local/opt/coreutils/libexec/gnubin
     - /Users/tylernm/bin
     - /Users/tylernm/src/toolbox/bin
     - /Users/tylernm/gowork/bin
     - /Users/tylernm/src/tsukuru/bin
     - /Users/tylernm/.rbenv/shims
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin

As mentioned, the user installation directory doesnt actually exist on my system. Not sure if that's actually an issue. Did some reading and discovered that that directory is for gems install with --user-install.
Running the same command inside vim yeilds:

:!gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.1
  - RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-darwin15]
  - INSTALLATION DIRECTORY: /Users/tylernm/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
  - USER INSTALLATION DIRECTORY: /Users/tylernm/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /Users/tylernm/.rbenv/versions/2.3.1/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/tylernm/.rbenv/versions/2.3.1/bin
  - SPEC CACHE DIRECTORY: /Users/tylernm/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/tylernm/.rbenv/versions/2.3.1/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-15
  - GEM PATHS:
     - /Users/tylernm/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
     - /Users/tylernm/.gem/ruby/2.3.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["https://rubygems.org/"]
  - REMOTE SOURCES:
     - https://rubygems.org/
 - SHELL PATH:
     - /Users/tylernm/.rbenv/versions/2.3.1/bin
     - /usr/local/Cellar/rbenv/1.0.0/libexec
     - /Users/tylernm/.rbenv/shims
     - /Users/tylernm/.rbenv/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin
     - /Users/tylernm/.rbenv/shims
     - /Users/tylernm/.rbenv/bin

@tylernm14
Copy link
Author

It seems that actually a bash function in my zshrc that I use to launch vim is causing this issue. Running the vim binary from the command line without using my bash function remedies my problems with vim-bundler. I guess that this function is messing with the working directory for the binary.

@tylernm14
Copy link
Author

tylernm14 commented Aug 2, 2016

Hey there. I'm reopening this issue as I've uncovered some weirdness happening with macvim. It seems that when I launch macvim from a terminal vim-bundler initializes correctly and I can :Bopen <gem name> just fine. However when I launch macvim from osx finder and I use ther graphical window (preferred usage because of faster mouse movement), the gem open command above fails. I've compared the paths between the two version of macvim and they seem correct. The graphical macvim :Bopen command reports Gem <name> is in bundle but not installed. I've checked verbose set path? and they look identical in both versions of macvim. Are there any other variables that I can check to sort this out? Any chance that the graphical macvim. Below is the output from my graphical macvim:

:verbose set path?

path=~/src/svcscenes/lib,~/src/svcscenes/vendor,~/src/svcscenes/app/models/concerns,~/src/svcscenes/app/controllers/concerns,~/src/svcscenes/app/controllers,~/src/svcscenes
/app/helpers,~/src/svcscenes/app/mailers,~/src/svcscenes/app/models,~/src/svcscenes/app/*,~/src/svcscenes/app/views,~/src/svcscenes/spec,~/src/svcscenes/spec/controllers,~/sr
c/svcscenes/spec/helpers,~/src/svcscenes/spec/mailers,~/src/svcscenes/spec/models,~/src/svcscenes/spec/views,~/src/svcscenes/spec/lib,~/src/svcscenes/spec/features,~/src/svcs
cenes/spec/requests,~/src/svcscenes/spec/integration,~/src/svcscenes/vendor/plugins/*/lib,~/src/svcscenes/vendor/plugins/*/test,~/src/svcscenes/vendor/rails/*/lib,~/src/svcsc
enes/vendor/rails/*/test,~/src/svcscenes,~/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0,~/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/x86_64-darwin15,~/.rbenv/versions/2
.3.1/lib/ruby/site_ruby,~/.rbenv/versions/2.3.1/lib/ruby/vendor_ruby/2.3.0,~/.rbenv/versions/2.3.1/lib/ruby/vendor_ruby/2.3.0/x86_64-darwin15,~/.rbenv/versions/
        Last set from ~/mysrc/env-config/vim/bundle/vim-bundler/plugin/bundler.vim

I'm totally stumped. I guess my next step is to start throwing in "echo"s into vim-bundler and debug the script.

@tylernm14 tylernm14 reopened this Aug 2, 2016
@tpope
Copy link
Owner

tpope commented Apr 27, 2017

That path is a bit too short to actually see any gems. Check :echo &path (or more readable, :echo pathogen#split(&path)) instead.

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

No branches or pull requests

2 participants