App-Dapper
view release on metacpan or search on metacpan
com'.
2. For each A record, set 'Alias' to yes, and set 'Alias Target' to the S3
bucket with the same name.
To make it easy to publish to Amazon S3, one option is to create a Makefile
that encodes the publishing instructions. Here is a Makefile that I use for
[Mark Benson Portfolio](http://markbenson.io/):
BASEDIR=$(CURDIR)
INPUTDIR=$(BASEDIR)/_source
OUTPUTDIR=$(BASEDIR)/_output
S3_BUCKET=markbenson.io
build:
dapper build
serve: build
dapper serve
publish: build
s3cmd sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --reduced-redundancy --acl-public --delete-removed
watch:
dapper watch
.PHONY: build serve publish watch
## Github Pages
Github Pages is a free service that allows you to publish a static website for
free. By pushing your changes to a git repository, your website will be
use Pod::Usage;
use Getopt::Mixed;
use App::Dapper;
use File::Monitor;
use File::Find;
use Data::Dumper;
my $COMMAND = undef;
my $SOURCE = "_source";
my $OUTPUT = "_output";
my $LAYOUT = "_layout";
my $CONFIG = "_config.yml";
my $PORT = 8000;
my $HELP = undef;
my $VERSION = undef;
=head1 SYNOPSIS
B<Dapper> allows you to transform simple text files into static websites. By installing the App::Dapper Perl module, an executable named C<dapper> will be available to you in your terminal window. You can use this executable in a number of ways:
=item B<-v>
Print the version and exit.
=back
=cut
sub init {
my $d = new App::Dapper($SOURCE, $OUTPUT, $LAYOUT, $CONFIG);
$d->init();
undef $d;
}
sub build {
my $d = new App::Dapper($SOURCE, $OUTPUT, $LAYOUT, $CONFIG);
$d->build();
undef $d;
}
sub serve {
my $pid = fork();
if ($pid == 0) { watch(); exit(0); }
my $d = new App::Dapper($SOURCE, $OUTPUT, $LAYOUT, $CONFIG);
$d->serve($PORT);
undef $d;
}
sub watch {
build();
my $monitor = File::Monitor->new();
# Find files to watch that are not in the _output directory
find({ wanted => sub {
my $filename = $_;
my $fullpath = $File::Find::name;
# Ignore directories
return if -d $filename;
# Ignore files that start with a period (.) or underscore (_)
return if $filename =~ /^[_\.].*/;
# Ignore the output directory and everything in it
return if $fullpath =~ /$OUTPUT/;
#print "WATCH $filename\n";
$monitor->watch( { name => $filename } );
}}, ".");
# First scan just finds out about the monitored files. No changes will be reported
$monitor->scan;
# Monitor for changes
v version>v
s=s source>s
o=s output>o
l=s layout>l
c=s config>c
p=s port>p
});
while( my( $option, $value, $pretty ) = Getopt::Mixed::nextOption() ) {
$SOURCE = $value if $option eq 's';
$OUTPUT = $value if $option eq 'o';
$LAYOUT = $value if $option eq 'l';
$CONFIG = $value if $option eq 'c';
$PORT = $value if $option eq 'p';
help() if $option eq 'h';
version() if $option eq 'v';
}
Getopt::Mixed::cleanup();
$COMMAND = $ARGV[0];
( run in 0.388 second using v1.01-cache-2.11-cpan-4e96b696675 )