Russell Fulton
Russell Fulton

Reputation: 590

fixing a failed ruby gem install

I am installing the ruby gem mysql-dbd on a new system which is running ruby 2.5. The problem is that it gets a syntax error because at 2.4 ruby combined Integer and Fixed num types.

The failed install leaves the unpacked gem package on disk so I was able to examine the entrails and the fix appears to be trivial (as in insert a '#' in a statement to remove the now redundant reference to FixNum).

My question is having fixed the source how do I go about building and installing the gem? Not being familiar with rake.

BTW the gem has long been "unsupported".

Upvotes: 3

Views: 388

Answers (2)

Panic
Panic

Reputation: 2405

You could try something like this:

# install_dbd_mysql.rb

Fixnum = Integer

require 'rubygems/commands/install_command'

install = Gem::Commands::InstallCommand.new
install.handle_options ['dbd-mysql']
install.execute

Run:

$ ruby install_dbd_mysql.rb

Upvotes: 0

Jay Dorsey
Jay Dorsey

Reputation: 3662

I can't get the gem source repository to load, but you've got at least two options:

Locally, you might be able to build it. Try running rake build from the root folder of the gem, and look in the pkg folder for the built gem. You should be able to then gem install pkg/<gem name>.gem in that folder

If you need to share it with others, push the code up on github. Make your change, and if you're using bundler in the codebase that's using the gem, update your Gemfile to point to your source.

Upvotes: 1

Related Questions