我有一个我创建的宝石并推送到rubygems。我继续下载那个gem来测试我写的相关程序的其他部分,但Ruby似乎无法找到宝石。当我要求获取名为get '/:id', to: "services#show", as: 'show_service', constraints: lambda {|request|
urls = ['a', 'b', 'c']
if urls.include? params[:id]
puts "Yep - this works."
return redirect latest_url
else
# Nothing matches, this service doesn't exist.
return false
end
}
的gem的路径时,我得到以下(预期)输出:
rbtex
当我要求另一个宝石,着色时,我知道它正在工作,我得到了
/usr/local/lib/ruby/gems/2.3.0/gems/rbtex-0.1.0
如果我打开 /usr/local/lib/ruby/gems/2.3.0/gems/colorize-0.7.7
我可以要求colorize gem,但不是rbtex gem:
irb
我不确定为什么一颗宝石可以正常工作但另一颗宝石没有。我正在运行OS X El Captain,我用irb(main):001:0> require 'rbtex'
LoadError: cannot load such file -- rbtex
from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from (irb):1
from /usr/local/bin/irb:11:in `<main>'
irb(main):002:0> require 'colorize'
=> true
irb(main):003:0>
下载了这两个宝石。