Alzabo-GUI-Mason

 view release on metacpan or  search on metacpan

inc/Alzabo/GUI/Mason/Build.pm  view on Meta::CPAN

package Alzabo::GUI::Mason::Build;

use strict;

use lib './lib', './blib';

use Module::Build 0.16;
use base 'Module::Build';

use Cwd;
use Data::Dumper;
use File::Path;
use File::Spec;

sub ACTION_install
{
    my $self = shift;

    $self->SUPER::ACTION_install;

    $self->depends_on('install_components');
}

sub ACTION_install_components
{
    my $self = shift;

    $self->_make_mason_dirs( 'schema' );

    require Alzabo::GUI::Mason::Config;
    my $base = Alzabo::GUI::Mason::Config::mason_web_dir();
    my $count = $self->_copy_dir( [ cwd(), 'mason' ],
                                  [ $base, 'schema' ] );
    if ($count)
    {
	warn <<'EOF';

Finished installing mason based schema creation interface.

EOF
    }
    else
    {
	warn <<'EOF';

No changes in mason based schema creation interface components.  No
files copied.

EOF
    }
}

sub _make_mason_dirs
{
    my $self = shift;

    $self->_get_uid_gid;

    require Alzabo::GUI::Mason::Config;
    my $base = Alzabo::GUI::Mason::Config::mason_web_dir();

    foreach (@_)
    {
        my $dir = File::Spec->catdir( $base, $_ );
	unless ( -d $dir )
	{
	    mkpath( $dir, 1, 0755 )
		or die "Can't make $dir dir: $!\n";
	    warn "chown $dir to $self->{Alzabo}{user}/$self->{Alzabo}{group}\n";
	    chown $self->{Alzabo}{uid}, $self->{Alzabo}{gid}, $dir
		or die "Can't chown $dir to $self->{Alzabo}{user}/$self->{Alzabo}{group}: $!\n?";



( run in 1.643 second using v1.01-cache-2.11-cpan-0d23b851a93 )