librelist archives

« back to archive

Trouble getting MYSQL2 Gem installed

Trouble getting MYSQL2 Gem installed

From:
That Dude
Date:
2010-12-14 @ 02:05
Hey guys,

I am new to Shoes and so far I really like how easy it is for me to make 
interfaces for my small utilities that I have been running in command line
for a while now.   I am at the point now where I am trying to incorporate 
gems into some of my programs and I seem to be having a hard time doing 
this.

At the moment my issue is that I am trying to install MYSQL2 gem so that I
can start querying databases but I just keep getting the building gem 
dialog and it seems that it really isn't doing anything. When I looked in 
the ~/.shoes directory I do see that the files are there but I don't seem 
to be able to use them.

Right now the error I am getting is

Re: [shoes] Trouble getting MYSQL2 Gem installed

From:
Cecil Coupe
Date:
2010-12-14 @ 08:21
Shoes does not like native gems. If your configuration of system ruby
and shoes ruby is exactly correct (difficult to accomplish an not
x-platform) then native gems can be installed into the ~./shoes places
with a $ path/to/shoes --gem <gem-commands>. Then the script only needs
a simple require without the setup stuff.  

If '$shoes -g install mysql2', consider yourself very lucky and know
that it could break at anytime and won't work at other Shoes locations.
If it even works for you. Sometimes though.

On Mon, 2010-12-13 at 21:05 -0500, That Dude wrote:
> Hey guys,
> 
> I am new to Shoes and so far I really like how easy it is for me to make
interfaces for my small utilities that I have been running in command line
for a while now.   I am at the point now where I am trying to incorporate 
gems into some of my programs and I seem to be having a hard time doing 
this.
> 
> At the moment my issue is that I am trying to install MYSQL2 gem so that
I can start querying databases but I just keep getting the building gem 
dialog and it seems that it really isn't doing anything. When I looked in 
the ~/.shoes directory I do see that the files are there but I don't seem 
to be able to use them.
> 
> Right now the error I am getting is
> 
> 
> The code that I am using to try and use mysql is the following:
> 
> required_gems = [
>  'mysql2'
>  ]
>  require 'rubygems'
>  required_gems.each{|x| require x}
>  
> Shoes.setup do
>  required_gems.each{|x| gem x}
> end
> 
> I wrote it this way cause I am expecting to use more gems with this 
particular application.
> 
> But is there a way that I can get MYSQl2 to successfully load so that I 
can use it?
> 
> Any help is greatly appreciated.

Re: [shoes] Trouble getting MYSQL2 Gem installed

From:
Steve Klabnik
Date:
2010-12-14 @ 02:16
Hey Dude-

I'm not sure if this solves your problem or not: Try switching the order of
your blocks. The canonical example of doing this is here:

http://shoesrb.com/_why-archive/clearing-up-the-whole-shoes-and-rubygems-deal

and it has the setup block before the 'require'. Also, you shouldn't need to
require rubygems.

Also.... mysql2 has native extensions, right? I'm not sure you're going to
be able to use it without building your own Shoes. Gems with native
extensions don't really work without building them into Shoes.

Let me know if that works!

-Steve