On 03/08/05, dave davidson <datapanix / gmail.com> wrote: > Hi all, > > I work in the SCM dept of a Windows software shop. A typical software build > involves us getting the code from an engineer, compiling the binaries, gathering > any support files, and then wrapping it in an installer (Installshield). We run > the installer to make sure everything looks ok. As quick-and-dirty sanity check > to make sure we got everything, we go into the install folder, do a 'dir /s', > and pipe the output to a text file. If the file list in the current build > matches the file list of the previous, we give it the ok. These lists are saved > on disk, printed and filed with the build paperwork so we can refer to them > again if necessary. > > This method works surprisingly well for catching files that were mistakenly > excluded, but as you can imagine it gets very tedious and error-prone since we > have to hand-check the output. Additionally, many times we are asked by the > engineer to include additional support files, or remove existing ones. I'm > thinking there must be a better way, or better yet, a Ruby Way :) > I am relatively new to the language, so I don't really know which angle to > attack it from. The basic gist would be to read in the previous file list > output, strip any junk (extra spaces, line breaks, etc), and do the same for the > current, so what's left is two lists of just pure filenames (don't care about > timestamps or attributes right now). The script would process the lists and the > result would be something like "Indentical" or "Extra files: [filenames]" or > "Removed files: [filenames]". > > I'm wondering if something like this already exists. A search of rubyforge and > RAA, however, did not turn up anything this specific, although I really wasn't > sure what I should be looking for. If I could be pointed to a base library that > would get me going, that would be great. Any insights on implementation would > also be greatly apprecited. Thanks! > > > Does this help? bschroed@black:~/svn/projekte/ruby-things$ ls -1 > before.list bschroed@black:~/svn/projekte/ruby-things$ touch another.one bschroed@black:~/svn/projekte/ruby-things$ ls -1 > after.list bschroed@black:~/svn/projekte/ruby-things$ irb irb(main):001:0> before = File.read('before.list').to_a => ["before.list\n", ...] irb(main):002:0> after = File.read('after.list').to_a => ["before.list\n", "after.list\n", "another.one\n", ...] irb(main):003:0> before - after => [] irb(main):004:0> after - before => ["after.list\n", "another.one\n"] regards, Brian -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/