Skip to content

Instantly share code, notes, and snippets.

@aanoaa
Created April 3, 2012 03:35
Show Gist options
  • Save aanoaa/2289092 to your computer and use it in GitHub Desktop.
Save aanoaa/2289092 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Pod::Usage;
use File::Slurp;
use Getopt::Long;
my %options;
GetOptions(\%options, "--help", "--db-init");
run(\%options, @ARGV);
sub run {
my ($opts, @args) = @_;
pod2usage(0, -noperldoc => 1) if $opts->{help};
eval "require Carton::CLI; 1";
die "Carton not found. Install it with this command `cpanm Carton`" if $@;
my $checksum = `cksum Makefile.PL`;
$checksum =~ s/ .*$//s;
my $installed = -e '.carton/checksum' ? read_file('.carton/checksum') : 0;
if ($checksum == $installed) {
print "up-to-date.\n"
} else {
Carton::CLI->new->run('install');
write_file('.carton/checksum', $checksum);
}
}
__END__
=pod
=encoding utf-8
=head1 NAME
bootstrap.pl - simply setup to work
=head1 SYNOPSIS
$ script/bootstrap.pl
$ script/bootstrap.pl --db-init # Not yet implemented.
=head1 DESCRIPTION
no description
=head1 LICENSE
same as Perl.
=head1 AUTHOR
Hyungsuk Hong
=cut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment