[Jspro-cvs] jsPro/scripts createREADME.pl,NONE,1.1
Brought to you by:
wigleys
|
From: <wi...@us...> - 2003-10-06 12:22:23
|
Update of /cvsroot/jspro/jsPro/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv20997
Added Files:
createREADME.pl
Log Message:
new README generation script
--- NEW FILE: createREADME.pl ---
#!/usr/bin/perl -w
# +-------------------------------------------------------------------------+
# | jsPro - README Creation Script |
# +-------------------------------------------------------------------------+
# | Copyright (C) 2001-2003 Stuart Wigley |
# +-------------------------------------------------------------------------+
# | This library is free software; you can redistribute it and/or modify it |
# | under the terms of the GNU Lesser General Public License as published by|
# | the Free Software Foundation; either version 2.1 of the License, or (at |
# | your option) any later version. |
# | |
# | This library is distributed in the hope that it will be useful, but |
# | WITHOUT ANY WARRANTY; without even the implied warranty of |
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser |
# | General Public License for more details. |
# | |
# | You should have received a copy of the GNU Lesser General Public License|
# | along with this library; if not, write to the Free Software Foundation, |
# | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
# +-------------------------------------------------------------------------+
# | Authors: Stuart Wigley <stu...@ya...> |
# +-------------------------------------------------------------------------+
# $Id: createREADME.pl,v 1.1 2003/10/06 12:22:19 wigleys Exp $
use strict;
# get the number of command line arguments
my $iNumArgs = $#ARGV + 1;
# where to look for the javascript files
my $jsFolder = "..";
if ($iNumArgs != 0) {
print "ERROR: Unexpected argument(s)\n";
} else {
&README;
}
exit;
#this subroutine generates the README file output
sub README {
&README_INTRO;
opendir(DIR, $jsFolder);
my $counter = 1;
my $sShortDesc;
while (my $filename = readdir(DIR)) {
if ($filename =~ m/\.js$/) {
open( FILE, "< $jsFolder/$filename" ) or die "Can't open $filename : $!";
print "$filename\n";
print "-------------------------------------------------------------------------------\n";
# for each line of the file
while (<FILE>) {
# remove the trailing newline character
chomp;
# get the @shortDesc value
if (m/\@summary(\s*)/) {
$sShortDesc = $';
}
# if the current line is a function definition
if (m/function\(/) {
# match the " =" on this line
/ \=/;
# print the output line and increment
print $counter . ". " . $` . "(): " . $sShortDesc . "\n";
$counter++;
# reset the shortDescription value ready for the next iteration
$sShortDesc = "";
}
}
print "\n";
close FILE;
}
}
&FOOTER;
}
# this subroutine prints the standard README header
sub README_INTRO {
print
"*******************************************************************************
* This software is OSI Certified Open Source Software. *
* OSI Certified is a certification mark of the Open Source Initiative. *
*******************************************************************************
jsPro by Stuart Wigley and Randolph T. Fielding
-------------------------------------------------------------------------------
jsPro is a set of object-based libraries that extend JavaScript with rich new
functionality. jsPro provides methods that extend the core classes (ie String,
Array, Math, Date) and implements new classes such as Chemica, Debug and Point.
In addition jsPro is developed to a high coding standard that includes modified
Hungarian Notation, structured error handling and JavaDoc style commenting.
This ensures that all methods in jsPro are readable, logical and easy to debug.
A lot of the methods used in these libraries have been inspired by functions
already available in PHP and other programming languages.
The aim of the project is simply to make jsPro the benchmark for high quality,
object-based functionality in JavaScript.
All improvements, suggestions, new methods and bug reports are welcome.
The following is a list of what has been implemented so far:
";
}
# this subroutine inserts a standard footer
sub FOOTER {
my $localTime = localtime();
print
"
This file was generated automatically: $localTime";
}
|