Ruby issue with Bundler::GemNotFound - ruby

I've a problem with every gem I try to use.
I am using an Ubuntu machine.
The error is
/usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.12.5/lib/bundler/spec_set.rb:95:in `block in materialize': Could not find chunky_png-1.3.6 in any of the sources (Bundler::GemNotFound)
The error is not specific to that gem, because it happen with different gem as well. I think is a path problem.
I've already tried to reinstall ruby. Any help will be very appreciate.
My environment:
$ ruby -v
ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-linux]
$ bundle env
Bundler 1.12.5
Rubygems 2.6.6
Ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-linux]
GEM_HOME /usr/local/bundle
GEM_PATH
Git 2.1.4
$ gem environment
- RUBYGEMS VERSION: 2.6.6
- RUBY VERSION: 2.1.10 (2016-04-01 patchlevel 492) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/bundle
- USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.1.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bundle/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/bundle
- /root/.gem/ruby/2.1.0
- /usr/local/lib/ruby/gems/2.1.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "install" => "--no-document"
- "update" => "--no-document"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bundle/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
List of gems
*** LOCAL GEMS ***
bigdecimal (default: 1.2.4)
bundler (1.12.5)
chunky_png (1.3.6)
compass (1.0.3)
compass-core (1.0.3)
compass-import-once (1.0.5)
ffi (1.9.14)
io-console (default: 0.4.3)
json (default: 1.8.1)
minitest (default: 4.7.5)
multi_json (1.12.1)
psych (default: 2.0.5)
rake (default: 10.1.0)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
rdoc (default: 4.1.0)
rubygems-update (2.6.6)
sass (3.4.22)
test-unit (default: 2.1.10.0)

I found a solution to this to install the gems without sudo. It seems on my machine there were two locations for the gems, and when I installed via sudo, it placed them in the wrong location. Installing with gem install compass for instance placed it in the correct location.

Related

unable to find gems after switching to rbenv

was hoping would be able to help me with an issue I am having since I switched from using rvm to rbenv. Company I work for has started using Boxen to manage the developments environments and this is not compatible with rvm hence the switch.
Anyways my problem is after the switch some of my gems are not found. for example capybara webkit. I have added this to my gem file, ran bundler and all gems are installed as expected. I then did an ebenv rehash to installs shims for the the new gems.
However when I attempt to run my tests I get the error:
no such file to load -- capybara-webkit (LoadError)
my gem list is as follows:
Using mime-types (2.0)
Using mini_portile (0.5.2)
Using nokogiri (1.6.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using xpath (2.0.0)
Using capybara (2.1.0)
Using json (1.8.1)
Using capybara-webkit (1.0.0)
Using ffi (1.8.1)
Using childprocess (0.3.9)
Using cliver (0.2.2)
Using diff-lcs (1.2.4)
Using zip (2.0.2)
Using jar_wrapper (0.1.7)
Using multi_json (1.7.4)
Using websocket-driver (0.3.0)
Using poltergeist (1.4.1)
Using rspec-core (2.13.1)
Using rspec-expectations (2.13.0)
Using rspec-mocks (2.13.0)
Using rspec (2.13.0)
Using rubyzip (0.9.9)
Using selenium (0.2.10)
Using websocket (1.0.7)
Using selenium-webdriver (2.32.1)
Using bundler (1.3.5)
my ruby gem environment is:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2013-06-27 patchlevel 448) [x86_64-darwin12.4.0]
- INSTALLATION DIRECTORY: /opt/boxen/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /opt/boxen/rbenv/versions/1.9.3-p448/bin/ruby
- EXECUTABLE DIRECTORY: /opt/boxen/rbenv/versions/1.9.3-p448/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-12
- GEM PATHS:
- /opt/boxen/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1
- /Users/Gerry/.gem/ruby/1.9.1
- /opt/boxen/rbenv/plugins/rbenv-gem-rehash
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- http://rubygems.org/
I believe that the issue may have something to do with my path. I am using zsh and have added the following to my .zshrc as per the instructions at (https://github.com/sstephenson/rbenv)
# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
When I run the command echo $PATH i get the following:
/opt/boxen/rbenv/shims:/Users/Gerry/.rbenv/bin:node_modules/.bin:/opt/boxen/nodenv/shims:/opt/boxen/nodenv/bin:bin:/opt/boxen/rbenv/shims:/opt/boxen/rbenv/bin:/opt/boxen/rbenv/plugins /ruby-build/bin:/opt/boxen/bin:/opt/boxen/homebrew/bin:/opt/boxen/homebrew/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/Gerry/Sites/EventMobi/Code/ec2-api-tools-1.6.1.3/bin:/usr/local/share/npm/bin
Anybody got any idea what I am doing wrong?
OK, managed to get this working. Not sure what the fix was I just ran rbenv rehash a few times and I no longer get the error message. All gems are found as expected.

Why can't find the library: no such file to load

I'm stuck, can't find the cause, it's suppossed to be simple,
This is the error message:
require': no such file to load -- ./ip (LoadError)
It's generated by this line of code:
require './ip'
As the
require 'socket'
works and I found the two libraries:
/usr/lib/ruby/gems/1.8/gems/ruby-ip-0.9.1/lib/ip.rb
/usr/lib/ruby/gems/1.8/gems/ruby-ip-0.9.1/lib/ip/socket.rb
tried also require 'ip'
and
require '../ip'
still same error
Backgroun info:
I installled ruby-ip so that I could invoke a method like: ip = IP.new do ...
gem installed ruby-ip
I can see the library ( I believe it's the ip.rb what I need to use;
pwd
/usr/lib/ruby/gems/1.8/gems/ruby-ip-0.9.1/lib
ls
ip ip.rb
environment info
ruby -v
ruby 1.8.7 (2012-10-12 patchlevel 371) [i386-linux]
gem list
*** LOCAL GEMS ***
builder (3.2.0)
eventmachine (1.0.1, 0.12.10)
pg (0.14.1, 0.13.2)
ruby-ip (0.9.1)
rubygems-update (2.0.0)
sqlite3 (1.3.3)
which ruby
/usr/bin/ruby
which gem
/usr/bin/gem
gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.0
- RUBY VERSION: 1.8.7 (2012-10-12 patchlevel 371) [i386-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /home/pilar/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
Are you including require 'rubygems' too? It is necessary if you are using rvm.
Example:
[fotanus#thing ~]$ gem install ip
Fetching: ip-0.3.0.gem (100%)
Successfully installed ip-0.3.0
1 gem installed
Installing ri documentation for ip-0.3.0...
Installing RDoc documentation for ip-0.3.0...
[fotanus#thing ~]$ irb
1.8.7 :001 > require 'ip'
LoadError: no such file to load -- ip
from (irb):1:in `require'
from (irb):1
1.8.7 :002 > require 'rubygems'
=> true
1.8.7 :003 > require 'ip'
=> true
1.8.7 :004 >

Ruby - LoadError

I started to mess around with ruby but I'm turning crazy with LoadError.
First of all this is my configuration:
which ruby
/home/daniele/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
and
gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.10
- RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/daniele/.rvm/gems/ruby-1.9.3-p0
- RUBY EXECUTABLE: /home/daniele/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
- EXECUTABLE DIRECTORY: /home/daniele/.rvm/gems/ruby-1.9.3-p0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/daniele/.rvm/gems/ruby-1.9.3-p0
- /home/daniele/.rvm/gems/ruby-1.9.3-p0#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
installed gems:
bundler (1.0.21 ruby)
CFPropertyList (2.0.17)
eventmachine (0.12.10)
httparty (0.8.1)
json (1.6.4)
libxml-ruby (2.2.2)
multi_json (1.0.4)
multi_xml (0.4.1)
rake (0.9.2)
uuidtools (2.1.2)
This is my script start.rb header:
require 'xxx'#xxx.rb is in the same dir
and xxx.rb header:
require 'rubygems'
require 'eventmachine'
require 'zlib'
require 'cfpropertylist'
require 'pp'
require 'tweakSiri'
require 'interpretSiri'
Now if I run sudo ruby start.rb I get this error:
/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- eventmachine (LoadError)
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ./siriAuth.rb:2
from start.rb:2:in `require'
from start.rb:2
eventmachine and cfpropertylist are the only ones that generate errors.
When I try rvmsudo ruby start.rbI get this one:
/home/daniele/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- siriAuth (LoadError)
from /home/daniele/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from start.rb:2:in `<main>'
I guess I have a dirty installation of ruby..but I'm not sure that's the problem.
I'm trying to running someonelse's script...this was the installation script:
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
rvmsudo rvm install 1.9.3
rvm use 1.9.3 --default
rvmsudo gem install eventmachine CFPropertyList httparty json uuidtools
And the README says to run it with rvmsudo ruby start.rb
just ruby start.rb
not sure why you want to execute it with sudo. RVM gives you a local install of ruby 1.9.3
If you sudo it, you surpass your local user and ask root to execute ruby on your script which in turn will call the system ruby which is 1.8 on your system.

Ruby - watir : Failed to get IEnum Interface

I'm using windows XP and I need to use watir with ruby, the installation went pretty well, my last try was following the instructions here Failed WATIR installation Server 2003 and everything was ok except for this "ERROR: While generating documentation for builder-2.1.2" then the installation finished with no more problems.
The problem is when I try to run a sample script to execute a google search I got an error when the set function is called, so far I haven't found any useful information about it, if anyone could give me a hand it would be great :)
btw, here http://www.mail-archive.com/wtr-general#rubyforge.org/msg07722.html they say that it is related to WIN32OLE but they don't explain how to fix it (or at least I didn't get it :s )
The versions I've installed are
ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
- INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8
- RUBY EXECUTABLE: c:/ruby/bin/ruby.exe
- EXECUTABLE DIRECTORY: c:/ruby/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mswin32-60
- GEM PATHS:
- c:/ruby/lib/ruby/gems/1.8
- C:/Documents and Settings/jamontoya/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
The error
c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/locator.rb:119:in `each': failed to get IEnum Interface (RuntimeError)
HRESULT error code:0x80004002
No such interface supported from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/locator.rb:119:in `locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/container.rb:838:in `locate_input_element'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/input_elements.rb:5:in `locate'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/element.rb:54:in `assert_exists'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/element.rb:315:in `enabled?'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/element.rb:62:in `assert_enabled'
from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/input_elements.rb:364:in `set'
from Search.rb:29
The sample code (Search.rb)
I removed comments and other unnecessary lines
require "watir"
test_site = "http://www.google.com"
browser = Watir::Browser.new
browser.goto test_site
browser.text_field(:name, "q").set("pickaxe") # here is the error when set is called
browser.button(:name, "btnG").click
browser.close
gem list
just in case you need to know
*** LOCAL GEMS ***
activesupport (2.3.9)
builder (2.1.2)
commonwatir (1.6.6)
firewatir (1.6.6)
fxri (0.3.6)
fxruby (1.6.12 mswin32)
hoe (2.6.2)
hpricot (0.6 mswin32)
json_pure (1.4.6)
log4r (1.0.5)
nokogiri (1.4.3.1 x86-mswin32)
rake (0.8.7, 0.7.3)
rubyforge (2.0.4)
rubygems-update (1.3.7)
s4t-utils (1.0.4)
sources (0.0.1)
user-choices (1.1.6.1)
watir (1.6.6)
win32-api (1.4.6 x86-mswin32-60, 1.0.4 mswin32)
win32-clipboard (0.4.3)
win32-dir (0.3.2)
win32-eventlog (0.4.6)
win32-file (0.5.4)
win32-file-stat (1.2.7)
win32-process (0.6.2, 0.5.3)
win32-sapi (0.1.4)
win32-sound (0.4.1)
windows-api (0.4.0, 0.2.0)
windows-pr (1.0.9, 0.7.2)
xml-simple (1.0.12)
Watir can't find IEnum interface thread that you link to says:
my best suggestion is to uninstall and
reinstall Ruby, then re-install Watir
on top of the new Ruby
and that would be my advice too.

Rubygems Path Question

I am trying to run the following ruby code from IRB but am unable to require the gmail gem.
require 'rubygems'
require 'gmail'
gmail = Gmail.new("user", "pass")
Here's the IRB output:
Johnny-Goodmans-MacBook-Pro:gmail johnnygoodman$ irb
>> require 'rubygems'
=> false
>> require 'gmail'
NameError: uninitialized constant Gmail
from ./gmail.rb:6
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from (irb):2
Here is Gem.path output:
>> Gem.path
=> ["/Users/johnnygoodman/.gem/ruby/1.8", "/Library/Ruby/Gems/1.8", "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8"]
And environment output:
Johnny-Goodmans-MacBook-Pro:gmail johnnygoodman$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-10
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/johnnygoodman/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://rubygems.org/", "http://gems.github.com"]
- REMOTE SOURCES:
- http://rubygems.org/
- http://gems.github.com
And which ruby:
Johnny-Goodmans-MacBook-Pro:gmail johnnygoodman$ which ruby
/usr/bin/ruby
And .gemrc:
Johnny-Goodmans-MacBook-Pro:~ johnnygoodman$ cat .gemrc
---
:sources:
- http://rubygems.org/
- http://gems.github.com
:backtrace: false
:benchmark: false
:verbose: true
:update_sources: true
:bulk_threshold: 1000
Here's my gemlist:
Johnny-Goodmans-MacBook-Pro:~ johnnygoodman$ gem list
*** LOCAL GEMS ***
actionmailer (2.3.8, 2.3.5, 2.2.2, 1.3.6)
actionpack (2.3.8, 2.3.5, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.8, 2.3.5, 2.2.2, 1.15.6)
activeresource (2.3.8, 2.3.5, 2.2.2)
activesupport (2.3.8, 2.3.5, 2.2.2, 1.4.4)
acts_as_ferret (0.4.4, 0.4.3)
Ascii85 (1.0.0)
autotest (4.2.10, 4.2.9)
autotest-fsevent (0.2.2, 0.1.1)
autotest-growl (0.2.4, 0.2.0)
autotest-rails (4.1.0)
bigdecimal-segfault-fix (1.0.1)
capistrano (2.5.18, 2.5.11, 2.5.2)
cgi_multipart_eof_fix (2.5.0)
cheat (1.2.1)
chronic (0.2.3)
configuration (1.1.0)
daemons (1.0.10)
dnssd (1.3.1, 0.6.0)
fastthread (1.0.7, 1.0.1)
fcgi (0.8.8, 0.8.7)
ferret (0.11.6)
gem_plugin (0.2.3)
gemcutter (0.5.0, 0.4.1)
heroku (1.9.9, 1.8.5)
highline (1.5.2, 1.5.1, 1.5.0)
hoe (2.6.0, 2.5.0)
hpricot (0.8.2, 0.6.164)
json_pure (1.4.3, 1.2.3, 1.2.2)
launchy (0.3.5)
libxml-ruby (1.1.4, 1.1.3, 1.1.2)
mail (2.2.1)
mechanize (1.0.0, 0.9.3)
mime-types (1.16)
mongrel (1.1.5)
mysql (2.8.1)
needle (1.3.0)
net-scp (1.0.2, 1.0.1)
net-sftp (2.0.4, 2.0.1, 1.1.1)
net-ssh (2.0.22, 2.0.21, 2.0.17, 2.0.4, 1.1.4)
net-ssh-gateway (1.0.1, 1.0.0)
nokogiri (1.4.2, 1.4.1)
passenger (2.2.11, 2.2.9)
pdf-reader (0.8.5, 0.8.4, 0.8.3)
polyglot (0.3.1)
pony (1.0, 0.9, 0.6)
rack (1.1.0, 1.0.1)
rails (2.3.8, 2.3.5, 2.2.2, 1.2.6)
rake (0.8.7, 0.8.3)
RedCloth (4.2.3, 4.1.1)
rest-client (1.4.2, 1.3.1)
rspec (1.3.0)
rspec-rails (1.3.2)
ruby-gmail (0.2.1, 0.0.8)
ruby-openid (2.1.7, 2.1.2)
ruby-yadis (0.3.4)
rubyforge (2.0.4)
rubygems-update (1.3.7, 1.3.6, 1.3.5, 1.3.1)
rubynode (0.1.5)
scrapi (1.2.0)
shared-mime-info (0.1)
sqlite3-ruby (1.2.5, 1.2.4)
sys-uname (0.8.4)
termios (0.9.4)
tidy (1.1.2)
tmail (1.2.7.1)
treetop (1.4.5)
xmpp4r (0.5, 0.4)
ZenTest (4.3.1)
I've uninstalled mac ports and used hivelogic instructions to install a fresh ruby/rails version. However, notice that my which ruby doesn't match hivelogic's instructions until I run:
Johnny-Goodmans-MacBook-Pro:~ johnnygoodman$ . ~/.profile
Johnny-Goodmans-MacBook-Pro:~ johnnygoodman$ which ruby
/usr/local/bin/ruby
I think this is the problem but am not sure what to read to force the ruby path to always load to /usr/local/bin/ruby. It could also be a red herring as I simply don't know how the parts fit. As soon as sudo gem install doesn't work, I'm basically lost.
Note other gems do work:
Johnny-Goodmans-MacBook-Pro:~ johnnygoodman$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'mechanize'
=> true
Questions:
When sudo gem install doesn't allow you to create an object from the class, what are the next steps in sleuthing down the issue?
How do the parts of a gem fit together as applies to fixing these types of issues? I've read the FAQs and docs (http://docs.rubygems.org/read/book/3) but either missed it or was unable to pick out the relevant parts.
Looks like you have some misunderstanding how ruby loads files. There's an include path (check out the $: variable). When you require something, ruby will start at the first path in the array, and checks if the file is there. If it's, then it loads it, otherwise it moves on to the next directory in the include path.
When you require gmail, it looks like that it loads your own gmail.rb. Doing a require "gmail" in that file will find itself, instead of the gem's gmail.rb.
To fix it you should probably rename your gmail.rb to something else (my_gmail.rb, or anything, just make sure it doesn't match any system file).
(The require 'ruby-gmail' fails because the ruby-gmail gem doesn't contain such file. You should use simply require 'gmail', but before that rename your gmail.rb)
Your IRB output seems to be about as far as you needed to go:
>> require 'gmail'
NameError: uninitialized constant Gmail
from ./gmail.rb:6
When you require 'gmail' it's pulling in your local gmail.rb file - within which there's a reference to a Gmail class(?) which isn't defined.
It's unclear why you'd expect Gmail to be defined, though. Without seeing the code in gmail.rb, it's hard to say what's wrong.
I notice that in your gem list there isn't any gem called "gmail" or anything similar.
It's hard to tell, therefore, what you're trying to accomplish. Perhaps you're confusing gems with a basic library require, or are assuming that the Rails constant-lookup functionality is a Ruby feature.
Most useful would be if you could post the contents of gmail.rb.

Resources