Rubygems problem on ubuntu 12 (server)

Hi!

well i have a server and im trying to run an app… the thing is that is
my 1st time trying to script with ruby

-----o-----

So i have LAMP…PHPMYADMIN(i work with php)… RUBY…RUBYGEMs…MYSQL2
(for some future tests)… and SINATRA :smiley:

the thing is that i copied and paste a little example:
(path: /home/test.rb)

#/home/test.rb
require ‘rubygems’
require ‘sinatra’

get ‘/’ do
‘Hola mundo!’
end

and when i run “ruby test.rb” it prints:

test.rb:2:in `require’: no such file to load – rubygems (LoadError)
from test.rb:2

.-how gems works?
.-how my app works on a server?
.-i must specify a root to my path?

im really gettint tired with this… i searched over and over and i
found nothing, only 1 post telling how to create sim-links. Is that the
solution ?
reference:
http://www.ruby-forum.com/topic/957272

if so…from where i have to call the sim-link ?

Thanks!!

Atte. Christian

Hello,

It’s seem that you haven’t probably set up Ruby and rubygems.

On Sun, May 20, 2012 at 11:49 AM, cristian d. [email protected]
wrote:

test.rb:2:in `require’: no such file to load – rubygems (LoadError)

from test.rb:2

.-how gems works?

Rubygems is an package manager framework for Ruby like apt in Ubuntu.
In order to get everything work quickly, I can suggest two ways.

First method: You can install Ruby and rubygems from Ubuntu’s
repository.
Then use ‘gem install sinatra’ to install sinatra gem (gem is equivalent
to
package in Linux). You can read more about rubygems at [1]

Second method: You can install rvm (Ruby Version Manager) [2] and
install
a Ruby version you like and it’ll install rubygems for you.

.-how my app works on a server?

At least in my system, it use WEBrick as web server because sinatra is a
DSL, not a web server. You can also use thin as sinatra [3] recommend.

In my opinion, in Ubuntu, install Ruby and rubygems from source isn’t
good idea.

Thanks!!

Atte. Christian


Posted via http://www.ruby-forum.com/.

[1] http://rubygems.org/
[2] RVM: Ruby Version Manager - RVM Ruby Version Manager - Documentation
[3] http://www.sinatrarb.com/intro
[3]

Best regards,

Awsome now i can run a script :smiley: thanks guys !

and… one question hehe, now that i can run scripts i tried to install
mysql2 but there is an error:

ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.

    /home/cristian/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb

checking for rb_thread_blocking_region()… yes
checking for rb_wait_for_single_fd()… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lmygcc… no
checking for mysql_query() in -lmysqlclient… no

and ubuntu tells me that libmysqlclient16-dev doesnt exist :S

Hello, I guess you can try to use rvm and after that install sinatra.

after installing rvm:

http://blog.jam.net.ve/2011/05/17/instalando-rvm-ruby-rails-en-ubuntu/

I guess you speak spanish because of the way you write.

After you install the rvm and the version of the ruby, you can install
sinatra easily

gem install sinatra

And that’s it.

And try again your script.

Regards,
Jose

no more problems…

just ran:

apt-get libmysql…