--------------------------------------------------------------------------------
                    Simple Backup System for RJ TextEdit
                            ver 1.0 * 2015-01-29
--------------------------------------------------------------------------------
  You can get help at http://www.rj-texted.se/Forum/viewtopic.php?f=11&t=3236
--------------------------------------------------------------------------------

1) What it does
2) Requirements
3) Assumptions
4) How it works
5) History of changes
6) License

1) WHAT IT DOES

    Goal of Simple Backup System for RJ TextEdit (SBS) is to store, depending on
    your configuration and backup mode you've chosen, all or some files located
    in a given project directory and its subdirectories. The archive is saved
    into #backup subdirectory. There are two modes for backup: full and partial.

    Full backup
    a) if there's full.txt file in #backup subdirectory with list of wildcards
       (e.g. extensions, one per line), only files with matching names/extensions
       are backed up (this is to avoid adding to archive big auxiliary blob
       files, like images etc.)

    b) if there's no such file, all files are backed up

    Partial backup
    a) only open files (and only those that are located in the same directory as
       the current one) are backed up

    RJ TE project need not to be defined nor open in Project Manager, as it is
    assumed that your files are located in the same directory as the current
    document (provided that this directory is under directory defined below as
    rootDir -- otherwise script dies gracefully.)

    During script run you can add comment (in fact you are encouraged to do so!)
    to the archive.

    Name of each archive contains date and time (hh:mm) of its creation, e.g.
    partial.2015-01-29@10h24m.7z

    In case #backup subdirectory doesn't exist in rootDir/projectName, it is
    created by backup.bat.

    Information about subsequent backups (mode, date & time, comment) are logged
    into backup.log file in #backup subdirectory.

2) REQUIREMENTS

    You need RJ TE in version at least 10.20 to run this script.

    Script expects that you have 7za.exe installed in C:\Program Files\7za
    directory. If you don't have 7za.exe, you can download it for free from
    http://www.7-zip.org/download.html -- just make sure you're downloading the
    **command line version**, i.e. 7za (it comes in both 32 and 64bit flavors).

    In case you use a firewall make sure backup.bat has permission to run.

3) ASSUMPTIONS

    It is assumed that:
    *   all your project directories are located under the same root directory,
        e.g. E:\projects (= rootDir)
    *   you have backup.bat in rootDir (this is not checked by script!)
    *   you may place backup.js script wherever you want to

4) HOW IT WORKS

    When you run backup.js (you may want to install it as a tool in Tools >
    Configure Tools... > Add; no special settings other than "Command" field
    are necessary), it shows a dialog window, in which you can chose between two
    available backup modes (full and partial); then you can add comment to your
    backup. When you're done and click on OK, script calls backup.bat, which in
    turn calls 7za with appropriate parameters.

    Both files are decently commented, in case you need to tweak anything.

5) HISTORY OF CHANGES

    ver. 1.0, 28.01.2015
    - initial release

6) BEERWARE LICENSE

    PJJ wrote this script. As long as you retain this notice, you can do with it
    ("it" meaning both this script and its companion "backup.bat" file) whatever
    you want. If we meet some day, and you think this stuff is worth it, you can
    buy me a beer in return.