require - not loading gem

P

paul h

Hi,

I have installed the spreadsheet gem to read and write MS Excel files.

I have a problem in that when I run the app from the command line I
get the error: unable to load spreadsheet

However, when I run my Cuke features and RSpec tests, the gem is
loaded up fine, and xls files are read and written as intended - it is
only a problem when I run the app directly from the command line.

I presume this is a problem with my ruby installation, or environment.
I have looked through the Pickaxe book ref Environment, but culdn't
find anything to help - and I can't find anything on the site for the
gem in respect of any support, so if someone could point me in the
right direction, I'd be eternally grateful.

Ubuntu 10.04
Ruby 1.8.7

App structure:

[application root folder]
[bin]
application (chmod +x)
[lib]
application.rb (all require statements in here)
[application]
...
modules
[features]
...
cuke feature files
[spec]
...
RSpec spec files

If anyone can help I'd appreciate it. At the moment, I can only run
the app via Cucumber or RSpec, and I need to run it directly from the
command line.

Thanks

Paul
 
W

Walton Hoops

Hi,

I have installed the spreadsheet gem to read and write MS Excel files.

I have a problem in that when I run the app from the command line I
get the error: unable to load spreadsheet

However, when I run my Cuke features and RSpec tests, the gem is
loaded up fine, and xls files are read and written as intended - it is
only a problem when I run the app directly from the command line.

I presume this is a problem with my ruby installation, or environment.
I have looked through the Pickaxe book ref Environment, but culdn't
find anything to help - and I can't find anything on the site for the
gem in respect of any support, so if someone could point me in the
right direction, I'd be eternally grateful.

Ubuntu 10.04
Ruby 1.8.7

You must manually require rubygems in 1.8.x. In 1.9.x this is no longer
necessary. Either add require 'rubygems' before require 'spreadsheet'
or run the program with ruby -r rubygems.

I suspect the reason it works from rspec/cucumber is because there are
themselves gems and must require rubygems to operate.
App structure:

[application root folder]
[bin]
application (chmod +x)
[lib]
application.rb (all require statements in here)
[application]
...
modules
[features]
...
cuke feature files
[spec]
...
RSpec spec files

If anyone can help I'd appreciate it. At the moment, I can only run
the app via Cucumber or RSpec, and I need to run it directly from the
command line.

Thanks

Paul
 
P

paul h

I have installed the spreadsheet gem to read and write MS Excel files.
I have a problem in that when I run the app from the command line I
get the error: unable to load spreadsheet
However, when I run my Cuke features and RSpec tests, the gem is
loaded up fine, and xls files are read and written as intended - it is
only a problem when I run the app directly from the command line.
I presume this is a problem with my ruby installation, or environment.
I have looked through the Pickaxe book ref Environment, but culdn't
find anything to help - and I can't find anything on the site for the
gem in respect of any support, so if someone could point me in the
right direction, I'd be eternally grateful.
Ubuntu 10.04
Ruby 1.8.7

You must manually require rubygems in 1.8.x.  In 1.9.x this is no longer
necessary.  Either add require 'rubygems' before require 'spreadsheet'
or run the program with ruby -r rubygems.

I suspect the reason it works from rspec/cucumber is because there are
themselves gems and must require rubygems to operate.


App structure:
[application root folder]
     [bin]
         application (chmod +x)
     [lib]
         application.rb (all require statements in here)
         [application]
             ...
             modules
         [features]
             ...
             cuke feature files
         [spec]
             ...
             RSpec spec files
If anyone can help I'd appreciate it. At the moment, I can only run
the app via Cucumber or RSpec, and I need to run it directly from the
command line.

Paul- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -

Thanks, makes sense.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top