win32ole gem for jruby - ruby

I'm trying to install jruby gem from http://github.com/bpmcd/win32ole .
it seems that standard
jruby -S gem install win32ole
doesn't work.
I'm ruby noobie, and so far I understand that this package is not a gem? Am I correct? Do I need to build it? If yes, could you direct me to the docs that explain how to proceed step by step?
Thanks plenty

I am working on a much more feature complete version (1.9 API compatible -- 1.8 API++) of win32ole right now: http://www.github.com/enebo/jruby-win32ole.
It is a work in progress but it does much more than the repo you are having issues with. Some form of this new repo will actually be in JRuby 1.6 when it comes out as well, so you can help us get it into shape if you like.
Update: With both jruby 1.5.5 and the upcoming jruby 1.6.0 you can install 'jruby-win32ole' as a gem. The Windows installer for 1.6.0 will also include this gem by default.

Related

Can we install C gems in ruby 2.7.0

I just upgraded by ruby to 2.7.0.
And I tried to install the ibm_db gem in windows platform. Installation works fine. When I try to use the gem(like require 'ibm_db') I get the following error
LoadError (126: The specified module could not be found. - C:/Ruby27/lib/ruby/gems/2.7.0/gems/ibm_db-5.1.0-x86-mingw32/lib/mswin32/rb2x/i386/ibm_db.so)
I have faced this type of error in ruby 2.6 also but when I have set RUBY_DLL_PATH to the ddl which the gem uses it is solved.
But in ruby 2.7 even after setting this variable I get the following error.
Can anyone please help in solving this? ( I have one more doubt:- c gems are supported in ruby 2.7)
It appears that the ibm_db gem currently does not support Ruby 2.7 yet. The newest Ruby version they support is Ruby 2.6.x.
There is a pull request at https://github.com/ibmdb/ruby-ibmdb/pull/105 which might add support for Ruby 2.7 though.
The issue is because the binary was pointed to ruby 2.6 binary. So replace it with the latest ruby 2.7 binary and then everything works fine.
Thanks,
Akhil

Ruby cucumber gems version

I started learn Ruby (for automation tests) in Rubymine but I have a problem with gems.
I downloaded some projects from github but I am not able to run projects Same with some tutorials.
Now as i understand:
EVERY project should have GEM FILE with gem versions.
It is possible to have projects with different version
bundles should take care of gems (but i have the problem with this)
My version ruby :2 .2.4
cucumber 2.2.4 gem 2.4.5.1
Do you recommend RVM? How can I correct install this(I downloaded something for key and sing up but no email with password) I could not use also curl command
I tried using : https://rvm.io/rvm/install
I am using RubyMine(for 30days so soon will finish:(() I used e.g https://github.com/RailsApps/rails-bootstrap
and here I have:
alidate_ruby!': Your Ruby version is 2.2.4, but your Gemfile specified 2.2.3 (Bundler::RubyVersionMismatch)
Can anybody help me? Thanks!

IMDB gem not working on Windows with Ruby 2.2 - Can't use Nokogiri 1.6.7.rc4

I am trying to use the IMDB gem on Windows with Ruby 2.2 but this gem seems to force using an older version of Nokogiri which is not compatible with my Ruby's version on Windows.
This is the message I am getting:
The bundle currently has Nokogiri locked at 1.6.2.1.
I do have installed the RC4 version.
Is there any way to force IMDB to use the RC4 version?
Or other solution I did not think about?
Probably the easiest solution on Windows is to create a Virtual Machine with Linux and then install Ruby.
Windows has many problems with properly handling gems.
Preamble and warning
This solution is only an ugly hack and I don't recommend to use it.
The best solution would be a corrected version of imdb-gem with a (possible) “optimistic” version constraint.
Disclaimer 2: I don't use bundler, maybe this solution does not work exactly as I show it. But the process should be similar for bundler.
Source of the problem
The gemspec of the imdb-gem contains the command:
s.add_dependency 'nokogiri', '= 1.6.5'
or in version 0.8.2
s.add_dependency 'nokogiri', '= 1.6.2.1'
If this would contain an optimistic version constraint like
s.add_dependency 'nokogiri', '=~ 1.6'
you could use the version you use (assumed there is no reason for this specific version).
Hacking the gemspec
During gem install the gemspec is copied to a location like
[ruby-installation-path]/lib\ruby\gems\2.1.0\specifications.
Look for the file imdb-0.8.2.gemspec and make this change:
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
# Begin of Hack the nokogiri version
# s.add_runtime_dependency(%q<nokogiri>, ["= 1.6.2.1"])
s.add_runtime_dependency(%q<nokogiri>, ["~> 1.6"])
# End of Hack the nokogiri version
s.add_development_dependency(%q<rake>, ["~> 10.0.3"])
Then try if your script works.
I tested with nokogiri version 1.6.6.2 and detected no problem.
If the version 1.6.7.rc4 works also I would recommend to ask for a change on https://github.com/ariejan/imdb and a new version of the imdb-gem.

What's the best practice for using bundler, git, and jRuby gems with maven?

I'm working with jRuby and Rails for a while, but I don't have the feeling that I've found the holy grail for this:
I'm doing a lot of gems which are wrappers for actual java libs and I ask myself what the best option is for packaging those gems.
Is it a good idea to package them as "native gems", letting the jars being packaged when the gem is installed?
Is there a way to install the jars in the .m2 dir, letting bundler AND maven to what they can do best at the same time?
Best,
Tobias
Okay, there is an easy way to install java libraries as gem:
gem install mvn:<groupId>:<artifactId>
Which should solve some of the problems.
Unfortunately, bundler does not seem to support them.
See
http://blog.mkristian.tk/2011/03/rubygems-maven-support.html
and
http://blog.mkristian.tk/2011/09/jruby-and-rubygems-and-javaclassloader.html
Also, switching to Buildr as build tool instead of mvn makes things easier.
RubyGems Maven support removed since jruby 1.7
see this RubyGems maven support has been removed in JRuby 1.7
So, that won't work with jruby 1.7:
gem install mvn:<groupId>:<artifactId>
Using jbundler instead, refer to https://github.com/mkristian/jbundler

Determining which rubygem you're using

How can you determine which rubygem is being used in response to a "require" statement? gem which doesn't seem to help.
Background: for the project hornsby-herbarium-parser, I'm using the gem roo.
I used the github gem hmcgowan-roo , as at that time it was more recent than the rubyforge version of roo. I tried testing the code on runcoderun, and it failed because it doesn't have any version of roo. By this time, new versions of roo were available on both github and rubyforge.
I decided I may as well see if the latest version from rubyforge works for my code, as I assume rubyforge is more official, authoritative, and stable than github forks. Once I'm sure the rubyforge version works with my code, I'll ask runcoderun nicely if they can install it on their system.
I sudo gem installed roo, and my gems now include "hmcgowan-roo (1.3.5)" and "roo (1.3.6)", and running the tests for hornsby-herbarium-parser still pass. I know that as the rubyforge version was installed more recently, it ought to be the one being used in the tests, but I want to be able to verify this.
gem which roo
Didn't help, because it gave me
(checking gem hmcgowan-roo-1.3.5 for roo)
/usr/lib/ruby/gems/1.8/gems/hmcgowan-roo-1.3.5/lib/roo.rb
which I assume is the wrong answer.
Update: I used both
$:.detect {|dir| dir =~ /roo/}
and
puts Roo::VERSION::STRING
both agree with gem which, saying that I'm still using hmcgowan-roo-1.3.5.
puts Roo::VERSION::STRING
First of all, rubygems will load the highest version number gem, not the most recently installed. So you should be getting roo 1.3.6 here.
Other than that, I second gerrit's suggestion to look for a version constant. For instance, I just loaded rmagick and there is a constant Magick::Version. Another example is Open4::VERSION.
However not all gems have a version constant, so as a fallback you could do something hacky like:
>> require 'open4'
=> true
>> $:.detect {|dir| dir =~ /\/open4-([^\/]*)\//}
=> "/Library/Ruby/Gems/1.8/gems/open4-0.9.6/bin"
>> $1
=> "0.9.6"
gem list xxx
it defaults to load the latest version.
you can do use Gem::VERSION
require 'rubygems'; puts Gem::VERSION
that in a ruby program, which is quite useful if you want to make sure that your application under same version of rubygems accrossing all machines (e.g. bundler Gemfile)
The simplest way will be to uninstall and then reinstall the rubygems individually.
I'm not so sure that your assumption about github not having stable sources is so accurate.

Resources