From: gwtmp01@... Date: 2007-01-20T05:08:59+09:00 Subject: Re: Automatically Determining "Requires" and "Provides" information for a Ruby script or library On Jan 19, 2007, at 9:57 AM, Scott Parkerson wrote: > Ideally, I should be able to 100% accurately identify what the script > provides, and *mostly* identify requires for dependencies. I don't think this is technically possible because of the dynamic nature of Ruby. That is to say that I think the task you describe is equivalent to the halting problem as it requires the ability to divine the intent of executable code by simply examining the code as opposed to running it and seeing what happens. There are certainly heuristics you could use to get pretty close to 100% for 'normal' code (searching for 'class X' and for 'require...'), but you'll never get to 100% and you'll probably have to re-implement a good portion of the Ruby parser in the process (i.e. to deal with nested classes/modules). That may be good enough for your needs though. Maybe there is something that already does that out there? Googling... Check out http://www.zenspider.com/ZSS/Products/ParseTree/index.html and http://www.zenspider.com/ZSS/Products/ParseTree/Examples/ Dependencies.html maybe that will give you some ideas. Gary Wright