Created
January 27, 2011 13:38
-
-
Save tildedave/798509 to your computer and use it in GitHub Desktop.
Install useful maven target installations into ServiceMix hotdeploy directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use File::Find; | |
use File::Copy; | |
use Getopt::Long; | |
my $smix_directory = ""; | |
my $dry_run = 0; | |
my $result = GetOptions( "smix=s" => \$smix_directory, | |
"dryrun" => \$dry_run ); | |
if (not -d $smix_directory) { | |
print "ERROR: $smix_directory not a valid directory\n"; | |
exit 1; | |
} | |
my $smix_hotdeploy = "$smix_directory/hotdeploy"; | |
if (not -d $smix_hotdeploy) { | |
print "ERROR: $smix_hotdeploy does not exist\n"; | |
exit 1; | |
} | |
my @install_zips; | |
find( \&is_target_zip, "."); | |
sub is_target_zip { | |
if ($File::Find::dir =~/target$/ && $File::Find::name =~ /.zip$/) { | |
push(@install_zips, $File::Find::name); | |
} | |
else { | |
} | |
}; | |
foreach my $install_zip (@install_zips) { | |
print "Copying $install_zip to $smix_hotdeploy...\n"; | |
if (not $dry_run) { | |
copy($install_zip, $smix_hotdeploy) | |
or die "Failed to copy file ($install_zip): $!"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment