From: Sam Duncan Date: 2011-10-18T04:35:32+09:00 Subject: Re: noobie question - how do I run this command-line program? On 18/10/11 08:19, Jon Crowell wrote: > Hi. I downloaded a tiny ruby app called EarGTD and I am trying to get > it to run at the command line. It is a simple program consisting of > about four files. You can read about it here: > http://oreilly.com/pub/a/ruby/2007/06/21/how-to-build-simple-console-apps-with-ruby-and-activerecord.html > > When I download and unzip the file, I get the following directory structure: > > EarGTD/ > .DS_Store > Rakefile > data/ > test_ear_gtd.db > earGTD* > lib/ > ear_gtd.rb > test/ > test_ear_gtd.rb > > > The entire contents of the earGTD file, which is the file which > launches the app, are as follows: > > #!/usr/bin/env ruby > require "lib/ear_gtd" > EarGTD.connect > EarGTD.process_command(ARGV) > > > The problem I am having is that when I launch the app, I get the > following error: > > :29:in `require': no such file > to load -- lib/ear_gtd (LoadError) > from:29:in `require' > from ./earGTD:2:in `
' > > I understand that the earGTD is trying to load lib/ear_gtd.rb - which > is in the lib file in the same directory. But for some reason the > ruby path loading system doesn't know how to find it. I have modified > /etc/bashrc to put my current directory in the $PATH, but that didn't > make a difference. > > If you can tell me what is going on, I would much appreciate it. > > Thanks, > > Jon Could you try; ruby -I/path/to/EarGTD /path/to/EarGTD/earGTD This will tell ruby to add that path to the LOAD_PATH before running the script. I don't think Ruby searches your path - which is no doubt for security reasons. Sam