App-GitHooks

 view release on metacpan or  search on metacpan

bin/githooks  view on Meta::CPAN


=item * C<version> - Display the version of App::GitHooks in use.

=back


=head1 OPTIONS

=over 4

=item * C<--chmod> - Chmod to use for the git hooks (default: 755).

=back

=cut

# Parse the action.
my $action = shift( @ARGV );
usage()
	if !defined( $action ) || $action eq '';

# Parse command-line options.
my $chmod = '0755';
Getopt::Long::GetOptions(
	'chmod'     => \$chmod,
);

# List of supported hooks we'll need to set up.
my $supported_hooks = $App::GitHooks::HOOK_NAMES;

# Actions.
my $actions =
{
	help      => \&usage,
	install   => \&install,

bin/githooks  view on Meta::CPAN

		my $hook_filename = File::Spec->catfile( $hooks_directory, $hook_name );

		try
		{
			# Write the hook file.
			open( my $hook_fh, '>', $hook_filename );
			print $hook_fh $hook_content;
			close( $hook_fh );

			# Make the hook file executable.
			chmod oct( $chmod ), $hook_filename;
		}
		catch
		{
			$errors++;
			print "Unable to set up hook file for $hook_name, skipped: $_\n";
		};
	}

	print $errors > 0
		? 'Some errors occurred when installing the git hooks, please try again.'

lib/App/GitHooks/Test.pm  view on Meta::CPAN

						lives_ok(
							sub
							{
								Path::Tiny::path( $hook_path )
									->spew( $hook_template );
							},
							'Write the hook.',
						);

						ok(
							chmod( 0755, $hook_path ),
							"Make the $hook_name hook executable.",
						);
					}
				);
			}

			# Set up a .githooksrc config.
			lives_ok(
				sub
				{



( run in 0.559 second using v1.01-cache-2.11-cpan-496ff517765 )