EvdB has asked for the wisdom of the Perl Monks concerning the following question:

Before commiting files to my CVS repository I would like some checks to be run:
# Todo before commiting for *.pl, *.pm, *.PL perl -c $file perltidy -b $file ./Build test
I seem to remember that this can be done but cannot find anything here or on Google that helps. I'm probably not using the right jargon. Does anyone have a way to do this and are there other things that should be done before a commit?

update: Sod's law: Automating tests before a CVS commit. Still interested in other things that could/should be done before a commit.

--tidiness is the memory loss of environmental mnemonics

Replies are listed 'Best First'.
Re: Automating tests before a CVS commit
by davorg (Chancellor) on Jul 08, 2004 at 09:59 UTC
    You can add these items you your project's "commitinfo" file.
    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

      I'm having trouble getting this working as I want it to.
      --- commitinfo --- pl$ $CVSROOT/CVSROOT/commit-perl.bash pm$ $CVSROOT/CVSROOT/commit-perl.bash PL$ $CVSROOT/CVSROOT/commit-perl.bash --- commit-perl.bash --- #!/bin/bash perl -c $1 || exit 1 perltidy -b $1 || exit 1 --- sample.pl --- #!/usr/bin/perl my $test = '";
      I am still allowed to commit sample.pl, even though I shouldn't be. Any suggestions.

      Also I would like to run tests locally (ie not on server). Can this be done?.

      --tidiness is the memory loss of environmental mnemonics

Re: Automating tests before a CVS commit
by iburrell (Chaplain) on Jul 08, 2004 at 16:15 UTC
    CVS does not support running scripts on the client before doing a commit. It does have a mechanism, the commitinfo file, for running commands on the server before doing a commit. The program can abort the commit by returning a non-zero exit code.