为什么Bundler在使用Puppet Installed RVM进入项目目录后会消失

时间:2015-04-08 16:42:49

标签: rubygems rvm vagrant bundler puppet

这个令人讨厌/困惑。

tl; dr bundler gem在进入rvm托管项目目录后从gem列表中消失,手动切换到指定的ruby使其重新出现,是什么给出了?

我的目标基本上是安装一些rubies,并且可以访问全局gemsets中的bundler,这样我就可以快速启动我喜欢的配置开发盒。有关的完整源代码可在此处获取:https://github.com/neverstopbuilding/talon

安装似乎工作正常,但是,当我克隆了一个特定项目,然后cd进入该目录时,突然捆绑器从gem列表中消失,我无法运行bundle install,这里有一些输出来自只是一个普通的项目目录:

/vagrant/home/clients: rvm list

rvm rubies

   ruby-2.0.0-p643 [ x86_64 ]
=> ruby-2.1.5 [ x86_64 ]
 * ruby-2.2.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

/vagrant/home/clients: ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]

/vagrant/home/clients: gem list

*** LOCAL GEMS ***

bigdecimal (1.2.4)
bundler (1.9.2)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
io-console (0.4.2)
json (1.8.1)
minitest (4.7.5)
psych (2.0.5)
rake (10.1.0)
rdoc (4.1.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (2.1.5.0)

好的,这很好,现在当我进入2.1.5文件中只有.ruby-version的实际项目目录时,运行相同的命令,我明白了:

/vagrant/home/clients/my_client/my_project (master): rvm list

rvm rubies

   ruby-2.0.0-p643 [ x86_64 ]
=> ruby-2.1.5 [ x86_64 ]
 * ruby-2.2.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

/vagrant/home/clients/my_client/my_project (master): ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
/vagrant/home/clients/my_client/my_project (master): gem list

*** LOCAL GEMS ***

bigdecimal (1.2.4)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
io-console (0.4.2)
json (1.8.1)
minitest (4.7.5)
psych (2.0.5)
rake (10.1.0)
rdoc (4.1.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (2.1.5.0)

请注意上面列表中缺少bundler,当然运行它会产生zsh: command not found: bundle

奇怪的是,如果我手动运行`rvm使用2.1.5并列出宝石,我确实得到了捆绑器,我能够运行bundle命令。

为什么这个特定的宝石在进入这个项目时不会自动加载?我该如何解决它...自动化所有这些东西似乎很愚蠢但仍然需要手动运行命令才能完成的东西。

其他相关信息

外部项目目录:

: echo $PATH
/usr/local/rvm/gems/ruby-2.1.5/bin:/usr/local/rvm/gems/ruby-2.1.5@global/bin:/usr/local/rvm/rubies/ruby-2.1.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/vagrant/bin:/usr/local/bin::/usr/local/rvm/bin


gem env

/usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/commands/environment_command.rb:151: warning: Insecure world writable dir /vagrant/home/clients/ in PATH, mode 040777
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.6
  - RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-2.1.5
  - RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-2.1.5/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-2.1.5/bin
  - SPEC CACHE DIRECTORY: /home/vagrant/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/rvm/rubies/ruby-2.1.5/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/rvm/gems/ruby-2.1.5
     - /usr/local/rvm/gems/ruby-2.1.5@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - :benchmark => false
     - "gem" => "--no-ri --no-rdoc"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/rvm/gems/ruby-2.1.5/bin
     - /usr/local/rvm/gems/ruby-2.1.5@global/bin
     - /usr/local/rvm/rubies/ruby-2.1.5/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games
     - /home/vagrant/bin
     - /usr/local/bin
     -
     - /usr/local/rvm/bin

项目目录内:

: echo $PATH
/usr/local/rvm/gems/ruby-2.1.5@my_project/bin:/usr/local/rvm/gems/ruby-2.1.5@global/bin:/usr/local/rvm/rubies/ruby-2.1.5/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/vagrant/bin:/usr/local/bin:


: gem env
/usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/commands/environment_command.rb:151: warning: Insecure world writable dir /vagrant/home/clients/my_client/my_project/ in PATH, mode 040777
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.6
  - RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-2.1.5@my_project
  - RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-2.1.5/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-2.1.5@my_project/bin
  - SPEC CACHE DIRECTORY: /home/vagrant/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/rvm/rubies/ruby-2.1.5/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/rvm/gems/ruby-2.1.5@my_project
     - /usr/local/rvm/gems/ruby-2.1.5@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - :benchmark => false
     - "gem" => "--no-ri --no-rdoc"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/rvm/gems/ruby-2.1.5@my_project/bin
     - /usr/local/rvm/gems/ruby-2.1.5@global/bin
     - /usr/local/rvm/rubies/ruby-2.1.5/bin
     - /usr/local/rvm/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games
     - /home/vagrant/bin
     - /usr/local/bin

0 个答案:

没有答案