【问题标题】:How to install gem/plugin in rails3 when not found on rubygems?在 ruby​​gems 上找不到时如何在 rails3 中安装 gem/plugin?
【发布时间】:2011-08-16 01:05:46
【问题描述】:

我想安装 simple-private-messages gem (http://agilewebdevelopment.com/plugins/simple_private_messaging),https://github.com/jongilbraith/simple-private-messages

我已添加到我的 Gemfile:

gem 'simple-private-messages'

但得到错误:

Fetching source index for http://rubygems.org/
Could not find gem 'simple-private-messages (>= 0)' in any of the gem sources listed in your Gemfile.

然后我尝试将 Gemfile 修改为:

gem 'simple-private-messages', :git => 'git://github.com/professionalnerd/simple-private-messages.git'

但得到错误:

Fetching git://github.com/professionalnerd/simple-private-messages.git
github.com[0: 207.97.227.239]: errno=Operation timed out
fatal: unable to connect a socket (Operation timed out)
Git error: command `git clone 'git://github.com/professionalnerd/simple-private-    messages.git' "/Users/homanchou/.rvm/gems/ruby-1.9.2-p180/cache/bundler/git/simple-private-messages-26451211e7d7acc0c1b523bad2621cb2cd38f77e" --bare --no-hardlinks` 

1) 我还能如何在本地安装这个 gem?

2) 如果 Heroku 在任何存储库中都找不到 gem,我如何将此应用程序部署到 heroku 并防止部署错误?我是否将它们提供给应用程序?

【问题讨论】:

    标签: ruby-on-rails-3 github gem bundler


    【解决方案1】:

    该项目看起来不像是宝石;它实际上是一个 Rails 插件。

    要安装,请在您的项目文件夹中运行:

    rails plugin install git://github.com/jongilbraith/simple-private-messages.git
    

    【讨论】:

    • 啊...忘记了那个命令。我认为 Rails 3 使用 Gemfile 和 bundler 代替插件安装,但我想它毕竟还是需要的?我如何区分?
    • 一般来说,如果您在 ruby​​gems.org 上搜索并找不到它,它可能不是 Gem(或至少不是已发布的)。如果您查看 github 存储库,但没有看到 gemspec 文件,那将是另一个迹象。此外,这个特定项目的自述文件确实说将其作为插件安装。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多