私は本当に奇妙な問題を抱えています。LoadErrorは:pathまたは:gitでgemを要求することで
githubで宝石をフォークして、ローカルマシンで自分のリポジトリをクローンし、変更して、別のプロジェクトのGemfileを変更してテスト用のローカルリポジトリから宝石を取得しました。残念ながら私はルビスクリプトでその宝石を要求している間にLoadErrorを取得します。
rvm current => ruby-1.9.3-p448
ruby --version => ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]
bundle --version => Bundler version 1.3.5
私のGemfileの内容:
source 'http://rubygems.org
gem 'steps', :path => "/home/benny/workspace/steps"
バンドル出力:
$ bundle --no-cache
Resolving dependencies...
Using colored (1.2)
Using highline (1.6.19)
Using steps (1.0.2) from source at /home/benny/workspaces/steps
Using bundler (1.3.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ bundle show steps
/home/benny/workspaces/steps
テストIRB作品を経由して罰金:
$ bundle exec irb
1.9.3-p392 :001 > require 'rubygems'
=> false
1.9.3-p392 :002 > require 'steps'
=> true
テストスクリプト経由では動作しません。
$ cat test.rb
require 'rubygems'
require 'steps'
$ ruby test.rb
/home/benny/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- steps (LoadError)
from /home/benny/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from test.rb:2:in `<main>'
私は今非常に混乱しています。私が使用すると同じことが起こります:gitの代わりにgit:ローカルのgitリポジトリまたはgithubリポジトリを持つパス。
アイデア? 前 bundle exec ruby script.rb
またはあなたのスクリプトでバンドラの設定が必要です:あなたは経由バンドラ環境で実行することができますtest.rb
bundle exec ruby test.rb
作品。ありがとうございました! – phortx
うわー私は最後の半時間のために私の頭を傷つけてきた....宝石は罰金をインストールする、バンドラはそれを示していますが、それをロードすることはできません。 ローカル宝石にbundle execを使用する必要がある理由について少し説明してください。 – BlackDivine