|N U T S H E L L|
|Platform||any Java-supported (Windows,Linux,...)|
Creating archive: /usr/ms/devel/cleancode/js/MenuArchive.js file: ../netscape/ua.js (compressed 59% / saved 41%) --------- file: ../cooldev/coolmenu.js (compressed 89% / saved 11%) class: get methods: check, div --------- file: ccmenu_local.js (compressed 56% / saved 44%) --------- file: ../cleancode/util/NavKeys.js (compressed 19% / saved 81%) class: NavKeys methods: init, assignKeys --------- Archive '/usr/ms/devel/cleancode/js/MenuArchive.js' complete (compressed 64% / saved 36%). 4 file(s) processed.
Default program operation creates a log file, as shown above, but you will see nothing on the command-line, except in the case of errors. JSArchive is designed that way so it may be used either as a command-line utility or called programmatically as a library component. From the command-line, however, it is often useful to have feedback from the program while it runs as well. Simply use the verbose command-line flag (-v) and you'll then get output as shown below, similar to the log file shown above:
C:\usr\ms\devel\js\ccwebpages>java com.cleancode.format.JSArchive -v -c -o "/usr /ms/devel/cleancode/js/MenuArchive.js" ../netscape/ua.js ../cooldev/coolmenu.js ccmenu_local.js ../cleancode/util/NavKeys.js Creating archive: /usr/ms/devel/cleancode/js/MenuArchive.js ../netscape/ua.js... 59% ../cooldev/coolmenu.js... 89% ccmenu_local.js... 56% ../cleancode/util/NavKeys.js... 19% Archive '/usr/ms/devel/cleancode/js/MenuArchive.js' complete (compressed 64% / s aved 36%). 4 file(s) processed.
In this illustration, MenuArchive.js is the target archive to be created. Four files will be consolidated into this single archive file. Because of the compression flag (-c), the files will be compressed while being consolidated, stripping out most unnecessary whitespace.
Inside the archive, JSArchive adds an initial comment block specifying the name of the archive, the creation date, the version of the generator, and the command that created it. Here's an example:
////////////////////////////////////////////////////////////////////////////// // Archive: MenuArchive.js // Created: Fri Apr 02 12:50:41 MST 2004 // Generator: JSArchive [1.12] // // The command line arguments to generate this file: // com.cleancode.format.JSArchive -v -c -o MenuArchive.js // nc:../../cleancode-support/license/mpl-c.txt ../netscape/ua.js // ../cooldev/coolmenu.js ../cleancode/Util/Version.js ccmenu_local.js // ../cleancode/Util/NavKeys.js // // This file was generated automatically and should not be edited manually. //////////////////////////////////////////////////////////////////////////////
Then, in front of each file, JSArchive also records the file name, how much it was compressed, and its last modification date, e.g.:
// ../cleancode/util/NavKeys.js (compressed 23% / saved 77%) // last modified: Sat Nov 22 20:40:48 GMT-07:00 2003
One handy--and unique--feature of JSArchive is that you may selectively choose
to leave specific files uncompressed while compressing all the rest.
A common use for this is to add a comment block at the top of a file
that contains license and copyright information.
In the above example, you'll see the license file added, including
nc: prefix, specifying no compression.