My rb file is simple like this:
require 'rubygems'
require 'mysql2'
require 'sequel'
Sequel.connect(:adapter => 'mysql2', :database=>'xxx', :user => 'xxx', :password => 'xxxxxx', :host => 'xxxxxxxx.compute-1.amazonaws.com')
when I ran this file I got the following error:
> /usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require': cannot load such file -- mysql2 (LoadError) from
> /usr/lib64/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require' from t.rb:2:in `<main>'
I ran the command “bundle list” over my amazon instance and I got the following list:
Gems included by the bundle:
* actionmailer (3.2.8)
* actionpack (3.2.8)
* activemodel (3.2.8)
* activerecord (3.2.8)
* activeresource (3.2.8)
* activesupport (3.2.8)
* arel (3.0.2)
* builder (3.0.0)
* bundler (1.0.21)
* coffee-rails (3.2.2)
* coffee-script (2.2.0)
* coffee-script-source (1.3.3)
* erubis (2.7.0)
* execjs (1.4.0)
* hike (1.2.1)
* i18n (0.6.0)
* journey (1.0.4)
* jquery-rails (2.1.1)
* json (1.7.5)
* mail (2.4.4)
* mime-types (1.19)
* multi_json (1.3.6)
* mysql2 (0.3.11)
* polyglot (0.3.3)
* rack (1.4.1)
* rack-cache (1.2)
* rack-ssl (1.3.2)
* rack-test (0.6.1)
* rails (3.2.8)
* railties (3.2.8)
* rake (0.9.2.2)
* rdoc (3.12)
* sass (3.2.1)
* sass-rails (3.2.5)
* sequel (3.38.0)
* sprockets (2.1.3)
* thor (0.16.0)
* tilt (1.3.3)
* treetop (1.4.10)
* tzinfo (0.3.33)
So as we can see there is the mysql2 gem. Any advise?
Thanks all!
Ok! Solve it. In my local environment I edited by hand the Gemfile (maybe is not the right way) I added one line “gem mysql2” then in the console I execute “bundle install” and upload the Gemfile to github.
Finally, in the amazon instance I deployed my environment to apply changes and execute the command “RAILS_ENV=production bundle exec file.rb” (always use production) and the file execute normal.
Thanks all!