diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2013-01-07 17:28:16 +0100 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2013-01-07 17:28:16 +0100 |
commit | ea3776c06f7562eed413c44fc9a061ca6102f4df (patch) | |
tree | 0b3cd253bf1fcd5aed07d70331385a45d08c9674 /contrib | |
parent | df058f2b9168fa02899a6eea63b19efc750487bf (diff) | |
download | bugzilla-ea3776c06f7562eed413c44fc9a061ca6102f4df.tar.gz bugzilla-ea3776c06f7562eed413c44fc9a061ca6102f4df.tar.xz |
Bug 818091 - Install a full copy of YUI3 into the js directory for use with new extensions/projects
r=glob
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/new-yui3.pl | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/contrib/new-yui3.pl b/contrib/new-yui3.pl new file mode 100644 index 000000000..2d1eeddc2 --- /dev/null +++ b/contrib/new-yui3.pl @@ -0,0 +1,80 @@ +#!/usr/bin/perl -w +# +# Updates the version of YUI3 used by Bugzilla. Just pass the path to +# an unzipped yui release directory, like: +# +# contrib/new-yui3.pl /path/to/yui3/ +# + +use strict; + +use FindBin; +use File::Find; +use File::Basename; + +use constant EXCLUDES => qw( + gallery-* +); + +sub usage { + my $error = shift; + print "$error\n"; + print <<USAGE; +Usage: contrib/new-yui3.pl /path/to/yui3/files + +Eg. contrib/new-yui3.pl /home/dkl/downloads/yui3 +The yui3 directory should contain the 'build' directory +from the downloaded YUI3 tarball containing the module +related files. +USAGE + exit(1); +} + +############# +# Main Code # +############# + +my $SOURCE_PATH = shift; +my $DEST_PATH = "$FindBin::Bin/../js/yui3"; + +if (!$SOURCE_PATH || !-d "$SOURCE_PATH/build") { + usage("Source path not found!"); +} + +mkdir($DEST_PATH) unless -d $DEST_PATH; + +my $exclude_string = join(" ", map { "--exclude $_" } EXCLUDES); +my $command = "rsync -av --delete $exclude_string " . + "$SOURCE_PATH/build/ $DEST_PATH/"; +system($command) == 0 or usage("system '$command' failed: $?"); + +find( + sub { + my $delete = 0; + my $filename = basename $File::Find::name; + if ($filename =~ /-debug\.js$/ + || $filename =~ /-coverage\.js$/) + { + $delete = 1; + } + elsif ($filename =~ /-skin\.css$/) { + my $temp_filename = $filename; + $temp_filename =~ s/-skin//; + if (-e $temp_filename) { + $delete = 1; + } + } + elsif ($filename =~ /-min\.js/) { + $filename =~ s/-min//; + if (-e $filename) { + $delete = 1; + } + } + return if !$delete; + print "deleting $filename\n"; + unlink($filename) || usage($!); + }, + $DEST_PATH +); + +exit(0); |