如何告诉bundler使用已安装的mswin32版本的gem?

时间:2010-10-19 10:22:21

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

我做了:

gem install hpricot --platform=mswin32

当我执行gem list时正确列出:

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.0)
actionpack (3.0.0)
activemodel (3.0.0)
activerecord (3.0.0)
activeresource (3.0.0)
activesupport (3.0.0)
arel (1.0.1)
builder (2.1.2)
bundler (1.0.0)
columnize (0.3.1)
erubis (2.6.6)
hpricot (0.8.2 x86-mswin32)
i18n (0.4.1)
mail (2.2.6.1)
mime-types (1.16)
minitest (1.6.0)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack-test (0.5.6)
rails (3.0.0)
railties (3.0.0)
rake (0.8.7)
rd_searchlogic (3.0.0.rc3)
rdoc (2.5.8)
sqlite3-ruby (1.3.1 x86-mingw32)
thor (0.14.2)
treetop (1.4.8)
tzinfo (0.3.23)

bundle install仍尝试安装和编译具有原生扩展名的版本:

Installing hpricot (0.8.2) with native extensions C:/Documents and Settings/matt/.pik/rubies/Ruby-192dev-preview3-1/lib/ruby/site_ruby/1.9.1/rubygems/insta
ller.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem
 native extension. (Gem::Installer::ExtensionBuildError)

如何告诉它使用mswin32?

1 个答案:

答案 0 :(得分:2)

您只需要添加选项:platforms => :mswin

gem 'hpricot', :platforms => :mswin