Module-DevAid
view release on metacpan or search on metacpan
lib/Module/DevAid.pm view on Meta::CPAN
if (!`$command`) # check the command works
{
$command = 'svk log';
}
if (open(CFILE, "$command |"))
{
my $cdate = '';
my $item = '';
while (my $line = <CFILE>)
{
# filter out the tagged release bit
if ($line =~ /^\s*tagged\s+release/)
{
}
# grab the date parts
elsif ($line =~ /^r\d+:\s+\w+\s+\|\s+(\d\d\d\d-\d+-\d+)/)
{
$cdate = $1;
$item = '';
}
elsif ($line =~ /----------/) # item start or end
{
if ($item) # end
{
$new_changes .= " * ($cdate) $item";
}
}
elsif ($line =~ /^$/) # blank
{
$item .= $line if $item;
}
else
{
if ($item)
{
$item .= " $line"; # alignment
}
else
{
$item .= $line;
}
}
}
close CFILE;
$new_changes .= "\n" if $new_changes;
}
if (!$new_changes) # get ALL the changes if that failed
{
$new_changes = `svk log`;
}
return $new_changes;
} # get_new_svk_changes
=head2 update_changes_file
Called by do_release. Overwrites the changes file and commits
the change. (uses get_changes_content)
=cut
sub update_changes_file {
my $self = shift;
my $old_version = shift;
my $version = shift;
my $changes_str = $self->get_changes_content($old_version, $version);
my $changes_file = $self->{changes_file};
if (open(OCFILE, ">${changes_file}"))
{
print OCFILE $changes_str;
close(OCFILE);
}
if ($self->{version_control} eq 'darcs')
{
my $command = "darcs record -am 'update release notes' $changes_file";
system($command);
}
elsif ($self->{version_control} eq 'svk')
{
my $command = "svk commit -m 'update release notes' $changes_file";
system($command);
}
}
=head2 tag_release
Called by do_release. Tags the release.
=cut
sub tag_release {
my $self = shift;
my $version = shift;
if ($self->{version_control} eq 'darcs')
{
my $command = "darcs tag -m release-$version --checkpoint";
system($command);
}
elsif ($self->{version_control} eq 'svk')
{
# find the tag path
my $info_cmd = "svk info";
my $fh;
my $depot_path = '';
if (open($fh, "$info_cmd |"))
{
while (my $line = <$fh>)
{
if ($line =~ /Depot Path:\s+(.*)/)
{
$depot_path = $1;
}
}
close $fh;
}
my $tags_path = $depot_path;
$tags_path =~ s/trunk/tags/;
my $command = "svk copy -p -m release-$version $depot_path $tags_path/v$version";
system($command);
}
( run in 1.843 second using v1.01-cache-2.11-cpan-140bd7fdf52 )