Permalink
Browse files

Overhauled the build process

  • Loading branch information...
1 parent d7a5422 commit f737ed581ffd5b25bb55e44077825d9c015c10a1 @petdance committed Aug 14, 2009
Showing with 37 additions and 27 deletions.
  1. +1 −0 .gitignore
  2. +13 −13 Makefile
  3. +23 −14 crank
View
@@ -1 +1,2 @@
*~
+build/
View
@@ -2,24 +2,24 @@
crank \
clean
+BUILD=build
+SOURCE=s
+
+BUILDSYNC=rsync -azu --delete --exclude=.git --exclude='*~'
+
default: crank
crank:
- rm -fr 101/*.html
- mkdir 101/ || true > /dev/null 2>&1
- perl crank 101.pod
- rsync -azu --delete \
- --exclude=.svn --exclude='*~' \
- static/ 101/static/
- rsync -azu --delete \
- --exclude=.svn --exclude='*~' \
- s/ 101/s/
- cp s/*.ico 101/
+ rm -fr $(BUILD)/*.html
+ mkdir -p $(BUILD)/ || true > /dev/null 2>&1
+ perl crank --podpath=$(SOURCE) --buildpath=$(BUILD)
+ $(BUILDSYNC) static/ $(BUILD)/static/
+ cp $(SOURCE)/*.ico $(BUILD)/
clean:
- rm -fr 101/
+ rm -fr $(BUILD)
# This is only useful for Andy
rsync:
- rsync -azu -e ssh --delete \
- 101/ petdance@midhae.pair.com:~/p/
+ rsync -azu -e ssh --delete --verbose \
+ $(BUILD)/ andy@huggy.petdance.com:/srv/p101
View
@@ -3,20 +3,29 @@
use strict;
use warnings;
-BEGIN {
- eval 'use Carp::Always';
-}
+use Carp::Always;
+use Getopt::Long;
use Template ();
use Template::Constants qw( :debug :chomp );
+my $podpath = 's';
+my $buildpath = 'build';
+
+GetOptions(
+ 'podpath:s' => \$podpath,
+ 'buildpath:s' => \$buildpath,
+) or exit;
+
+-d $buildpath && -w $buildpath or die;
+
my %defaults = (
- INCLUDE_PATH => [ qw( tt ) ],
- OUTPUT_PATH => $ENV{'PERL101_OUT_PATH'} || '/srv/p101/',
- DEBUG => DEBUG_UNDEF,
- TRIM => CHOMP_ALL,
- PRE_CHOMP => 1,
- POST_CHOMP => 1,
+ INCLUDE_PATH => [ qw( tt ) ],
+ OUTPUT_PATH => $buildpath,
+ DEBUG => DEBUG_UNDEF,
+ TRIM => CHOMP_ALL,
+ PRE_CHOMP => 1,
+ POST_CHOMP => 1,
);
my $tt = Template->new( \%defaults );
@@ -25,18 +34,18 @@ my $vars = {};
my @podfiles;
my @sidelinks;
-for ( get_sections( 's/' ) ) {
+for ( get_sections( $podpath ) ) {
my ($sectionfile, $sectiontext) = @{$_};
- my $podfile = "s/$sectionfile.pod";
+ my $podfile = "$podpath/$sectionfile.pod";
my $htmlfile = "$sectionfile.html";
push( @sidelinks, {
filename => $htmlfile,
- text => $sectiontext,
+ text => $sectiontext,
} );
push( @podfiles, {
- section => $sectiontext,
- podfile => $podfile,
+ section => $sectiontext,
+ podfile => $podfile,
htmlfile => $htmlfile,
} );
}

0 comments on commit f737ed5

Please sign in to comment.