The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::GitHooks::Plugin::ForceRegularUpdate - Force running a specific tool at regular intervals.

DESCRIPTION

# TODO: description of how to write a tool that generates the timestamp file.

VERSION

Version 1.0.5

CONFIGURATION OPTIONS

This plugin supports the following options in the [BlockProductionCommits] section of your .githooksrc file.

        [BlockProductionCommits]
        max_update_age = 2 * 24 * 3600 # 2 days
        description = ./my_updater.sh
        env_variable = my_environment
        env_safe_regex = /^development$/
        update_file = /var/local/.last_update.txt

max_update_age

This indicates the maximum amount of time that may have elapsed since the last update, before commits are blocked.

        max_update_age = 2 * 24 * 3600 # 2 days

Note that this configuration option supports comments at the end, for readability.

description

The name of the tool to run to perform an update that will reset the time counter.

        description = ./my_updater.sh

env_variable

Optional, the name of the environment variable to use to determine the environment (production, staging, development, etc).

        env_variable = my_environment

env_regex

Optional, but required if env_variable is used.

A regular expression that indicates that this plugin should be run when it is matched.

        env_safe_regex = /^development$/

The example above only checks for regular updates when $ENV{'my_environment'} =~ /^development$/.

update_file

The path to the file that stores the unix time of the last upgrade. This is the file your update tool should write the current unix time to upon successful completion.

        update_file = /var/local/.last_update.txt

Note that you can use an absolute path, or a relative path. If relative, the path will be relative to the root of the current git repository.

METHODS

run_pre_commit()

Code to execute as part of the pre-commit hook.

  my $success = App::GitHooks::Plugin::ForceRegularUpdate->run_pre_commit();

BUGS

Please report any bugs or feature requests through the web interface at https://github.com/guillaumeaubert/App-GitHooks-Plugin-ForceRegularUpdate/issues/new. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

        perldoc App::GitHooks::Plugin::ForceRegularUpdate

You can also look for information at:

AUTHOR

Guillaume Aubert, <aubertg at cpan.org>.

COPYRIGHT & LICENSE

Copyright 2013-2016 Guillaume Aubert.

This code is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.

This program 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 LICENSE file for more details.