I've installed the Curb and Curb-fu gem and libcurl on my Ubuntu box.
If I go into irb and run the following
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'curb'
=> true
irb(main):003:0> require 'json'
=> true
irb(main):004:0> require 'curb-fu'
=> true
irb(main):005:0>
So it seems that I have access to all the gems.
But I've created a very simple ruby app that's giving me an error:
#!/usr/bin/ruby
require 'rubygems'
require 'curb'
require 'json'
require 'curb-fu'
response = CurbFu.get('http://slashdot.org')
puts response.body
I get the following error back.
/usr/lib/ruby/gems/1.8/gems/curb-fu-0.4.4/lib/curb-fu/authentication.rb:3: uninitialized constant CurbFu::Authentication::Curl (NameError)
I have a feeling it's something to do with libcurl and have tried several different versions but still no joy.
Can anyone offer any assistance?
Cheers
Togs
I managed to get it to work.
I uninstalled both the curb and curb-fu gem and re-installed them.
I now have curb-fu working.
For future reference for anyone having problems with this.. these are the libcurl bits I installed.
libcurl3
libcurl3-gnutls
libcurl4-openssl-dev
Related
I'm trying to run an application that uses rest-client version 2.0.1, however when I run the application I'm getting
/opt/whitewidow/lib/imports/constants_and_requires.rb:6:in require': cannot load such file -- rest-client (LoadError) from /opt/whitewidow/lib/imports/constants_and_requires.rb:6:in<top (required)>'
from whitewidow.rb:2:in require_relative' from whitewidow.rb:2:in
What I've tried to do is edit the code to use restclient instead of rest-client but that just throws the same issue, I tried install a version lower with gem install rest-client -v 2.0 I get the same error.
Now here's the weird part, the application runs on Windows 7, but not on a Debian distro, is there a trick to running rest-client on a Linux distro? here's all the requirements:
require 'rubygems'
require 'bundler/setup'
require 'mechanize'
require 'nokogiri'
require 'rest-client'
require 'timeout'
require 'uri'
require 'fileutils'
require 'yaml'
require 'date'
require 'optparse'
require 'tempfile'
require 'socket'
require 'net/http'
require 'ipaddr'
require 'csv'
If you bundled the application on windows it will not execute properly. This is because it compiles with the windows binaries.
Try deleting your Gemfile.lock and rebundling.
I am using ruby version 2.0.0, and Using soap4r (1.5.8).
But i couldn't able to load require "soap/wsdlDriver".
I am trying to use with in rails console,
irb(main):001:0> require 'soap/rpc/driver'
=> false
irb(main):002:0> require 'soap/rpc/driver'
=> false
irb(main):003:0> require "soap/wsdlDriver"
=> false
The standard soap library was removed from Ruby. You will need to find an other solution. Perhaps this gem: https://rubygems.org/gems/soap4r-ruby1.9
Or you refactor you code to use a more up-to-date client. Find a list here: https://www.ruby-toolbox.com/categories/soap
I am using bundler to require all the gems in my project. However, it's not working for yaml/logger.
If I add gem 'yaml' to my gemfile, and run bundle install, I get:
Could not find gem 'yaml (>= 0) ruby' in the gems available on this machine.
But I require it normally just fine. What am I doing wrong?
Thanks
YAML is part of the Ruby Standard Library, and not a Gem.
You do not need to add it to your Gemfile, just require it.
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> YAML
=> Psych
The same applies for Logger.
I have successfully installed:
Ruby 1.8.7-p334
Rubygems 1.7.2
rake 0.9.0
qtruby4 2.1.0 mswin32
Now the following block of code
require 'rubygems'
require 'Qt4'
gives me an error:
C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:926:in report_activate_error': RubyGem version error: qtruby4(2.1.0 not >= 0) (Gem::LoadError)
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:244:inactivate_dep'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:236:in activate'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems.rb:213:intry_activate'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:56:in `require'
from C:/Users/nick/Documents/NetBeansProjects/RubyApplication2/lib/main.rb:4
Everything good when requiring just 'rubygems'. My OS is Windows 7.
Make sure you require correct gem name
require 'Qt4' seems like little different as almost all the ruby gem names are in simple letters
isnt your gem name 'qtruby4' by any chance, if so try
require 'rubygems'
require 'qtruby4'
HTH
sameera
Specifically, the ruby-oci8 gem. I have both 1.0.7 and 2.0.4 installed. I want 1.0.7.
I can just require oci8, but I don't get the version I want.
irb(main):001:0> require 'oci8'
=> true
irb(main):002:0> OCI8::VERSION
=> "2.0.4"
I can require using the full path to the file, which works, but is not going to be portable:
irb(main):001:0> require 'C:\Ruby\lib\ruby\gems\1.8\gems\ruby-oci8-1.0.7-x86-mswin32-60\lib\oci8'
=> true
irb(main):002:0> OCI8::VERSION
=> "1.0.7"
I can use the gem command to ask for the version I want, but it doesn't appear to actually load the library:
irb(main):001:0> gem 'ruby-oci8', :lib=>'oci8', :version=>'=1.0.7'
=> true
irb(main):002:0> OCI8::VERSION
NameError: uninitialized constant OCI8
from (irb):2
I would definitely favor this last approach if would load the library, rather than just confirming that it's present on my system. What am I missing?
My problem was twofold:
1) confusing gem command syntax with that used in config.gem lines in a rails environment.rb configuration file.
2) failing to issue a require command after the gem command.
Proper usage in a script is:
gem 'ruby-oci8', '=1.0.7'
require 'oci8' # example is confusing; file required (oci8.rb) is not
# same name as gem, as is frequently the case
Proper usage in a rails 2.3.x environment.rb file is:
config.gem "ruby-oci8", :version=>'1.0.7'
Thanks to the folks at http://www.ruby-forum.com/topic/109100
Try the following syntax (instead of require):
require_gem 'RMagick' , '=1.10'
require_gem 'RMagick' , '>=1.10'
require_gem 'rake', '>=0.7.0', '<0.9.0'