Skip to content

Commit

Permalink
Include tech and community stuff in the build.
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Nov 20, 2012
1 parent bf294ea commit 013b3d1
Show file tree
Hide file tree
Showing 4 changed files with 306 additions and 247 deletions.
55 changes: 34 additions & 21 deletions build
Expand Up @@ -5,6 +5,7 @@ use warnings;
use 5.010;

use Template;
use Data::Dumper;

my $t = Template->new;

Expand All @@ -28,45 +29,57 @@ my $y_offset = sub {
return $y_offset;
};

my $releases = get_rel();

$t->process('index.tt', {
releases => $releases,
releases => get_rel(),
headlines => get_headlines(),
tech => get_tech(),
community => get_community(),
years => $years,
get_x_offset => $x_offset,
get_y_offset => $y_offset,
}, 'index.html')
or die $t->error;

sub get_rel {
my $rel = {};

if (-f 'releases.txt') {
open my $fh, '<', 'releases.txt' or die $!;
sub get_list {
my ($file) = @_;

my $list = {};

if (-f $file) {
open my $fh, '<', $file or die $!;
while (<$fh>) {
next unless /\S/;
chomp;
my ($year, $release) = split /-/, $_, 2;
push @{$rel->{$year}}, $release;
my ($year, $data) = split /\s+/, $_, 2;
push @{$list->{$year}}, $data;
}
} else {
warn "File: $file not found";
}

say Dumper $list;

return $list;
}

return $rel;
sub get_rel {
return get_list('releases.txt');
}

sub get_headlines {
my $hl = {};
my $hl = get_list('headlines.txt');

if (-f 'headlines.txt') {
open my $fh, '<', 'headlines.txt' or die $!;
while (<$fh>) {
next unless /\S/;
chomp;
my ($year, $headline) = split /\s+/, $_, 2;
$hl->{$year} = $headline;
}
foreach (keys $hl) {
$hl->{$_} = $hl->{$_}[0];
}

return $hl;
}

sub get_tech {
return get_list('tech.txt');
}

sub get_community {
return get_list('community.txt');
}

0 comments on commit 013b3d1

Please sign in to comment.