NAME

App::GitHooks::Plugin::BlockProductionCommits - Prevent commits in a production environment.

DESCRIPTION

Committing in production means you've been developing in production. That just sounds like a terrible idea.

VERSION

Version 1.2.0

CONFIGURATION OPTIONS

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

[BlockProductionCommits]
env_variable = my_environment
env_safe_regex = /^development$/
remotes_whitelist_regex = /\/my_production_tools_repository\.git$/

env_variable

The name of the environment variable to use to determine the environment.

env_variable = my_environment

env_safe_regex

A regular expression that indicates that the environment is safe to commit when it is matched.

env_safe_regex = /^development$/

The example above only allow commits when $ENV{'my_environment'} =~ /^development$/.

remotes_whitelist_regex

A regular expression that indicates that commits should be allowed even if the environment is production as long as the git remote matches it.

This is particularly useful if you have many repositories on your production machines, and one of them is used by automated tools that should still be allowed to commit.

remotes_whitelist_regex = /\/my_production_tools_repository\.git$/

METHODS

run_pre_commit()

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

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

BUGS

Please report any bugs or feature requests through the web interface at https://github.com/guillaumeaubert/App-GitHooks-Plugin-BlockProductionCommits/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::BlockProductionCommits

You can also look for information at:

AUTHOR

Guillaume Aubert, <aubertg at cpan.org>.

COPYRIGHT & LICENSE

Copyright 2013-2017 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.