#!/usr/bin/perl
use Cwd;
use Config;
print "Setting up a Bryar blog in this directory\n\n";
sub write_file {
my ($name, $content) = @_;
open OUT, ">".$name or die "Couldn't write to $name - $!\n";
print OUT $content;
close OUT;
}
# These are defaults which are written out to be customized, so I don't
# feel bad about including them here inline.
# Blatant assumption of standard Unix
write_file("bryar.cgi", "#!/usr/bin/perl\nuse Bryar; Bryar->go()\n");
chmod 0755, "bryar.cgi";
write_file("bryar.conf",<
Wow, this Bryar thing is neat, huh? This space should fill up with helpful hints on what else you can do with Bryar.
EOC write_file("template.html", <<'EOC'); [% MACRO day(entry_time) BLOCK; entry_time.day _ ", " _ entry_time.mday _ " " _ entry_time.month _ " " _ entry_time.year; END; MACRO category(entry) BLOCK; "Category : " _ entry.category; END; MACRO author(entry) BLOCK; "Author : " _ entry.author; END; MACRO comment_form(entry) BLOCK; 'Post a new comment!"; END; END; %] [% MACRO google_link(query, label) BLOCK; ''; label; ""; END; MACRO keywords(entry) BLOCK; "Keywords :"; FOREACH key = entry.keywords.slice(0,2); '[ '; google_link(key, key); '] '; END; END; %] [% INCLUDE head.html %] [% FOREACH entry = documents; entry_time = entry.timepiece; IF entry == documents.first or entry_time.ymd != previous.timepiece.ymd %]
