App-Followme

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

    after it has been converted to html. The title is built from the title of
    the file if one is put at the top of the file. If the file has no
    title, it is built from the file name, replacing dashes with blanks and
    capitalizing each word, The url and absolute\_url are built from the html file
    name. To change the look of the html page, edit the page template. Only blocks
    inside the section comments will be in the resulting page, editing the text
    outside it will have no effect on the resulting page. A complete listing of the
    variables is given in the variables section.

- [App::Followme::CreateIndex](https://metacpan.org/pod/App%3A%3AFollowme%3A%3ACreateIndex)

    This module builds an index for a directory containing links to all the files
    with the specified extension contained in it. The same variables mentioned above
    are calculated for each file, with the exception of body. Comments that look like

        <!-- for @files -->
        <!-- endfor -->

    indicate the section of the template that is repeated for each file contained
    in the index.

- [App::Followme::CreateGallery](https://metacpan.org/pod/App%3A%3AFollowme%3A%3ACreateGallery)

    Create a photo gallery for images in a directory. Each image must have a 
    thumbnail image whose name has the suffix "-thumb". The suffix name is a 
    configuration parameter. The code is very similar to 
    [App::Followme::CreateIndex](https://metacpan.org/pod/App%3A%3AFollowme%3A%3ACreateIndex), but the template is more complex, so it is a 
    separate module.

- [App::Followme::CreateRss](https://metacpan.org/pod/App%3A%3AFollowme%3A%3ACreateRss)

    This module creates an rss file from the metadata of the most recently updated 
    files in a directory. It is a companion to App::Followme::CreateIndex and should
    be used if you also want an rss file.

- [App::Followme::CreateSitemap](https://metacpan.org/pod/App%3A%3AFollowme%3A%3ACreateSitemap)

    This module creates a sitemap file, which is a text file containing the url of
    every page on the site, one per line. It is also intended as a simple example of
    how to write a module that can be run by followme.

- [App::Followme::UploadSite](https://metacpan.org/pod/App%3A%3AFollowme%3A%3AUploadSite)

    This module uploads changed files to a remote site. The default method to do the
    uploads is local copy, but that can be changed by changing the parameter upload\_pkg.
    This package computes a checksum for every file in the site. If the checksum has
    changed since the last time it was run, the file is uploaded to the remote site.
    If there is a checksum, but no local file, the file is deleted from the remote
    site. If followme is run in quick mode, only files whose modification date is
    later then the last time it was run are checked.

# RUNNING

The followme script is run on the directory or file passed as its argument. If
no argument is given, it is run on the current directory. If a file is passed,
the script is run on the directory the file is in and followme is run in
quick mode. Quick mode is an implicit promise that only the named file has
been changed since last time. Each module can make of this assumption what it
will, but it is supposed to shorten the list of files examined.

Followme looks for its configuration files in all the directories above the
directory it is run from and runs all the modules it finds in them. But they are
are only run on the folder it is run from and subfolders of it. Followme only
looks at the folder it is run from to determine if other files in the folder
need to be updated. So after changing a file, followme should be run from the
directory containing the file.
Templates support the basic control structures in Perl: "for" loops and
"if-else" blocks. Creating output is a two step process. First you generate a
subroutine from one or more templates, then you call the subroutine with your
data to generate the output.

The template format is line oriented. Commands are enclosed in html comments
(&lt;!-- -->). A command may be preceded by white space. If a command is a block
command, it is terminated by the word "end" followed by the command name. For
example, the "for" command is terminated by an "endfor" command and the "if"
command by an "endif" command.

All lines may contain variables. As in Perl, variables are a sigil character
('$' or '@') followed by one or more word characters. For example, `$name` or
`@names`. To indicate a literal character instead of a variable, precede the
sigil with a backslash. When you run the subroutine that this module generates,
you pass it a metadata object. The subroutine replaces variables in the template
with the value in the field built by the metadata object.

If the first non-white characters on a line are the command start string, the
line is interpreted as a command. The command name continues up to the first
white space character. The text following the initial span of white space is the
command argument. The argument continues up to the command end string.

Variables in the template have the same format as ordinary Perl variables,
a string of word characters starting with a sigil character. for example,

    $body @files

are examples of variables. Array variable names (variable names starting with 
a `@`) may have a suffix that indicates how the array is sorted. You can add
a suffix to a scalar variable (variable names strting with a `$`) but it
will have no effect. The format for the name is:

    @data_field[_by_$sort_field][_reversed]

the brackets are not part of the variable name. They are there to indicate that 
these sections are optional. Two examples of variables with sort suffixes are

    @files_by_size
    @all_files_by_mdate_reversed

The second suffix, \_reversed, indicates that the variable is sorted from 
largest to smallest instead of the usual format, from smallest to largest.
When used with date fields \_reversed indicates the variable is sorted from 
most recent to oldest.

The following commands are supported in templates:

- do

    The remainder of the line is interpreted as Perl code.

- for

    Expand the text between the "for" and "endfor" commands several times. The
    argument to the "for" command should be an expression evaluating to a list. The
    code will expand the text in the for block once for each element in the list.



( run in 1.986 second using v1.01-cache-2.11-cpan-98e64b0badf )