[Uw-ruby] Where do you start for week 6's homework?

Ryan Davis ryand-uwruby at zenspider.com
Tue Nov 13 11:45:20 PST 2007


On Nov 11, 2007, at 21:43 , Feng Tien wrote:

> I'm just totally lost, did I miss something when I left right after  
> the
> lecture?
>
> Are you suppose to use find.rb to do this?
>
> Is this the format you're suppose to have?
>
> pgrep -i error /var/log/system.log http://www.example.com/status.txt
>
> or would it be something like: pgrep(error,-I, /var/log/system.log,
> http://www.example.com/status.txt) to run it?

Garrick's answer is a bit more ethereal... I'll try to be a bit more  
concrete.

Yes, this is supposed to be a command-line tool, but your ruby code  
(excluding the lack of quotes) looks like a good design start. One way  
to structure this is to add a 'bin' dir with 'powergrep' inside (or  
powergrep.rb--whatever). That code would look something like:

require 'powergrep'

grep = Powergrep.new

# process options / set stuff up

grep.run *ARGV

----

That way you can write easily testable code but still have command- 
line ease of use.



More information about the Uw-ruby mailing list