5

最近、自分のマシンでmysqlをアップグレードしました。その結果、それに応じてmysql2gemを更新しようとしています。その過程で、「バンドルインストール」を実行しましたが、何らかの理由で、Gemfile内のすべてのgemが./mysql2ディレクトリにインストールされていますか?

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ディレクトリにバンドルインストールするのはこれが2回目なので、より深い穴を掘る前に停止することにしました)

4

2 に答える 2

13

数週間前に問題が発生したのは、実際には非推奨の動作です。コマンドを実行した可能性があります。このコマンドbundle install mysqlは、実際に実行bundle install --path mysqlされ、インストールディレクトリを./mysql2に永続的に設定します(それが理にかなっている限り)。これを防ぐ最も簡単な方法は、を実行することです。これによりbundle install --system、デフォルトのインストールディレクトリが復元されます。次回、単一のgemをアップグレードする場合は、コマンドを使用しますbundle update mysql

于 2011-07-21T02:27:05.617 に答える
0

すべてをmysql2フォルダーにインストールする理由はわかりませんが、実行方法に戻すには、次のようにします。bundle install --path vendor

これで、mysql2フォルダーを安全に削除できるようになり、gemが本来あるべき場所に配置されます。うまくいけば、他の誰かがそれが他のフォルダにインストールされた理由を説明できるでしょう。

于 2011-07-21T02:19:39.297 に答える