Skip to content

Commit

Permalink
post a release news on the wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonéri Le Bouder committed Sep 2, 2012
1 parent 13fb29b commit 44133b5
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tools/postNews.pl
@@ -0,0 +1,48 @@
#!/usr/bin/perl

use strict;
use warnings;

use DateTime::Format::Mail;
use File::Basename;
use File::Path qw(make_path);

my $release = shift;
die unless $release;

open CHANGES, "<Changes" or die;

my $in;
foreach my $line (<CHANGES>) {
chomp($line);
if ($line =~ /^$release\s+(\S.*)/) {
my $datetime = DateTime::Format::Mail->parse_datetime($1);

my $file = sprintf("../wiki/news/%d/%02d/%02d/fusioninventory-agent-%s.mdwn",
$datetime->year,
$datetime->month,
$datetime->day,
$release
);
make_path(dirname($file));
open OUT, ">$file" or die;

print OUT
"[[!meta date=\"".$datetime->ymd."\"]]\n".
"# FusionInventory Agent $release\n".
"".
"The FusionInventory Agent maintainers are glad to announce the $release release.\n\n".
"You can download the archive from [the forge](http://forge.fusioninventory.org/projects/fusioninventory-agent/files)\n".
"or directly from [the CPAN](https://metacpan.org/release/FusionInventory-Agent)\n\n".
"We did our best to provide a solid release, please [[contact us|/resources]] is you believe to ".
"find something unexpected\n\n".
"## changelog\n\n";
$in = 1;
} elsif ($in && $line =~ /^\d/) {
last;
} elsif ($in && $line =~ /^(\w.*)$/) {
print OUT "### $1\n\n";
} elsif ($in) {
print OUT $line."\n";
}
}

0 comments on commit 44133b5

Please sign in to comment.