[REBOL] Version Report Utility
From: coussement::c::itc::mil::be at: 18-Jan-2001 14:32
Hi REBOL's
Because I've to work with a lot of scripts and data files which are updated
very often, I needed an utility I could use to verify that the right version
is on the right place.
The simplicity and the pragmatic approach of REBOL is constantly astonishing
me when dealing with things you might IMHO consider as complex with other
languages.
BTW I'm just wondering how many recursions could REBOL handle ? Did anyone
try a little stress-test ?
Anyway, the utility could be of some use for someone:
;--------------------------------------------------------------------
rebol [
title: "Version Report Utility"
date: 17-Jan-2001
version: 1.0.0
author: "C. COUSSEMENT"
Email: [coussement--c--itc--mil--be]
purpose: {report version number for all files found with a header
starting from a provided root directory}
history: [
0.1.0 [17-Jan-2001 { Original code - Alpha } "COU"]
1.0.0 [17-Jan-2001 { production version } "COU"]
]
]
root-dir: make file! ask "Root Directory where to begin the search ? :=> "
print ["Searching in" root-dir "..."]
search-file: func [
root [file!]
][
foreach item read root [
item: rejoin [root item]
either (last item) = #"/" [
;--- if dir, let's recurse
print [newline "Searching in" item "..."]
search-file item
][
;--- if file
if not error? try [ver: get in first load/header item 'version][
print [">" item "--> ver :" ver]
]
]
]
]
search-file root-dir
print [newline "Done ..."]
;--------------------------------------------------------------------
here is an example of output it generates:
;---- snip -------------------------
>> do %version-report.r
Root Directory where to begin the search ? :=> /i/cybercat/
Searching in /i/cybercat/ ...
Searching in /i/cybercat/network/ ...
Searching in /i/cybercat/network/archive/ ...
> /i/cybercat/network/archive/ cat-install.ini --> ver : none
Searching in /i/cybercat/network/DB/ ...
> /i/cybercat/network/DB/cybercat-m.rdb --> ver : 1.0.0
Searching in /i/cybercat/network/image/ ...
Done ...
;---- end snip -----------------
Hope this helps!
cheers,
chr==