
use Cwd qw(abs_path);
use File::Basename;
use File::Find;
use ExtUtils::MakeMaker;

my $dirname = abs_path( dirname(__FILE__) );
my @path = split( /\//, $dirname );
pop(@path);
pop(@path);
my $wc_dir = join( "/", @path );

foreach my $manifest_pm ( glob("lib/Zymonic/Manifest/*.pm") )
{
    open( FILE, "<", $manifest_pm );
    my @lines = <FILE>;
    close FILE;
    open( FILE, ">", $manifest_pm );
    foreach my $line (@lines)
    {
        $line =~ s/Working_copy\s*=\s*'.*'/Working_copy = '$wc_dir'/g;
        print FILE $line;
    }
    close FILE;
}

# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    NAME         => 'Zymonic::Manifest::Core',
    VERSION_FROM => 'lib/Zymonic/Manifest/core.pm',                          # finds \$VERSION
    AUTHOR       => 'Alex Masidlover et al. (alex.masidlover@zednax.com)',
    ABSTRACT     => 'Zymonic Workflow System',
    PREREQ_PM    => {
        'Zymonic' => 0,
    }
);
