0

RedclothをGemファイルに追加しようとしていますが、「bundle install」を実行すると、次のようになります。

ネイティブ拡張機能を使用したRedCloth(4.2.6)のインストール/home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in `rescue in build_extensionsのブロック':エラー:gemネイティブ拡張のビルドに失敗しました。(Gem :: Installer :: ExtensionBuildError)

        /home/user/.rvm/rubies/ruby-1.9.2-p136/bin/ruby extconf.rb

Gemファイルは、検査のために/home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/RedCloth-4.2.6にインストールされたままになります。
結果は/home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/RedCloth-4.2.6/ext/redcloth_scan/gem_make.outに記録されました
    /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:507:in `block in build_extensions '
    /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in `each '
    /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:482:in `build_extensions '
    /home/user/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:156:in`install'から
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/source.rb:96:in`install'から
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/installer.rb:55:in `block in run '
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `block in each '
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each '
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each '
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run '
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in`install'から
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install '
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run '
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task '
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch '
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start '
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/gems/bundler-1.0.10/bin/bundle:13:in` '
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/bin/bundle:19:in`load'から
    /home/user/.rvm/gems/ruby-1.9.2-p136@vendorguide/bin/bundle:19:in` '

「geminstallRedCloth」を実行してから「bundleinstall」を実行すると機能しますが、実際にモデル「Vendor.rb」でRedClothを使用しようとすると、次のようになります。

初期化されていない定数Vendor::RedCloth

これが私のgemfileです:

gem'rails'、 '3.0.3'


gem "compass"、 "> = 0.10.6"

宝石「haml」
宝石'formtastic'

gem'devise'、:git =>'git://github.com/plataformatec/devise.git'、:branch =>'master'
gem'oa-oauth'、:require => "omniauth / oauth"
宝石'モーグリ'
宝石'ダリ'
宝石'例外的'
宝石'json'
宝石「RedCloth」

グループ:test、:development do
  gem "ruby-debug19"
  gem "rspec-rails"、 "〜> 2.4"
  gem'sqlite3-ruby'、:require =>'sqlite3'
  宝石'hpricot'
  gem'ruby_parser'
  gem'heroku'
  宝石「フルーティ」
終わり

グループ:test do
  宝石'キュウリ-レール'
  宝石'capybara'
  gem'database_cleaner'
  ジェム'モカ'
  gem'factory_girl_rails'
  宝石'shoulda'
  宝石'ZenTest'
  宝石'fakeweb'
終わり

そして、これが私のモデルです:

クラスベンダーActiveRecord::Base
  has_many:reviews
  所属する:user

  validates_presence_of:name
  validates_presence_of:description

  before_save:convert_text

  def convert_text
    self.description = RedCloth.new(self.description).to_html(self.description.nilでない限り)?
    self.services_description = RedCloth.new(self.services_description).to_html(self.services_description.nilでない限り)?
    self.clients_description = RedCloth.new(self.clients_description).to_html(self.clients_description.nilでない限り)?
    self.pricing_description = RedCloth.new(self.pricing_description).to_html(self.pricing_description.nilでない限り)?
    self.press = RedCloth.new(self.press).to_html(self.press.nilでない限り)?
  終わり
終わり

前もって感謝します。

4

1 に答える 1

0

これは、今朝RedClothで発生した問題に関連している可能性があります。

また、RedClothのバージョン4.2.6をインストールしたところ、何をしてもSinatraアプリで使用できませんでした。(同様のエラーがたくさん発生しUninitialized constant RedClothました。)ただし、RedClothサイト(http://redcloth.org/)によると、最新の安定バージョンは4.2.2のみです。

4.2.6をアンインストールして4.2.2をインストールしましたが、完全に機能しました。

Gemfileに制限を追加してみてください。gem 'RedCloth', '4.2.2'

于 2011-02-11T15:20:17.287 に答える