#!/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",<First post! First post!

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!
Your name:
Your address/home page:

Your rant:

'; END; MACRO permalink(entry, params) BLOCK; bryar.config.baseurl; '/id_'; entry.id; "?" _ params IF params; END; MACRO comments(entry) BLOCK; ''; entry.comments.size || 0; " Comments"; IF bryar.arguments.comments; "

"; FOREACH comment = entry.comments; '
'; comment.content; '

'; 'Posted by '; comment.author; ' at '; day(comment.timepiece); ' '; comment.timepiece.time; '
'; '
'; END; comment_form(entry); "

"; 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 %]

[% day(entry_time) %]
[% END %] [% previous = entry %]

[%entry.title%]

[% entry.content %]
Posted at [%entry_time.time%] by [% bryar.config.author %]
[% END %] [% INCLUDE foot.html %] EOC write_file("head.html", < [% bryar.config.name %]

[% bryar.config.name %]

EOC write_file("foot.html", < Powered by Bryar!
Search "[% bryar.config.name %]":

Subscribe to full text feeds via: ATOM | RSS2 | RSS
Subscribe to preview feeds via: ATOM | RSS2 | RSS
[Valid Atom] EOC write_file("template.rss", < [% bryar.config.name %] [% bryar.config.baseurl %] [% bryar.config.description %] en-us [%documents.first.timepiece.datetime%] [% FOREACH item=documents %] [% END %] [% FOREACH item = documents %] [% item.title %] [%bryar.config.baseurl%]/id_[%item.id%] [% item.content | html %] [%item.timepiece.datetime %] [%item.author %] [% END %] EOC write_file("template.rss2", < [% bryar.config.name %] [% bryar.config.baseurl %] [% bryar.config.description %] en-us [%documents.first.timepiece.datetime%]-05:00 [% FOREACH item=documents %] [% END %] EOC write_file("template.atom", < [% bryar.config.name %] [%documents.first.timepiece.datetime%][% FILTER format("%03d") %][% documents.first.timepiece.tzoffset / 3600 %][%END%]:00 [% bryar.config.author %] [% FOREACH item = documents %] [% item.title %] [% idURL = bryar.config.baseurl | replace('http://', '') | replace('/.*', '') %] tag:[% idURL _ "," _ item.timepiece.year _":id_" _ item.id %] [% hours = item.timepiece.tzoffset / 3600 %] [% minutes = (item.timepiece.tzoffset % (hours * 60 * 60)) / 60 %] [% item.timepiece.datetime %][% FILTER format("%03d") %][% hours %][%END%]:[% FILTER format("%02d") %][% minutes %][%END%] [% item.timepiece.datetime %][% FILTER format("%03d") %][% hours %][%END%]:[% FILTER format("%02d") %][% minutes %][%END%] [% FILTER truncate(252) %] [% item.excerpt(bryar.config.excerpt_words) %] [% END %] [% END %] EOC write_file("calendar", < SunMonTueWedThuFriSat [% FOREACH week = bryar.posts_calendar %] [% FOREACH day = week %] [% '' IF day.link%] [% day.day || ' ' %][% '' IF day.link %] [% END %] [% END %] EOC chmod 0644, $_ for ("bryar.conf", "1.txt", "head.html", "foot.html", "template.html","template.rss", "template.atom", "calendar"); print "\nDone. Now you want to probably customize 'bryar.conf'.\n"; print "You should probably also customize template.html, head.html and foot.html\n"; print "Then point your browser at bryar.cgi, and get blogging!\n";