把ruby.gem文件放在哪里以便Shoes.setup可以找到它们? [英] Where to put ruby .gem files so that Shoes.setup can find them?
问题描述
关于鞋子的宝石支持有很多问题,但没有人回答将它们放在哪里。我在Windows XP上安装了Shoes Raisins 1134,并且我已经下载了 dbi-0.4.1.gem
,并试图让以下工作成功:
Shoes.setup do
gem'dbi'
end
需要'dbi'
Shoes.app
...
结束
当我运行这个命令时,我得到一个对话框,其中显示安装dbi - 寻找dbi
,它几个小时没有找到gem文件。我试过把它放在以下所有地方都无济于事:
- 包含上述脚本的文件夹
- D:\ Program Files \ Common Files \Shoes\0.r1134\ruby\gems
- D:\ Program Files \ Common Files \Shoes\0.r1134\ruby\gems\1.8\gems
哪一个错误 - 文件夹或代码?
编辑 - 答案:
感谢@Pesto提供的答案。我已经阅读了引用的文字,但误解了它引用的地方在哪里放置已安装的gem文件,而不是放在哪里,以获得宝石来源。在Windows XP中,引用转换为%USERPROFILE%\Application Data\Shoes
,安装完美运行。现在开始玩吧...
代码看起来很好。例如,这只是桃色:
Shoes.setup do
gem'RedCloth'
end
需要'RedCloth'
Shoes.app do $ b $ para RedCloth.new('* awesome *')。to_html
end
至于宝石的安装位置,_why自己回答此问题:
通过将您的宝石列表放入
Shoes.setup块,如果任何宝石恰好是
缺席,您将最终收到
遇到Shoes popup弹出的
。宝石安装在
〜/ .shoes中,以避免需要超级用户
权限。 (只是为了让鞋子远离
从与你正常的Ruby
的东西混在一起。)
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 ...
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.)
这篇关于把ruby.gem文件放在哪里以便Shoes.setup可以找到它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!