Module::Build and gzip

jonasbn on 2008-07-18T19:01:32

I sometimes go into a loop where my workflow contains pushing a distribution several times to application host. I prefer working in the editors on my local machine and not in vi/vim on the application hosts (and then I have to pull back stuff to stick it in CVS).

This takes quite a few commands since I have to push it via a jump host via SSH. So I attempt to make the commands I have in my history as one-linerish as possible so I do not have to skip through several steps.

I have been cursing at Module::Build's ./Build dist, since it kept prompting me to decide whether I wanted to overwrite the existing tar-ball with the same name, being the product of the command.

gzip even has a force flag!

Today I went back and had a look at the docs and I fell over the --gzip option.

So now my command looks like this:

% ./Build dist --gzip='/usr/bin/gzip --force'; scp somedistribution-1.00.tar.gz jonasbn@jumphost:~/
I a do not have to answer yes everytime I want to deploy a new distribution.

Next step would be to make the jump host transparent so stuff would go to the designated application server on the other site, I am sure this can be done,propably involving some serious tunneling - I just not had the time to figure out how and we do have quite a few application servers, so I have to figure out some nifty approach.

Hints are welcome...


Subclass Module::Build

dagolden on 2008-07-18T20:04:44

Write your own "Build deploy" action?

# Build.PL
use strict;
use Module::Build;

my $class = Module::Build->subclass(
    class => "Module::Build::jonasbn",
    code => <<'SUBCLASS', );

    sub ACTION_deploy {
        my $self = shift;
        $self->depends_on('dist'); # create tarball
        # add code here to scp
    }

SUBCLASS

$class->new( %normal_mb_args )->create_build_script;

Re:Subclass Module::Build

jonasbn on 2008-08-26T07:31:14

I have done several subclasses of Module::Build and I actually already have one for this client, so I could just extend it.

Thanks for the feedback,

jonasbn