Sinatra 可以与 IronRuby 一起使用吗?
我正在尝试在我的 mac 上安装以下 ruby gem:
http://www.sinatrarb.com/ intro.html
我收到以下消息:
michael-rosarios-macbook:bin michaelrosario1$ mono ir.exe igem sinatra
ERROR: While executing gem ... (RuntimeError)
Unknown command sinatra
michael-rosarios-macbook:bin michaelrosario1$
更熟悉 Ruby/IronRuby 的人可以帮我吗?
I'm trying to install the following ruby gem on my mac:
http://www.sinatrarb.com/intro.html
I get the following message:
michael-rosarios-macbook:bin michaelrosario1$ mono ir.exe igem sinatra
ERROR: While executing gem ... (RuntimeError)
Unknown command sinatra
michael-rosarios-macbook:bin michaelrosario1$
Can someone more familiar with Ruby/IronRuby help me out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来我错过了安装 sinatra 的一个参数:
我现在在使用 Sinatra 编写“hello world”示例时遇到问题。 这可能与Shay的评论有关。 还有其他想法吗!?
It appears that I had missed an argument installing sinatra:
I'm now experiencing issues with writing a "hello world" example using Sinatra. This is probably related to Shay's comment. Any other thoughts!?
首先 - 我不熟悉 mono,但在 Windows 上我会在没有 ir 的情况下执行“igem sinatra”。 也许这就是问题所在?
无论如何,如果您在使用 igem 安装 gem 时遇到问题,请尝试使用 MRI gem 安装程序。
之后,您只需稍加调整就可以通过 IronRuby 使用它。
在您的 ruby 文件中添加下一行:
$LOAD_PATH << mri_gems_folder 路径
其中 path_to_mri_gems_folder 是 MRI gems 文件夹的完整路径。
此行之后需要 sinatra。
还有 IronRuby 团队针对 Sinatra 的补丁,我不确定是否还需要:
谢
伊。
First thing - I'm not familiar with mono, but on Windows I would execute "igem sinatra" without ir before that. Maybe that's the problem?
Anyways, if you're having troubles installing the gem using igem, try MRI gem installer instead.
After that you'll be able to use it via IronRuby with a tiny tweak.
On your ruby file add the next line:
$LOAD_PATH << path_to_mri_gems_folder
where path_to_mri_gems_folder would be the full path to the MRI gems folder.
After this line require sinatra.
There is also a patch of the IronRuby team for Sinatra, I'm not sure if it's still needed:
http://www.ironruby.net/Documentation/Real_Ruby_Applications/Sinatra
Shay.