【问题标题】:Installing RedCloth gem from github with bundler使用 bundler 从 github 安装 RedCloth gem
【发布时间】:2011-08-08 13:41:20
【问题描述】:

我在使用 RedCloth gem 的最新版本 4.2.7 时遇到了问题。具体来说,这是在 this commit 中解决的 gcc 4.6 编译问题,但尚未包含在发布中,尽管它是在很久以前提交的。

在我的 Gemfile 中,我改变了这个:

gem 'RedCloth', '4.2.7'

到这里:

gem 'RedCloth', :git => 'git://github.com/jgarber/redcloth.git'

但是,当我运行 bundle install 时,我最终会收到一条警告消息,内容如下:

RedCloth at /Users/mhuggins/.rvm/gems/ruby-1.9.2-p180@myapp/bundler/gems/redcloth-9d6d28f93b02 did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
  ["ext/redcloth_scan/redcloth_attributes.c", "ext/redcloth_scan/redcloth_inline.c", "ext/redcloth_scan/redcloth_scan.c"] are not files

看起来 redcloth.gemspec 的 this line 试图包含 3 个在源代码树中不存在的文件,这就是导致错误的原因。

有人知道我这里发生了什么吗?我一定是错过了一个步骤或什么的。 (我在 OS X 上使用 Rails 3.1 edge。)

【问题讨论】:

  • 看起来这些文件是在创建 gem 之前使用 Ragel 生成的。您可能需要创建 Redcloth 的本地克隆并自己编译。
  • 使用 bundler/capistrano 容易吗?

标签: git gem ruby-on-rails-3.1 redcloth gemspecs


【解决方案1】:

尝试运行“bundle config build.RedCloth --with-cflags=-w”,然后运行“bundle install”。

【讨论】:

    【解决方案2】:

    这有点繁琐,但我能够使用以下命令在 mac os x snow leopard 上获得 Gemfile 的 git 版本...

    在您的项目中:

    bundle install
    

    您会收到如下错误消息:

    RedCloth at /Users/kunzmann/.rvm/gems/ruby-1.9.2-p290/bundler/gems/redcloth-9d6d28f93b02 did not have a valid gemspec.
    

    如果你有 Ragel 6.3 或更高版本(我使用brew install Ragel),那么你可以这样做

    cd /Users/kunzmann/.rvm/gems/ruby-1.9.2-p290/bundler/gems/redcloth-9d6d28f93b02
    bundle install
    bundle exec rake compile
    

    下次您在项目中bundle install 时,您应该会看到:

    Using RedCloth (4.2.7) from git://github.com/jgarber/redcloth.git (at master) with native extensions
    

    【讨论】:

      猜你喜欢
      • 2011-04-20
      • 1970-01-01
      • 1970-01-01
      • 2014-04-02
      • 1970-01-01
      • 2016-08-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多