2011-07-21 78 views
5

我最近在我的機器上升級了mysql。因此,我試圖相應地更新我的mysql2寶石。在這樣做的過程中,我運行「bundle install」,出於某種原因,我的Gemfile中的所有gem都安裝在./mysql2目錄中?Bundle安裝在./mysql2文件夾中安裝gems

ruby-1.9.2-p180 [dev]:project.git$ bundle install 
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. 
Gem.source_index called from /Users/al/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:3. 
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. 
Gem.source_index called from /Users/al/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/source.rb:162. 
NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01. 
Gem::SourceIndex#each called from /Users/al/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/source.rb:162. 
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. 
Gem.source_index called from /Users/al/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/source.rb:162. 
NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01. 
Gem::SourceIndex#each called from /Users/al/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.10/lib/bundler/source.rb:162. 
Fetching source index for http://rubygems.org/ 
Installing rake (0.8.7) 
Installing ZenTest (4.5.0) 
Installing abstract (1.0.0) WARNING: abstract-1.0.0 has an invalid nil value for @cert_chain 

Installing activesupport (3.0.7) 
Installing builder (2.1.2) WARNING: builder-2.1.2 has an invalid nil value for @cert_chain 

Installing i18n (0.5.0) 
Installing activemodel (3.0.7) 
Installing erubis (2.6.6) 
. 
. 
. 
Installing typhoeus (0.2.4) with native extensions 
Installing webrat (0.7.3) 
Installing will_paginate (2.3.15) 
Your bundle is complete! It was installed into ./mysql2 

出於某種原因,也是我.bundle目錄中包含一個配置文件,指示BUNDLE_PATH是mysql2?我不知道這個從或者它如何到達那裏傳來......

ruby-1.9.2-p180 [dev]:project.git$ ls 
Gemfile  README  app  config.ru doc  log  mysql2  script  test 
Gemfile.lock Rakefile config  db  lib  misc  public  spec  vendor 
ruby-1.9.2-p180 [dev]:project.git$ ls -a 
.  .git  Gemfile  Rakefile config.ru lib  mysql2  spec 
..  .gitignore Gemfile.lock app  db  log  public  test 
.bundle  .rspec  README  config  doc  misc  script  vendor 
ruby-1.9.2-p180 [dev]:project.git$ cd .bundle 
ls 
ruby-1.9.2-p180 [dev]:.bundle$ ls 
config 
ruby-1.9.2-p180 [dev]:.bundle$ cat config 
--- 
BUNDLE_DISABLE_SHARED_GEMS: "1" 
BUNDLE_PATH: mysql2 

這裏是我的Gemfile:

source 'http://rubygems.org' 

gem 'rake' 
gem 'rails' 
gem 'mysql2', '0.2.6' 
gem 'legacy_data' 
gem 'htmlentities' 
gem 'httparty' 
gem 'net-ssh' 
gem 'net-sftp' 
gem 'rsolr' 
gem 'activerecord-import' 
gem 'ar-extensions' 
gem 'typhoeus' 
gem 'composite_primary_keys' 
gem 'devise' 
gem 'authlogic' 
gem 'will_paginate' 
gem 'json_pure' # Note that installing the 'json' gem results in a "[BUG] unknown type 0x22 (0xc given)" error when loading rails console 
gem "friendly_id", "~> 3.2.1" 

# Use unicorn as the web server 
# gem 'unicorn' 

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+) 
# gem 'ruby-debug' 
# gem 'ruby-debug19' 

# Bundle the extra gems: 
# gem 'bj' 
# gem 'nokogiri' 
# gem 'sqlite3-ruby', :require => 'sqlite3' 
# gem 'aws-s3', :require => 'aws/s3' 

# Gems for RSpec 
# Bundle gems for the local environment. Make sure to 
# put test-only gems in this group so their generators 
# and rake tasks are available in development mode: 
group :search_development, :test do 
    gem 'rspec-rails', "~> 2.4" 
    gem 'webrat' 
    gem 'rspec' 
end 

gem 'autotest' 

我一直在紡紗我的車輪在這一段時間。如有任何想法或想法,請提前致謝。 (另外,這是我捆綁安裝到mysql2目錄中的第二次,所以我決定在我挖掘更深的洞之前立即停止)

+0

cat ./bundle/config – Anatoly

回答

13

這實際上是過時的行爲,我幾個星期前遇到了問題。很可能你運行了命令bundle install mysql,該命令實際上運行了bundle install --path mysql並永久性地將其安裝目錄設置爲./mysql2(儘可能少)。解決這個問題的最簡單方法是運行bundle install --system,這應該還原您的默認安裝目錄。下一次,如果您想升級一顆寶石,請使用命令bundle update mysql

+0

謝謝。捆綁安裝 - 系統做了竅門。乾杯。 – Sly

+2

此外,re @mikhailov評論,可以'rm。/ bundle/config'然後重新運行'bundle install',它會自行更正! –

+0

有狀態的命令行工具:似乎是一個壞主意。由於這個問題,將我的大腦和SO/Google擱置了30分鐘。這在Ruby世界中很常見嗎? –

0

我不確定爲什麼它將所有安裝到mysql2文件夾,但要回到它應該如何運行這個:bundle install --path vendor

然後,你應該能夠安全地刪除mysql2文件夾,你的寶石將成爲他們應該在的地方。希望其他人能夠解釋爲什麼它安裝到其他文件夾。