Rails 3:使用内部插件系统创建应用程序
我想在 Rails 中创建一个带有插件系统的应用程序。潜在用户应该能够上传(或者更好地从存储库安装)插件并安装它,使我的应用程序能够执行更多操作。这应该在没有 FTP/SSH/任何对服务器的低级访问的情况下完成。
那么是否有关于如何在 Rails 3 中完成此操作的优秀教程或教程?
I want to create an application in Rails with plugin system. Potential user should be able to upload (or better install from repository) a plugin and install it enabling my application to do something more. This should be done WITHOUT FTP/SSH/any low-level access to server.
So are there any good gems or tutorials on how it should be done in Rails 3?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您看过http://edgeguides.rubyonrails.org/plugins.html吗?
它似乎并不与 Rails 3 100% 兼容,但它可以帮助您入门。我见过的大多数插件文章都涉及 Rails 2。
Have you looked at http://edgeguides.rubyonrails.org/plugins.html?
It doesn't seem to be 100% compatible with Rails 3 but it can get you started. Most of the plugin articles I've seen cover Rails 2.
事实上,我自己最近才想到了一个可靠的概念。您想查看
$SAFE
,rubys 污染机制,并了解有关 eval()ing ruby 代码的安全隐患的所有信息(如果您计划允许用户在 ruby 中编写插件)。如果您信任您的用户,可以放心地允许他们这样做,那就是了。
还有许多关于Ruby 中的沙箱<的资源(宝石、文章、谷歌搜索) /a> - 您应该自己评估这些方法的实用性和/或安全性。
如果您根本不信任用户,您应该查看 用 ruby 编写自己的 DSL 或实现其他表达功能的方式,而不直接执行用户提交的代码。
正确地做这样的事情并不是一件容易的事。
I actually just recently thought about a solid concept for this myself. You want to look at
$SAFE
, rubys tainting mechanisms and learn all about the security implications of eval()ing ruby code, if you plan on allowing the user to write their plugins in ruby.If you trust your users to the point of confidently allowing them to do this, that is.
There are also many resources (gems, articles, do the googling) on sandboxing in Ruby - you should evaluate for yourself how practicable and/or safe these are.
If you do not trust the user at all, you should look into writing your own DSL in ruby or implementing other means of expressing functionality without executing user submitted code directly.
Doing something like this properly is no easy task.