Skip to content

Instantly share code, notes, and snippets.

@JEEN
Created April 7, 2010 11:17
Show Gist options
  • Select an option

  • Save JEEN/358757 to your computer and use it in GitHub Desktop.

Select an option

Save JEEN/358757 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Getopt::Long;
use LWP::UserAgent;
use File::Path;
my $result;
my ($library, $library_c, $doc_type);
$result = GetOptions(
"js=s" => \$library,
"compress" => \$library_c,
"doctype=s" => \$doc_type,
);
my $proj_name = $ARGV[0] || die 'requires your project name';
my %param = (
proj_name => $proj_name,
doc => $doc_type || 'xs',
Library => $library || 'jquery',
LibraryC => $library_c || '.min',
input => 'content',
Centered => 'No',
ext => 'html',
submit => '',
);
my $ua = LWP::UserAgent->new();
my $res = $ua->post("http://instantblueprint.com/index.php", \%param);
my $content = $res->content;
my ($file) = $content =~ /download\/(.*\.zip)/;
my $zip = sprintf 'http://instantblueprint.com/download/%s', $file;
$ua->mirror($zip, 'bp.zip');
File::Path::mkpath($proj_name, 0, 0777);
system("unzip -q bp.zip -d $proj_name");
system('rm -rf bp.zip');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment