From: Joe Cheng Date: 2003-07-05T01:37:59+09:00 Subject: seeking feedback on my first Ruby program I just took my first stab at writing a useful Ruby program. My programming background is mainly Java and C#, so I wonder if I'm really doing things the "Ruby Way". Would someone mind taking a look at my code and giving me feedback? http://www.joecheng.com/code/erb-site.rb.txt It's a command-line utility for making static websites using erb. It just recurses over a source directory, processing and copying files to a build directory. I'm including the full description below. Any feedback is appreciated... thanks... ---- Usage: erb-site.rb [options] -q, --quiet Suppress all messages but warnings and errors -v, --verbose Enable verbose logging -d, --debug Enable debug logging -wval, --watch val Change watch character to val (default is !!) -h, --help Detailed help NOTE: erb must be installed (tested with erb-2.0.3). erb-site can be used to run erb recursively over a directory that contains both erb and non-erb files. This is useful for creating static sites, for example. Use erb-site to process a directory that contains eRuby files (and other files)--your "source" directory. You also need to provide a "build" directory path (it doesn't need to exist, and in fact if it does exist, it will be recursively DELETED before processing begins). erb-site will crawl your source directory, and for each file it encounters: * with .!! extension (or with ".!!." in the filename) Process using erb, and save the results to the corresponding path in the build directory minus the .!! extension (or minus the ".!!." in the filename). You can use your own string in place of "!!" by specifying the --watch option. (Note that file.!!.txt, file.txt.!!, and file.!! all match, but file!!.txt and file!! do not.) * with .rb extension Ignore completely. This allows you to keep helper functions and modules in separate files without worrying about them getting into your deployment. * all other extensions Copied to corresponding build directory with no changes. For example, if this is your directory tree: source/ functions.rb <= ignored index.htm.!! <= processed guestbook.php <= copied contactme.!!.php <= processed images/ banner.gif <= copied private/ photos.!!.htm <= processed And you ran this command: erb-site.rb source build Your build directory would end up like this: build/ index.htm guestbook.php contactme.php images/ banner.gif private/ photos.htm