在Windows XP中安装Ruby Curb gem

Mat*_*lfe 8 ruby curl windows-xp libcurl

我正在尝试使用ruby 1.8进行文件上传,似乎没有好的开箱即用的解决方案.他们似乎都需要一些第三方补丁或项目的分支才能工作.我会使用机械化,但实际上我需要与xml api接口,而机械化似乎专门用于直接处理网页.我已经尝试过RestClient,但它没有开箱即用的多部分表单的功能,你必须使用项目的分支才能使它工作.类似的情况似乎存在于Net:HTTP我认为限制将是要走的路,因为我可能想要使用multicurl反正我计划做的其他事情.但是,在我的Windows机器上,我似乎无法安装路边宝石.gem install curb给出了一个错误,说我需要指定curl库所在的位置..我已经尝试将选项传递给extconf但到目前为止没有运气.这是没有任何选项的gem install curb的输出

C:\ruby\lib\ruby\gems\1.8\gems\curb-0.5.4.0>gem install curb
Building native extensions.  This could take a while...
ERROR:  Error installing curb:
        ERROR: Failed to build gem native extension.

C:/ruby/bin/ruby.exe extconf.rb
checking for curl-config... no
checking for main() in curl.lib... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/ruby/bin/ruby
        --with-curl-dir
        --without-curl-dir
        --with-curl-include
        --without-curl-include=${curl-dir}/include
        --with-curl-lib
        --without-curl-lib=${curl-dir}/lib
        --with-curllib
        --without-curllib
extconf.rb:12:   Can't find libcurl or curl/curl.h (RuntimeError)

  Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
  options to extconf.


Gem files will remain installed in C:/ruby/lib/ruby/gems/1.8/gems/curb-0.5.4.0 for inspection.
Results logged to C:/ruby/lib/ruby/gems/1.8/gems/curb-0.5.4.0/ext/gem_make.out
Run Code Online (Sandbox Code Playgroud)

任何想法我怎么能让这个工作?

phi*_*ggy 18

马特,

我以前在Windows中安装curb gem时遇到了麻烦.在试图了解别人如何解决这个问题时,我遇到了很多问题而不是很多解决方案.今晚必须再做一次我决定记录我的步骤并发布结果:http: //beginrescue.blogspot.com/2010/07/installing-curb-with-ruby-191-in.html

对不起blogspam,希望这对某人有用.

皮特


Mat*_*lfe 1

正如我已经评论过的那样,我确实找到了一个解决方案,只需使用 github gems 中提供的rest-client。gem install rest-client 将完成工作。从那里您可以进行多部分发布,其中可以包含 1 个或多个文件。它具有休息客户端所需的所有灵活性。请参阅此处的文档: http: //rdoc.info/projects/archiloque/rest-client 有关如何使用它的示例。

我发现它唯一不正确的是解析cookie。我公司使用的 cookie 的值可能有等号,但它无法正确解析它们。我已经采取了一些技巧来解决这个问题,但最终还是回来了。所以就在前几天,我开始分析 Mechanize/WEBrick 的代码,并能够利用 Mechanize 的 CookieJar 来管理其余的 cookie -client ..希望我能让rest-client的作者将此功能构建到rest-client中,这样其他人就不会遇到我遇到的相同问题..