I installed RMagick on a Windows system with no apparent problems, but I'm having problems actually using it. In particular:
C:\Users\dancrumb> ruby -rubygems -rRMagick -e "puts Magick::Long_version"
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb:900:in `report_activate_error':
RubyGem version error: rmagick(2.12.0 not >= 0) (Gem::LoadError)
from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb:248:in `activate'
from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb:212:in `rescue in try_activate'
from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb:209:in `try_activate'
from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:57:in `rescue in require'
from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
The main sticking block is the seemingly illogical error message: RubyGem version error: rmagick(2.12.0 not >= 0). Unless I'm missing something, 2.12.0 is most definitely greater than 0.
Some useful information:
C:\Users\dancrumb>gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.6.2
- RUBY VERSION: 1.9.2 (2010-12-25 patchlevel 136) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby192/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: C:/Ruby192/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby192/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/Ruby192/lib/ruby/gems/1.9.1
- C:/Users/dancrumb/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
C:\Users\dancrumb>dir \Ruby192\lib\ruby\gems\1.9.1\gems
Volume in drive C is TI106036W0F
Volume Serial Number is 4432-A499
Directory of C:\Ruby192\lib\ruby\gems\1.9.1\gems
...
03/26/2011 01:34 PM <DIR> rmagick-2.12.0-x86-mswin32
...
03/20/2011 08:06 PM <DIR> rubygems-update-1.6.2
...
The supplied README file and the forums associated with RMagick don't afford any insight.
It gets weirder:
C:\Users\dancrumb>ruby -rubygems -e "gem 'rmagick', '2.12.0'; puts Magick::Long_
version"
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb:900:in `report_activate_error':
RubyGem version error: rmagick(2.12.0 not = 2.12.0) (Gem::LoadError)
from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb:248:in `activate'
from C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems.rb:1276:in `gem'
from -e:1:in `<main>'
As well as the specific question on RMagick, can anyone provide me with a sensible interpretation of the version error... it seems nuts to me, but maybe it is actually conveying something useful... just in a nutso way.
I had the very same problem in Ruby 1.8.7 as you with 1.9.1. This is a way I've resolved it:
Uninstall the rmagick gem if you have it (gem uninstall rmagick)
Download http://rubyforge.org/frs/download.php/64917/RMagick-2.12.0-ImageMagick-6.5.6-8-Q8.zip
Unpack the zip to separate folder (e.g. C:\temp\rmagick)
Install the ImageMagick-6.5.6-8-Q8-windows-dll.exe
Unpack the rmagick-2.12.0-x86-mswin32.gem to separate folder (e.g. C:\temp\rmagick\gem)
Extract the data.tar.gz to separate folder (e.g. C:\temp\rmagick\gem\data)
Open rmagick.gemspec and remove the line with s.platform = "mswin32"
Use "gem build rmagick.gemspec" to build the gem again (a "rmagick-2.12.0.gem" will be generated)
Use "gem install rmagick --local" to install it.
Type the following:
ruby --version
If its output is something like
ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
it means the Ruby was built using mingw32, which was not supported by the RMagick.
Though README.html of RMagick-2.12.0-ImageMagick-6.5.6-8-Q8 package says
Ruby 1.8.6, installed via the One-Click Installer.
in the prerequisites, the latest One-Click Installer is built using mingw32, and that causes the trouble.
Looking at the source code for rubygems, it looks like rmagick might be responding incorrectly to rubygems' queries about its version for some reason; not sure what.
When you don't supply a specific version number, rubygems will fall back on >= 0 as its version_requirements.
Try this instead, to be more explicit, and so the versions match exactly:
ruby -rubygems -e "gem 'rmagick', '2.12.0'; puts Magick::Long_version"
Related
I am using:
TextMate: version 2.0-alpha.9511
rvm: 1.25.15 (stable)
ruby: version 2.1.0p0
oh-my-zshell: 5.0.2
Mac OS X: 10.9.1 (Mavericks)
I have rvm and textmate set up to use
TM_RUBY=/Users/<myuser>/.rvm/bin/rvm-auto-ruby
The problem:
when I try to run my rake tasks using the rake bundle in textmate, I get some errors about the file not loading: "cannot load such file -- rubocop/rake_task"
The clue:
I changed my rakefile so that it simply reports the "gem env" for the default task.
When I then run the task, I see a completely different gem environment, than I would see if I used rake at the terminal command line.
RakeMate v2.0.0
>>> /Users/Johno/Projects/puzzles/triangle/Rakefile
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [universal.x86_64-darwin13]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-13
- GEM PATHS:
- /Library/Ruby/Gems/2.0.0
- /Users/Johno/.gem/ruby/2.0.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
Whereas I see this when running
$ gem env
in my terminal, for my project
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.0.rc.1
- RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [x86_64-darwin12.0]
- INSTALLATION DIRECTORY: /Users/Johno/.rvm/gems/ruby-2.1.0#puzzles
- RUBY EXECUTABLE: /Users/Johno/.rvm/rubies/ruby-2.1.0/bin/ruby
- EXECUTABLE DIRECTORY: /Users/Johno/.rvm/gems/ruby-2.1.0#puzzles/bin
- SPEC CACHE DIRECTORY: /Users/Johno/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-12
- GEM PATHS:
- /Users/Johno/.rvm/gems/ruby-2.1.0#puzzles
- /Users/Johno/.rvm/gems/ruby-2.1.0#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/Johno/.rvm/gems/ruby-2.1.0#puzzles/bin
- /Users/Johno/.rvm/gems/ruby-2.1.0#global/bin
- /Users/Johno/.rvm/rubies/ruby-2.1.0/bin
- /Users/Johno/.rvm/bin
- /usr/local/bin
- /Users/Johno/Projects/Scripts/Ruby
- /Users/Johno/Projects/Scripts/bash
- /Users/Johno/Projects/Scripts/perl
- /Users/Johno/Projects/Scripts/Geek Tool
- /usr/bin
- /bin
I suspect that textmate is trying to use the "wrong" rake, or failing to set up the environment properly.
I think the problem may lie in the ruby bundle command from text mate:
#!/usr/bin/env bash
export RUBYLIB="$TM_BUNDLE_SUPPORT/RakeMate${RUBYLIB:+:$RUBYLIB}"
export TM_RAKE=$(which "${TM_RAKE:-rake}")
"/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby" -- "$TM_BUNDLE_SUPPORT/RakeMate/rake_mate.rb"
It appears to be using a specific ruby (1.8) rather than the rvm project specific ruby
Does anyone have a suggestion as to how to resolve this?
Thank you,
John Schank
Followed the advice to set TM_RAKE and it didn't help.
I tried both the suggested setting, and using the results of which rake
/Users/Johno/.rvm/gems/ruby-2.1.0#puzzles/bin/rake
When using my TM_RAKE, is get a different error
RakeMate v2.0.0
>>> /Users/Johno/Projects/puzzles/triangle/Rakefile
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'rake' (>= 0) among 5 total gem(s) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /Users/Johno/.rvm/gems/ruby-2.1.0#puzzles/bin/rake:22:in `<main>'
This happens to be the same error I get when I try to use the rubocop.tmbundle
It still looks to me like the gem environment is not being passed to the child process.
I solved my own problem.
Here are the details for anyone else who has this problem...
First, the answer in this question TextMate, rvm and TM_RUBY
is almost perfect.
I had to create a textmate_ruby, and a textmate_rake script, and reference them in the variables in text mate: TM_RUBY, and TM_RAKE.
Second, since I'm using zsh, I had to change the shebang line in the textmate_xxx scripts to use zsh.
Finally, the key that helped me arrive at the correct solution is that I modified my project rakefile to :
task :default do
system "gem env"
system "ruby --version"
system "pwd"
system "printenv"
end
Then when I ran the rake task in textmate, it would dump the current values of my environment, ruby version, current directory, and gem environment. This really helped to see what was going on.
It seems that TextMate is still using your system rake instead of rvm's.
Try to set TM_RAKE in addition to TM_RUBY:
TM_RAKE=$HOME/.rvm/bin/rake
This also applies to rbenv, where you would set TM_RAKE to $HOME/.rbenv/shims/rake.
I can install jruby on cygwin using rvm, but the jruby gems do not get installed and any attempt to install gem fails.
This is the error I get during installation of jruby, when rvm tries to install default gemset:
Building Nailgun
jruby-1.6.7 - #installing to /home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7
jruby-1.6.7 - #importing default gemsets (/home/salil.wadnerkar/.rvm/gemsets/)
Copying across included gems
cygpath: can't convert empty path
Error opening script file: C:/cygwin/home/salil.wadnerkar/.rvm/src/jruby-1.6.7/tool/nailgun/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/gem (The system cannot find the path specified)
Any further attempt to install any gem meets with a similar error:
$ which gem
/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/gem
$ gem install rake
cygpath: can't convert empty path
Fetching: rake-0.9.2.2.gem (100%)
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory - C:/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7/cache/rake-0.9.2.2.gem
Update:
Here is my gem env
$ gem env
cygpath: can't convert empty path
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.15
- RUBY VERSION: 1.9.2 (2012-02-22 patchlevel 312) [java]
- INSTALLATION DIRECTORY: /home/salil.wadnerkar/.rvm/gems/jruby-1.6.7
- RUBY EXECUTABLE: C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/
jruby.exe
- EXECUTABLE DIRECTORY: /home/salil.wadnerkar/.rvm/gems/jruby-1.6.7/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-java-1.7
- GEM PATHS:
- /home/salil.wadnerkar/.rvm/gems/jruby-1.6.7
- /home/salil.wadnerkar/.rvm/gems/jruby-1.6.7:/home/salil.wadnerkar/.rvm/ge
ms/jruby-1.6.7#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "install" => "--no-rdoc --no-ri --env-shebang"
- "update" => "--no-rdoc --no-ri --env-shebang"
- REMOTE SOURCES:
- http://rubygems.org/
Edit:
Here is my rvm info
$ rvm info
jruby-1.6.7:
system:
uname: "CYGWIN_NT-6.1 got002518 1.7.11(0.260/5/3) 2012-02-24 14:05 i686 Cygwin"
bash: "/usr/bin/bash => GNU bash, version 4.1.10(4)-release (i686-pc-cygwin)"
zsh: " => not installed"
rvm:
version: "rvm 1.10.3 by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.beginrescueend.com/]"
updated: "18 hours 30 minutes 15 seconds ago"
cygpath: can't convert empty path
ruby:
interpreter: "jruby"
version: "1.6.7"
date: "2012-02-22"
platform: "Windows 7-x86-java"
patchlevel: "TM"
full_version: "jruby 1.6.7 (ruby-1.9.2-p312) (2012-02-22 3e82bc8) (Java HotS"ot(TM) Client VM 1.7.0_03) [Windows 7-x86-java]
homes:
gem: "/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7"
ruby: "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7"
binaries:
ruby: "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/ruby"
irb: "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/irb"
gem: "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/gem"
rake: "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/rake"
environment:
PATH: "/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7/bin:/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7#global/bin:/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin:/home/salil.wadnerkar/.rvm/bin:/usr/local/bin:/usr/bin:/cygdrive/c/Users/salilw_adm/AppData/Roaming/cabal/bin:/cygdrive/c/Program Files/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Hummingbird/Connectivity/14.00/Accessories:/cygdrive/c/Program Files/Hummingbird/Connectivity/14.00/NFS Maestro:/cygdrive/c/Program Files/WindowsLive/Shared:/cygdrive/c/Program Files/Java/jdk1.7.0_03/bin:/cygdrive/c/Python27:/cygdrive/c/Python27/Scripts:/cygdrive/c/Program Files/QuickTi
me/QTSystem:/cygdrive/c/Program Files/Subversion/bin:/cygdrive/c/apache-ant-1.8.2/bin:/cygdrive/c/Ruby192/bin:/cygdrive/c/Users/salil.wadnerkar/AppData/Roaming/cabal/bin"
GEM_HOME: "/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7"
GEM_PATH: "/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7:/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7#global"
MY_RUBY_HOME: "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7"
IRBRC: "/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/.irbrc"
RUBYOPT: ""
gemset: ""
I think it has to do something with the way cygwin is using GEMPATH.
$ gem install bundler
cygpath: can't convert empty path
Fetching: bundler-1.0.22.gem (100%)
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory - C:/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7/ca
che/bundler-1.0.22.gem
$ echo $GEM_PATH
/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7:/home/salil.wadnerkar/.rvm/gems/jrub
y-1.6.7#global
While installing a gem, gem is trying to use Windows-style path. In fact, I have to manually create the gem cache directory because it is using the windows style path and could not find the gem cache directory for gem installation.
Edit:
rvm seems to correctly add its path at the front of PATH.
$ echo $PATH
/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7/bin:/home/salil.wadnerkar/.rvm/gems/jruby- 1.6.7#global/bin:/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin:/home/salil.wadnerkar/.rvm/bin:/usr/local/bin:/usr/bin:.....
Edit:
Here is the output of the debug command. I am going to put 'cygpath' in there somewhere to see whether it fixes the path interpretation.
$ gem install rake --debug
cygpath: can't convert empty path
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory - C:/home/salil.wadnerkar/.rvm/gems/jruby-1.6.7/cache/rake-0.9.2.2.gem
org/jruby/RubyFile.java:465:in `initialize'
org/jruby/RubyIO.java:1135:in `open'
C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:152:in `download'
C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:278:in `install'
org/jruby/RubyArray.java:1615:in `each'
org/jruby/RubyEnumerable.java:956:in `each_with_index'
C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:270:in `install'
C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:121:in `execute'
org/jruby/RubyArray.java:1615:in `each'
C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:115:in `execute'
C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/command.rb:278:in `invoke'
C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:147:in `process_args'
C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:117:in `run'
C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:65:in `run'
C:\cygwin\home\salil.wadnerkar\.rvm\rubies\jruby-1.6.7\bin\jgem:25:in `(root)'
Exception `Gem::SystemExitException' at C:/cygwin/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/user_interaction.rb:332 - Exiting RubyGems with exit_code 1
Error opening script file: C:/cygwin/home/salil.wadnerkar/.rvm/src/jruby-1.6.7/tool/nailgun/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/gem (The system cannot find the path specified)
The path format is your problem. Cygwin doesn't (and shouldn't) recognize paths like that. This same path should have been:
/home/salil.wadnerkar/.rvm/src/jruby-1.6.7/tool/nailgun/home/salil.wadnerkar/.rvm/rubies/jruby-1.6.7/bin/gem
Your problem boils down to this -- a tool which is very important for Cygwin, is overriden by another tool with the same name in your PATH system variable, and that tool is located in a directory which is before your Cygwin binary path.
(I had a similar problem when I tried to compile native gems, but I had Windows version of GCC in my PATH and it was before the Cygwin binary path).
A very quick solution would be to edit your system PATH environment variable and make sure your Cygwin binary path is the first entry there, something like this:
PATH = C:\cygwin\bin;C:\your\other\paths;C:\windows\system32;...
etc.
Of course, exit all your Cygwin consoles and stop any Cygwin program that might still be running, then start consoles/other programs again. Everything should be just fine.
I hope this helps you.
I faced similar issues. I tried everything possible including reinstalling Cygwin. Finally I overcame the issues by building jruby from source.
Further to my previous post - I overcame the issues by building jruby from source via Ant build as mentioned within the README in jruby source bundle. Hope this helps.
I'm new to ruby and I have a problem loading gems.
I've read every topic about this on SO but I couldn't figure out how to make it work :/
I'm on a fresh install of Ruby 1.9.3 and RubyGems 1.8.11
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.11
- RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [i386-mingw32]
- INSTALLATION DIRECTORY: D:/dev/Ruby/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: D:/dev/Ruby/bin/ruby.exe
- EXECUTABLE DIRECTORY: D:/dev/Ruby/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- D:/dev/Ruby/lib/ruby/gems/1.9.1
- D:/aoi/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
I've installed the gem twice, once from command line
gem install soap4r
And second time i've tried to use RubyMine installer, but the result where the same,
when I try to
require 'rubygems'
resuire 'soap'
The output is the same :
LoadError: cannot load such file -- soap
from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from (irb):1
from D:/dev/Ruby/bin/irb:12:in `<main>'
Thank you for your help.
Get this https://github.com/spox/soap4r-spox and patch your ruby with it, its the default soap module for ruby but was pulled out of 1.9 versions
Try to add this to the top of your file:
gem 'soap4r'
require 'soap/wsdlDriver'
Or as an alternative try Savon
Have you checked that you do not run multiple different ruby versions ? Then your gems are not bound to the correct ruby version.
Moreover, I notice something strange :
http://rubygems.org/gems/soap : "This gem has been yanked, but it is still available for download for other gems that may have depended on it"
On the contrary, there seems to be another more interesting gem around : soap4r.
There is a tuto here. I especially noticed that sort of lines :
require "soap/rpc/standaloneserver"
That means "require soap" may not be sufficient in your case.
I am brand new to Ruby as of today. I installed IronRuby as I am a .NET developer and it seems to have a lighter footprint for Windows 7.
Things have been proceeding well, until I needed to install a Gem to parse HTML. I am issuing the following command:
igem install rokogiri
and receiving the following error:
ERROR: While executing gem ... (NoMethodError)
undefined method `set_params' for #<OpenSSL::SSL::SSLContext:0x00001ba>
Running igem env yields:
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i386-mswin32]
- INSTALLATION DIRECTORY: C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: "C:/Program Files (x86)/IronRuby 1.1/bin/ir.exe"
- EXECUTABLE DIRECTORY: C:/Program Files (x86)/IronRuby 1.1/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-dotnet-4.0
- GEM PATHS:
- C:/Program Files (x86)/IronRuby 1.1/Lib/ruby/gems/1.9.1
- P:/.gem/ironruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
My searches on Google have been fruitless. Does anyone have any suggestions?
Thanks!
The error happens in using OpenSSL library.
So this problem can be solved to use ruby standard OpenSSL library, not the library of IronRuby.
I think you can install the library in the following procedure.
Invalidate the function of SSL verifying once.
Add the next line to ~/.gemrc(%HOME%\.gemrc) file.
(if it doesn't exit, create)
:ssl_verify_mode: 0
In this, 'igem' is usabled.
But this state isn't recommend.
Install OpenSSL library, like this :
> igem install rubysl-openssl
And, restore ~/.gemrc file.
'igem' remains to be usabled.
For anyone else that comes across this a solution that worked for me was to use the standard Ruby gem command and set the install directory to the IronRuby gem location.
gem install --install-dir "c:/Program Files (x86)/IronRuby 1.1/lib/ironruby/gems/1.8" -V json_pure
igem does look like it's a very basic Ruby script that wraps up the Ruby gem command. The OpenSSL error seems to be a bit of a red herring and is probably because the default gem repository URL now redirects to a different location and the igem script doesn't deal with that.
Ok, I've just spent the 4 hours trying to figure this one out without success. I've tried all the usual suspects and googled every combination of ruby 1.9.1, load path, gems, mac os x,freebsd,prawn and other stuff. The bottom line is this:
When I compile ruby1.9.1-p129 from sources on mac os x 10.5, the default load path ($:) I get is:
ruby -e "puts $:"
/usr/local/lib/ruby/gems
/usr/local/lib/ruby/site_ruby/1.9.1
/usr/local/lib/ruby/site_ruby/1.9.1/i386-darwin9.7.0
/usr/local/lib/ruby/site_ruby
/usr/local/lib/ruby/vendor_ruby/1.9.1
/usr/local/lib/ruby/vendor_ruby/1.9.1/i386-darwin9.7.0
/usr/local/lib/ruby/vendor_ruby
/usr/local/lib/ruby/1.9.1
/usr/local/lib/ruby/1.9.1/i386-darwin9.7.0
.
when I install the prawn gem, for example, I get:
gem which prawn
(checking gem prawn-0.5.0.1 for prawn)
/prawn.rb
and when I try to require it I get:
ruby -e "require 'prawn'"
-e:1:in `require': no such file to load -- prawn (LoadError)
from -e:1:in `'
The only way I've been able to resolve this is by doing something stupid like this:
$: << "/usr/local/lib/ruby/gems/1.9.1/gems/prawn-0.5.0.1/lib"
which, of course, is utterly ridiculous. So the question is how do I get ruby 1.9.1 to recognize and follow the correct gems path? I've never had this issue with 1.8.7 so I'm assuming it 1.9.1 specific. I feel I'm missing something completely obvious here and any help would be much appreciated!
setting GEM_PATH=/usr/local/lib/ruby/gems/1.9.1
solved the problem. I knew it was something simple. Just aggravates me that it took ALL DAY to figure out!! This is due to never having this issue with 1.8.7 and of course NOT RTFM!!
same problem on kubuntu karmic.
installation:
$ sudo apt-get install build-essential ruby1.9.1-full libsqlite3 libsqlite3-dev rubygems1.9
$ sudo gem install sqlite3-ruby rails thin --no-rdoc --no-ri
result:
$ ruby -e "require 'rubygems'; require 'sqlite3'"
-e:1:in `require': no such file to load -- sqlite3 (LoadError)
from -e:1:in `<main>'
solution:
$ export GEM_PATH=/usr/lib/ruby1.9.1/gems/1.9.1/
Next time you have such an issue, don't forget to run gem env from the command line. This is what happens on Windows, but the principle is much the same:
C:\Documents and Settings\a.grimm>gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.5
- RUBY VERSION: 1.9.1 (2010-01-10 patchlevel 378) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby19/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: C:/Ruby19/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby19/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/Ruby19/lib/ruby/gems/1.9.1
- C:/Documents and Settings/a.grimm/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://gems.rubyforge.org/
require 'rubygems'
require 'prawn'
Unless things have changed in 1.9 that you no longer need to require rubygems first.
I'm looking for a different answer to the same problem. In some situations (ie. system start up tasks) setting environment variables before ruby runs is impossible.
Is there some way in running ruby (v >= 1.9.1) code to require gems? Without setting GEM_PATH?