Where to put ruby .gem files so that Shoes.setup can find them?

六眼飞鱼酱① 提交于 2020-01-02 05:58:08

问题


A lot of questions have been asked about gem support in Shoes, but none have answered where to put them. I've got Shoes Raisins 1134 on Windows XP, and I've downloaded dbi-0.4.1.gem and am trying to get the following to work:

Shoes.setup do
  gem 'dbi'
end

require 'dbi'

Shoes.app 
  ...
end

When I run this, I get the dialog that says Installing dbi -- Looking for dbi which sits for hours not finding the gem file. I've tried putting it in all of the following places to no avail:

  • The folder that contains the above script
  • D:\Program Files\Common Files\Shoes\0.r1134\ruby\gems
  • D:\Program Files\Common Files\Shoes\0.r1134\ruby\gems\1.8\gems

Which is wrong -- the folder or the code?

EDIT - ANSWER:

Thanks to @Pesto for the answer. I had read the quoted text, but misunderstood it to reference where Shoes PUT the installed gem files, not where it GOT the gem source. In Windows XP, the reference translates to %USERPROFILE%\Application Data\Shoes, and the install worked perfectly. Now to start playing with it ...


回答1:


The code looks fine. For example, this is just peachy:

Shoes.setup do
  gem 'RedCloth'
end

require 'RedCloth'

Shoes.app do
  para RedCloth.new('*awesome*').to_html
end

As to where the gems are installed, _why himself answers this:

By putting your gem list in the Shoes.setup block, you’ll end up encountering the Shoes popup seen above if any of the gems happens to be absent. Gems are installed in ~/.shoes, to avoid needing superuser rights. (And just to keep Shoes away from messing with your normal Ruby stuff.)




回答2:


Anytime you have trouble checking whether shoes is able to find the gem or not, You can see the gems available to shoes at ~/.shoes/+gem/gems



来源:https://stackoverflow.com/questions/825331/where-to-put-ruby-gem-files-so-that-shoes-setup-can-find-them

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!