0

I am trying to load rubywrite and run one of the examples but this is throwing me the error below:-

/usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- rubywrite/exceptions (LoadError)
    from /usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/ankit/Downloads/Studies/PLI/Assignment2/RubyWrite/lib/rubywrite.rb:1:in `<top (required)>'
    from pcc.rb:4:in `require_relative'
    from pcc.rb:4:in `<main>'

I am not sure what needed to be done. My Ruby version is :

- ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

My gem env is :-

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.25
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/lib/ruby/gems/1.9.1
     - /home/ankit/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/
BlackHatSamurai
  • 23,275
  • 22
  • 95
  • 156
Gearloose
  • 3
  • 2

2 Answers2

1

The current directory is not included on the library include paths by default.

You may add it explicitly on the Ruby command line using the -I option:

ruby -I. the_file.rb
Dave Newton
  • 158,873
  • 26
  • 254
  • 302
0

Use 'require_relative' and specify the full path of the file you want to include. The problem is that 'require' only looks at files that are in Ruby's library path. See also: What is the difference between require_relative and require in Ruby?

Community
  • 1
  • 1
Reck
  • 7,966
  • 2
  • 20
  • 24