Pangloss

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

	       script => ['bin'],
	       web    => ['web'],
	       conf   => ['conf'],
	      );
    return $self->SUPER::install_base_relative($type) unless exists $map{$type};
    return catdir(@{$map{$type}});
}

sub ACTION_install {
    my $self = shift;
    my $base = $self->{properties}{install_base};

    print "\nInstalling Pangloss to $base...\n";
    my $ret  = $self->SUPER::ACTION_install( @_ );

    # worry about creating these dynamically if we ever include XS, etc:
    my $lib_dir = File::Spec->catdir( $base, 'lib' );
    my $man_dir = File::Spec->catdir( $base, 'man' );
    my $bin_dir = File::Spec->catdir( $base, 'bin' );

    print(
	  "\nInstallation Complete\n",
	  "---------------------\n\n",
	  "You should set the following environment variables:\n\n",
	  "\tPG_HOME  = $base\n",
	  "\tPERL5LIB = $lib_dir\n",
	  (-e $man_dir) ?
	  "\tMANPATH  = $man_dir\t[optional]\n" : (),
	  "\tPATH     = $bin_dir\t[optional]\n",
	  "\n",
	  "See the Pangloss::Install and Pangloss::Config pages for\n",
	  "more details on how to get your server up and running\n\n",
	 );

    return $ret;
}

sub ACTION_cover {
    my $self = shift;
    die "test coverage action not yet written!";
}

sub ACTION_test {
    my $self = shift;
    $self->add_to_cleanup( catfile(qw( t tmp )) );
    $self->SUPER::ACTION_test;
}

sub ACTION_build {
    my $self = shift;
    $self->SUPER::ACTION_build;
    $self->process_web_files
         ->process_conf_files;
}

sub process_web_files {
    my $self = shift;
    my $files = $self->find_web_files;
    while (my ($from, $to) = each %$files) {
	$to = catfile('blib', $to);
	$self->copy_if_modified(from => $from, to => $to );
    }
    return $self;
}

sub process_conf_files {
    my $self = shift;
    my $files = $self->find_conf_files;
    while (my ($from, $to) = each %$files) {
	$to = catfile('blib', $to);
	$self->copy_if_modified(from => $from, to => $to );
    }
    return $self;
}

sub find_web_files { shift->find_all_files_no_cvs( 'web' ) }

sub find_conf_files { shift->find_all_files_no_cvs( 'conf' ) }

sub find_all_files_no_cvs {
    my ($self, $dir) = @_;
    my $sub = sub {
	return 1 if ($File::Find::dir !~ /CVS/i and -f $File::Find::name);
    };
    return { map {$_, $_} @{ $self->rscan_dir($dir, $sub) } };
}



( run in 2.810 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )