查找封装在 Rails3 应用程序中的 Gem 或插件代码 [英] Lookup Gem or Plugin code packaged in a Rails3 application

查看:28
本文介绍了查找封装在 Rails3 应用程序中的 Gem 或插件代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Rails2 世界中,人们可以方便地浏览应用程序打包的插件或 gems 的代码.使用 Rails3,所有打包的 gem 都存储为 .gem,因此不可浏览或搜索.现在我必须在外部使用 'bundle open [gem]' 来浏览 gem/插件代码.有没有人有更好的技术来立即查找或读取 gem/插件代码

In the Rails2 world, one could conveniently browse the code of plugins or gems packaged with the app. With Rails3, all the packaged gems are stored as .gem and hence are not browsable or searchable. Now I have to use 'bundle open [gem]' externally to browse gem/plugin code. Does anyone have a better technique to lookup or read gem/plugin code instantly

推荐答案

如果安装了gemedit"gem,也可以使用gem edit [gem]打开指定gem的源码.但是,gem edit 不考虑包(我猜它只搜索本地 gem 主页),因此包打开可能是 Rails 3 应用程序中更好的命令.

If you install the "gemedit" gem, you can also use gem edit [gem] to open the source of the specified gem. However, gem edit doesn't take bundles into account (I guess it only searches the local gem home), so bundle open is probably the better command within a Rails 3 app.

如果您想将应用程序的所有 gem 保存在一个目录中,您可能需要尝试将应用程序包安装到一个单独的目录中,例如 bundle install myBundleDir --disable-shared-gems.这会将所有必需的 gem 安装到 myBundleDir 中,忽略系统 gem,因此您将在此目录中拥有运行您的应用程序的每段代码.

If you want to keep all gems for an app inside a single directory, you might want to try installing the bundle for the app into a separate directory like with bundle install myBundleDir --disable-shared-gems. This will install all required gems into myBundleDir, ignoring system gems, so you'll have every piece of code that runs your app inside this directory.

这篇关于查找封装在 Rails3 应用程序中的 Gem 或插件代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆