Giter VIP home page Giter VIP logo

rbenv-communal-gems's People

Contributors

tpope avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rbenv-communal-gems's Issues

Installing via homebrew breaks communal-gem-home command

When installed via homebrew, running rbenv communal-gem-home gives the following error:

/usr/local/bin/../version_cache/2.3.4
mkdir: /usr/local/bin/../version_cache: Permission denied
/usr/local/bin/rbenv-communal-gem-home: line 22: /usr/local/bin/../version_cache/2.3.4: No such file or directory

Because homebrew uses symlinks, the cachedir is set to "${BASH_SOURCE%/*}/../version_cache", which evaluates to /usr/local/bin/../version_cache. To fix this, I replaced this line https://github.com/tpope/rbenv-communal-gems/blob/master/bin/rbenv-communal-gem-home#L14 with:

cachedir=$(dirname `php -r "echo realpath(\"$BASH_SOURCE\");"`)/../version_cache

Bins aren't handled properly

When installing gems that have executables, the executables are only available in one Ruby version.

To reproduce:

  1. Install 2 Ruby versions and communize their gems (say, 2.0.0-rc2 and 2.0.0-p0)
  2. Install Unicorn in the first version (rbenv shell 2.0.0-rc2; gem install unicorn)
  3. Regenerate rbenv's bin stubs (rbenv rehash)
  4. Switch to the second version (rbenv shell 2.0.0-p0)
  5. Run unicorn

Actual result:

rbenv: unicorn: command not found

The `unicorn' command exists in these Ruby versions:
  2.0.0-rc2

Bundle fails if jruby in communalised

It appears that bundle, this gem and jruby are somehow conflicting, causing bundle to crash. I don't have the problem with other rubies.

I experienced the following error with jruby:

$->(1) bundle
Gem::LoadError: Could not find 'bundler' (>= 0) among 0 total gem(s)
  to_specs at /home/ianh/.rbenv/versions/jruby-1.7.9/lib/ruby/shared/rubygems/dependency.rb:298
   to_spec at /home/ianh/.rbenv/versions/jruby-1.7.9/lib/ruby/shared/rubygems/dependency.rb:309
       gem at /home/ianh/.rbenv/versions/jruby-1.7.9/lib/ruby/shared/rubygems/core_ext/kernel_gem.rb:53
    (root) at /home/ianh/.rbenv/versions/jruby-1.7.9/bin/bundle:22

isolating jruby from the communal area works:

ianh@abe:.../Github/net-ping (master)$ rbenv sequester jruby-1.7.9 
Sequestered gems for jruby-1.7.9
ianh@abe:.../Github/net-ping (master)$ gem list

*** LOCAL GEMS ***


ianh@abe:.../Github/net-ping (master)$ gem install bundler
Fetching: bundler-1.6.1.gem (100%)
Successfully installed bundler-1.6.1
1 gem installed
ianh@abe:.../Github/net-ping (master)$ gem list

*** LOCAL GEMS ***

bundler (1.6.1)
ianh@abe:.../Github/net-ping (master)$ bundle 
Fetching gem metadata from http://rubygems.org/.........
Fetching additional metadata from http://rubygems.org/..
Resolving dependencies...
Installing rake 10.2.2
Installing fakeweb 1.3.0
Using net-ping 1.7.3 from source at .
Installing test-unit 2.5.5
Using bundler 1.6.1
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

Trying it again with the communal area causes the problem again (I have a plugin to automatically rehash BTW)

ianh@abe:.../Github/net-ping (master)$  rbenv communize jruby-1.7.9 
Communized gems for jruby-1.7.9
ianh@abe:.../Github/net-ping (master)$ gem list

*** LOCAL GEMS ***

bundle (0.0.1)
bundler (1.6.1, 1.5.3)
rake (10.1.1)
rubygems-update (2.2.2)
ianh@abe:.../Github/net-ping (master)$ gem install bundler
Successfully installed bundler-1.6.1
1 gem installed
ianh@abe:.../Github/net-ping (master)$ bundle
Gem::LoadError: Could not find 'bundler' (>= 0) among 0 total gem(s)
  to_specs at /home/ianh/.rbenv/versions/jruby-1.7.9/lib/ruby/shared/rubygems/dependency.rb:298
   to_spec at /home/ianh/.rbenv/versions/jruby-1.7.9/lib/ruby/shared/rubygems/dependency.rb:309
       gem at /home/ianh/.rbenv/versions/jruby-1.7.9/lib/ruby/shared/rubygems/core_ext/kernel_gem.rb:53
    (root) at /home/ianh/.rbenv/versions/jruby-1.7.9/bin/bundle:22
ianh@abe:.../Github/net-ping (master)$

I use the following plugins:

ianh@abe:.../Github/net-ping (master)$ ls ~/.rbenv/plugins
rbenv-aliases   rbenv-bundler-ruby-version  rbenv-default-gems  rbenv-gem-rehash  rbenv-update  rbenv-vars    rbenv-which-ext
rbenv-binstubs  rbenv-communal-gems         rbenv-env           rbenv-sudo        rbenv-use     rbenv-whatis  ruby-build
ianh@abe:.../Github/net-ping (master)$

Reliance on $RBENV_ROOT being set

Probably should error out if $RBENV_ROOT is not set. Could also potentially check for rbenv root's output and use that if it's available.

Without $RBENV_ROOT being set, the script will execute, saying it's successful, but eats the user's gems.

Can't find or install new gems after communizing

After installing an communizing gems (which errored a few times per Ruby version due to gems installed with sudo) I'm seeing this issue on multiple Ruby versions I have installed:

/Users/olivierlacan/.rbenv/versions/2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'thor' (>= 0) among 0 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/olivierlacan/.gem/ruby/2.2.0:/Users/olivierlacan/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0', execute `gem env` for more information
  from /Users/olivierlacan/.rbenv/versions/2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
  from /Users/olivierlacan/.rbenv/versions/2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
  from /Users/olivierlacan/.rbenv/versions/2.2.0/bin/thor:22:in `<main>'
$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.6
  - RUBY VERSION: 2.2.0 (2014-12-25 patchlevel 0) [x86_64-darwin14]
  - INSTALLATION DIRECTORY: 
  - RUBY EXECUTABLE: /Users/olivierlacan/.rbenv/versions/2.2.0/bin/ruby
  - EXECUTABLE DIRECTORY: /bin
  - SPEC CACHE DIRECTORY: /Users/olivierlacan/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/olivierlacan/.rbenv/versions/2.2.0/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-14
  - GEM PATHS:
     - 
     - /Users/olivierlacan/.gem/ruby/2.2.0
     - /Users/olivierlacan/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "install" => "--env-shebang"
     - "gemhome" => ""
     - :benchmark => false
     - :sources => ["https://rubygems.org/"]
     - "gem" => "--no-document"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/olivierlacan/.rbenv/versions/2.2.0/bin
     - /Users/olivierlacan/.rbenv/libexec
     - /Users/olivierlacan/.rbenv/plugins/ruby-build/bin
     - /Users/olivierlacan/.rbenv/plugins/rbenv-sudo/bin
     - /Users/olivierlacan/.rbenv/plugins/rbenv-communal-gems/bin
     - /Users/olivierlacan/.rbenv/shims
     - /Users/olivierlacan/.rbenv/bin
     - /usr/local/bin
     - /usr/local/sbin
     - /usr/local/heroku/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin
     - /usr/local/MacGPG2/bin

As you can see the INSTALLATION DIRECTORY is blank. In /Users/olivierlacan/.gem/ruby/2.2.0 I find only a cache directory with bundler-1.8.2.gem inside. You can also see that the first GEM PATHS is blank. This is most likely what causes:

$ gem install bundler
ERROR:  While executing gem ... (Errno::ENOENT)
    No such file or directory @ dir_s_mkdir - 

Upon checking ~/.rbenv/gems/ I can only find a 2.0.0 directory there despite having the following Rubies installed:

$ rbenv versions
  system
  1.9.2-p330
  1.9.3-p392
  1.9.3-p448
  1.9.3-p484
  1.9.3-p545
  1.9.3-p550
  1.9.3-p551
  2.0.0-p247
  2.0.0-p353
  2.0.0-p481
  2.0.0-p594
  2.0.0-p598
  2.1.0
  2.1.1
  2.1.2
  2.1.4
  2.1.5
* 2.2.0 (set by /Users/olivierlacan/.rbenv/version)
  2.2.0-dev
  jruby-1.7.18
  jruby-1.7.6

So it looks like rbenv-communal-gems removed all my installation directories except for the one of the Ruby version I ran it from.

Tag Latest Version

Hey, nice work on this plugin. I'am wanting to create a homebrew formula for this, but need the latest version to be tagged. Would you mind tagging it up?

"incompatible library version"

I have ruby 2.6.5 and 2.6.6 installed with communized gems. I have noticed I'm getting errors like:

Traceback (most recent call last):
...
.../lib/active_support/dependencies.rb:324:in `require': incompatible library version - .../redcarpet-3.5.0/lib/redcarpet.bundle (LoadError)

Has anyone else been having this trouble? I know it's not caused by this plugin, just wondering if other users are having the same trouble and if the plugin might not work for future versions.

Gem bin files shebang point to a specific ruby binary

I first installed ruby 2.0.0-p0 and installed gems. Then 2.0.0-195 was released, I installed it and eventually removed 2.0.0-p0. All that with the communal gems plugin.

Since the bundle command didn't work anymore, I noticed that (almost) all bin files located in ~/.rbenv/gems/2.0.0/bin have a shebang pointing to a ruby binary, like #!/home/julien/.rbenv/versions/2.0.0-p0/bin/ruby, instead of the generic #! /usr/bin/env ruby.

I suppose that shouldn't happen?

Bins are not found after installing another version

I had installed 1.9.3-p374 and communized all versions. Then, after a while, I installed 1.9.3-p448. RCG said it had done its stuff. Okay.

RBEnv stopped finding the bins. I looked at the other issues (#3, #4), but I'm not sure this is exactly the same thing.

  • rbenv rehash doesn't change anything
  • --env-shebang is there

Here's a bit of debugging around.


jon@panhandle:~/dev-cr/double-serum$ html2haml
rbenv: html2haml: command not found

The `html2haml' command exists in these Ruby versions:
  1.9.3-p374

jon@panhandle:~/dev-cr/double-serum$ ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]
jon@panhandle:~/dev-cr/double-serum$ ls ~/.rbenv/gems/1.9.1/gems/ | grep html
jon@panhandle:~/dev-cr/double-serum$ rbenv shell 1.9.3-p
1.9.3-p374  1.9.3-p448  
jon@panhandle:~/dev-cr/double-serum$ rbenv shell 1.9.3-p374 
jon@panhandle:~/dev-cr/double-serum$ html2haml
<html></html>
%html
jon@panhandle:~/dev-cr/double-serum$ rbenv which html2haml
/home/jon/.rbenv/versions/1.9.3-p374/bin/html2haml
jon@panhandle:~/dev-cr/double-serum$ rbenv which bundle # bundle worked oob
/home/jon/.rbenv/versions/1.9.3-p374/bin/bundle
jon@panhandle:~/dev-cr/double-serum$ rbenv shell 1.9.3-p448 
jon@panhandle:~/dev-cr/double-serum$ rbenv rehash 
jon@panhandle:~/dev-cr/double-serum$ html2haml
rbenv: html2haml: command not found

The `html2haml' command exists in these Ruby versions:
  1.9.3-p374

jon@panhandle:~/dev-cr/double-serum$ cat ~/.gemrc
cat: /home/jon/.gemrc: No such file or directory
jon@panhandle:~/dev-cr/double-serum$ cat ~/.rbenv/versions/1.9.3-p448/etc/gemrc
# added by rbenv communize
install: "--env-shebang"
gemhome: "/home/jon/.rbenv/gems/1.9.1"
jon@panhandle:~/dev-cr/double-serum$ gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2013-06-27 patchlevel 448) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/jon/.rbenv/gems/1.9.1
  - RUBY EXECUTABLE: /home/jon/.rbenv/versions/1.9.3-p448/bin/ruby
  - EXECUTABLE DIRECTORY: /home/jon/.rbenv/gems/1.9.1/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/jon/.rbenv/gems/1.9.1
     - /home/jon/.gem/ruby/1.9.1
     - /home/jon/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "install" => "--env-shebang"
     - "gemhome" => "/home/jon/.rbenv/gems/1.9.1"
  - REMOTE SOURCES:
     - http://rubygems.org/
jon@panhandle:~/dev-cr/double-serum$ ls ~/.rbenv/gems/1.9.1/bin/
bundle  camping  forward  ghi  guard  pry  rails  sprockets  yard  yardoc  yri
jon@panhandle:~/dev-cr/double-serum$ cat ~/.rbenv/plugins/rbenv-communal-gems/.git/refs/heads/master 
cbc18bc791b3a25a6b1df27e256d02b9695bb537
jon@panhandle:~/dev-cr/double-serum$ rbenv communize --all
Gems for 1.9.2-p290 are already communal
Gems for 1.9.3-p374 are already communal
Gems for 1.9.3-p448 are already communal
Gems for 2.0.0-p247 are already communal

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.