I\'m trying to do file uploads with ruby 1.8 and it seems like there are no good out-of-the-box solutions. They all seem to need some 3rd party patch or fork of a project to
Matt,
I've had trouble installing the curb gem in Windows before. In trying to see how others had solved this I came across a lot of questions and not very many solutions. Having to do it again tonight I decided to document my steps and post the results: http://beginrescue.blogspot.com/2010/07/installing-curb-with-ruby-191-in.html
Sorry for the blogspam, hope this is useful for somebody.
pete
As I commented already, I did find a solution which was simply using the rest-client provided in the github gems.. gem install rest-client will get the job done. From there you can do a multipart post which can contain 1 or more files.. It has all the flexibility one could need in a rest-client. See the documentation here: http://rdoc.info/projects/archiloque/rest-client for examples on how to use it.
The only thing I found that it didn't do correctly was parsing cookies. The cookies my company uses can have equal signs in the values and it doesn't parse them correctly. I had put in some hacks to get around the issue but eventually that came back to bite me.. So just the other day I started analyzing the code from Mechanize/WEBrick and was able to utilize the CookieJar from Mechanize to manage cookies from the rest-client.. Hopefully I can get the author of the rest-client to build this functionality into the rest-client so others won't have the same problems I had..
That works too, on Windows 10 x64:
gem install curb -- --with-curl-lib="C:/Users/WindowsVM/binaries/curl-7.40.0-devel-mingw64/lib64" --with-curl-include="C:/Users/WindowsVM/binaries/curl-7.40.0-devel-mingw64/include"
I tried all of the solutions above and nothing worked, I gave up but luckily I later stumbled upon this post http://jooglar.com/edely/content/installing-libcurl-ruby-windows and the instructions there worked perfectly.
Here are the directions, in case the website goes belly up:
1. Download the "libcurl" version of the library
From http://curl.haxx.se/dlwiz/?type=lib
2. Install wherever, but the path cannot have spaces.
Be sure that when you unzip the file, you find the directories “bin” and “include”
3. Add the libcurl path (ending in /bin;) to the system PATH
variable
WARNING: USE /
INSTEAD OF \
in the PATH. No spaces allowed in the path. For example:
C:/curl/curl-7.26.0-devel-mingw32/bin;
4. Install the gem
WARNING: AGAIN, USE /
INSTEAD OF \
in the PATH. See above.
Example command: gem install curb -- --with-curl-lib=C:/curl/curl-7.26.0-devel-mingw32/bin --with-curl-include=C:/curl/curl-7.26.0-devel-mingw32/include
[NB: Note the standalone --
before --with-...
, this was a gotcha for me.]
At this point, it should work. It worked for me. If it doesn't, you could try the rest of the instructions:
If it does not work, copy the following .dll
files to the ruby/bin directory and run again the previous command.
libcurl.dll
libssl32.dll
libeay32.dll
Also, if that does not work...update the DevKit and run again the previous command. Download the latest version and from a console go to the DevKit directory and run
ruby dk.rb install --force
I used Evan's install config in his answer with the correct libcurl binary from the wizard: http://curl.haxx.se/dlwiz/
gem install curb -- --with-curl-lib="C:/curl/curl-7.21.1-devel-mingw32/bin" --with-curl-include="C:/curl/curl-7.21.1-devel-mingw32/include"
This worked for me on win XP 64 bit.
Make sure to select libcurl with the description about being the binary for libcurl software development.
after a lots of time spending on it, I give up...
The answers given above don't work for me, and some of the "curl" links are broken, I can't even download from the official web-site.
what I want is quite simple: install curb gem on cygwin.
Now I switched to VirtalBox, and installed a Ubuntu server on it. then, I install it in 20 minutes without any problems.
So, People working under cygwin, let's switch to Virtual Machine!