App-Followme

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

1.15 2015-06-08T23:01:40Z
    - made Test::Requires a requirement

1.14 2015-06-06T10:47:19Z
    - revised tests to use Test::Requires

1.13 2015-06-04T23:12:11Z
    - make other modules optional

1.12 2015-05-25T00:22:22Z
    - updated code to generate initial website
    - added CreateGallery module to create photo galleries
    - added EditSections module to edit section tags on website
    - added bundle.pl script to modify initial website

1.11 2014-12-08T00:04:05Z
    - modified UploadSite: cd to top directory before run
    - modified UploadSite: fix checksum computation

1.10 2014-05-05T15:26:10Z
    - updated template handling code to match Template::Twostep
    - change get_template to use current version of file to be rendered

1.09 2014-04-21T23:40:09Z
    - Fixed typos
    - added each command to Template

1.07 2014-04-11T23:06:54Z
    - Updated documentation
    - Changed tests for better error reporting

README.md  view on Meta::CPAN


App::Followme::Guide - How to install, configure, and run followme

# SYNOPSIS

    followme [directory]

# DESCRIPTION

Updates a static website after changes. Constant portions of each page are
updated to match, text files are converted to html, indexes are created
for files in the archive, and changed files are uploaded to the remote server.

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. In
addition, the script is run in quick mode, meaning that only the directory
the file is in is checked for changes. Otherwise, not only that directory, but
all directories below it are checked.

README.md  view on Meta::CPAN

The first page will serve as a prototype for the rest of your site. When you
look at the html page, you will see that it contains comments looking like

    <!-- section primary -->
    <!-- endsection primary -->

These comments mark the parts of the prototype that will change from page to
page from the parts that are constant across the entire site. Everything
outside the comments is the constant portion of the page. When you have
more than one html page in the folder, you can edit any page, run followme,
and the other pages will be updated to match it.

So you should edit your first page and add any other files you need to create
the look of your site, such as the style sheets.

You can also use followme on an existing site. Run the command

    followme --init

in the top directory of your site. The init option will not overwrite any
existing files in your site. Then look at the convert page template it has
created:

    cat _templates/convert_page.htm

Edit an existing page on your site to have all the section comments in this
template. In the template shipped with this package there are three section
names: meta, primary, and secondary. The meta section is in the html header
and contains the page metadata, although it may also contain other content
tht varies between pages. The primary section contains the page content that
is maintained by you. None of this package's modules will change it. The
secondary section contains content that is updated by the modules in this
package and you will not normally change it.

After you edit a single page, you can place the App::Followme::EditSections
module in the configuration file, after the run\_efore line:

    run_before:
        - App::Followme::EditSections
        - App::Followme::FormatPage
        - App::Followme::ConvertPage

README.md  view on Meta::CPAN

    modified page. Each web page has sections that are different from other pages
    and other sections that are the same. The sections that differ are enclosed in
    html comments that look like

        <!-- section name-->
        <!-- endsection name -->

    and indicate where the section begins and ends. When a page is changed, this
    module checks the text outside of these comments. If that text has changed. the
    other pages on the site are also changed to match the page that has changed.
    Each page updated by substituting all its named blocks into corresponding block
    in the changed page. The effect is that all the text outside the named blocks
    are updated to be the same across all the web pages.

    In addition to normal section blocks, there are per folder section blocks.
    The contents of these blocks is kept constant across all files in a folder and
    all subfolders of it. If the block is changed in one file in the folder, it will
    be updated in all the other files. Per folder section blocks look like

        <!-- section name in folder_name -->
        <!-- endsection name -->

    where folder\_name is the the folder the content is kept constant across. The
    folder name is not a full path, it is the last folder in the path.

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

    This module changes text files to html files. By default the text files are

README.md  view on Meta::CPAN

- [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)

README.md  view on Meta::CPAN

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"

lib/App/Followme.pm  view on Meta::CPAN

own configuration file. If they contain modules, they will be run on that folder
and all the subfolders below it.

Followme is run from the folder it is invoked from if it is called with no
arguments, or if it is run with arguments, it will run on the folder passed as
an argument or the folder the file passed as an argument is contained in.
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, it should be run from the
directory containing the file.

When followme is run, it searches the directories above it for configuration
files. The topmost file defines the top directory of the website. It reads each
configuration file it finds and then starts updating the directory passed as an
argument to run, or if no directory is passed, the directory the followme script
is run from.

Configuration file lines are organized as lines containing

lib/App/Followme/FormatPage.pm  view on Meta::CPAN

# Initialize the extension

sub setup {
    my ($self) = @_;

    $self->{extension} = $self->{web_extension};
    return;
}

#----------------------------------------------------------------------
# Determine if page matches prototype or needs to be updated

sub unchanged_prototype {
    my ($self, $prototype, $page, $prototype_path) = @_;

    my $prototype_checksum =
        $self->checksum_prototype($prototype, $prototype_path);

    my $page_checksum =
        $self->checksum_prototype($page, $prototype_path);

lib/App/Followme/FormatPage.pm  view on Meta::CPAN

recently modified page. Each web page has sections that are different from other
pages and other sections that are the same. The sections that differ are
enclosed in html comments that look like

    <!-- section name-->
    <!-- endsection name -->

and indicate where the section begins and ends. When a page is changed, this
module checks the text outside of these comments. If that text has changed. the
other pages on the site are also changed to match the page that has changed.
Each page updated by substituting all its named blocks into corresponding block
in the changed page. The effect is that all the text outside the named blocks
are updated to be the same across all the web pages.

Updates to the named block can also be made conditional by adding an "in" after
the section name. If the folder name after the "in" is included in the
prototype_path hash, then the block tags are ignored, it is as if the block does
not exist. The block is considered as part of the constant portion of the
prototype. If the folder is not in the prototype_path, the block is treated as
any other block and varies from page to page.

    <!-- section name in folder -->
    <!-- endsection name -->

lib/App/Followme/Guide.pm  view on Meta::CPAN


App::Followme::Guide - How to install, configure, and run followme

=head1 SYNOPSIS

    followme [directory]

=head1 DESCRIPTION

Updates a static website after changes. Constant portions of each page are
updated to match, text files are converted to html, indexes are created
for files in the archive, and changed files are uploaded to the remote server.

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. In
addition, the script is run in quick mode, meaning that only the directory
the file is in is checked for changes. Otherwise, not only that directory, but
all directories below it are checked.

lib/App/Followme/Guide.pm  view on Meta::CPAN

The first page will serve as a prototype for the rest of your site. When you
look at the html page, you will see that it contains comments looking like

   <!-- section primary -->
   <!-- endsection primary -->

These comments mark the parts of the prototype that will change from page to
page from the parts that are constant across the entire site. Everything
outside the comments is the constant portion of the page. When you have
more than one html page in the folder, you can edit any page, run followme,
and the other pages will be updated to match it.

So you should edit your first page and add any other files you need to create
the look of your site, such as the style sheets.

You can also use followme on an existing site. Run the command

   followme --init

in the top directory of your site. The init option will not overwrite any
existing files in your site. Then look at the convert page template it has
created:

   cat _templates/convert_page.htm

Edit an existing page on your site to have all the section comments in this
template. In the template shipped with this package there are three section
names: meta, primary, and secondary. The meta section is in the html header
and contains the page metadata, although it may also contain other content
tht varies between pages. The primary section contains the page content that
is maintained by you. None of this package's modules will change it. The
secondary section contains content that is updated by the modules in this
package and you will not normally change it.

After you edit a single page, you can place the App::Followme::EditSections
module in the configuration file, after the run_efore line:

    run_before:
        - App::Followme::EditSections
        - App::Followme::FormatPage
        - App::Followme::ConvertPage

lib/App/Followme/Guide.pm  view on Meta::CPAN

modified page. Each web page has sections that are different from other pages
and other sections that are the same. The sections that differ are enclosed in
html comments that look like

    <!-- section name-->
    <!-- endsection name -->

and indicate where the section begins and ends. When a page is changed, this
module checks the text outside of these comments. If that text has changed. the
other pages on the site are also changed to match the page that has changed.
Each page updated by substituting all its named blocks into corresponding block
in the changed page. The effect is that all the text outside the named blocks
are updated to be the same across all the web pages.

In addition to normal section blocks, there are per folder section blocks.
The contents of these blocks is kept constant across all files in a folder and
all subfolders of it. If the block is changed in one file in the folder, it will
be updated in all the other files. Per folder section blocks look like

    <!-- section name in folder_name -->
    <!-- endsection name -->

where folder_name is the the folder the content is kept constant across. The
folder name is not a full path, it is the last folder in the path.

=item L<App::Followme::ConvertPage>

This module changes text files to html files. By default the text files are

lib/App/Followme/Guide.pm  view on Meta::CPAN

=item L<App::Followme::CreateGallery>

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 
L<App::Followme::CreateIndex>, but the template is more complex, so it is a 
separate module.

=item L<App::Followme::CreateRss>

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.

=item L<App::Followme::CreateSitemap>

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.

=item L<App::Followme::UploadSite>

lib/App/Followme/Guide.pm  view on Meta::CPAN

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
(<!-- -->). 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"

lib/App/Followme/Initialize.pm  view on Meta::CPAN

</div>
</header>
<article>
<section id="primary">
<!-- section primary -->
<h2>Followme</h2>

<p>Usage: followme [file or directory]</p>

<p>Update a static website after changes. Constant portions of each page are
updated to match, text files are converted to html, and indexes are created
for new files in the archive.</p>

<p>The script is run on the directory or file passed as its argument. If no
argument is given, it is run on the current directory.</p>

<p>If a file is passed, the script is run on the directory the file is in. In
addition, the script is run in quick mode, meaning that only the directory
the file is in is checked for changes. Otherwise not only that directory, but
all directories below it are checked.</p>

lib/App/Followme/Module.pm  view on Meta::CPAN


=item %configuration = $self->read_configuration($filename, %configuration);

Update the configuraion parameters by reading the contents of a configuration
file.

=item $page = $self->reformat_file(@files);

Reformat a file using one or more prototypes. The first file is the
prototype, the second, the subprototype, and the last file is the file to
be updated.

=item $page = $self->render_file($template_file, $file);

Render a file as html using a template. The data subpackage is used to
retrieve the data from the file.

=item $file = $self->to_file($file);

A convenience method that converts a folder name to an index file name,
otherwise pass the file name unchanged.

script/followme  view on Meta::CPAN


#----------------------------------------------------------------------
# Print the help file

sub show_help {
    print <<'EOQ';

Usage: followme [file or directory]

Update a static website after changes. Constant portions of each page are
updated to match, text files are converted to html, and indexes are created
for new files in the archive.

The 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. In
addition, the script is run in quick mode, meaning that only the directory
the file is in is checked for changes. Otherwise not only that directory, but
all directories below it are checked.

script/followme  view on Meta::CPAN


followme - Simple static website creation and maintenance

=head1 SYNOPSIS

followme [file or directory]

=head1 DESCRIPTION

Updates a static website after changes. Constant portions of each page are
updated to match, text files are converted to html, and indexes are created
for files in the archive.

The 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. In
addition, the script is run in quick mode, meaning that only the directory
the file is in is checked for changes. Otherwise not only that directory, but
all directories below it are checked.



( run in 0.415 second using v1.01-cache-2.11-cpan-05444aca049 )