use warnings;
#use strict;
use strict;
use TeamSite::Config;
use TeamSite::WFtask;
use TeamSite::WFworkflow;
#---------------------------------------------------------------------
# Workflow variables
#
(my $iwhome = TeamSite::Config::iwgethome()) =~ tr|\\|/|;
(my $iwmount = TeamSite::Config::iwgetmount()) =~ tr|\\|/|;
my @tmp_home = split("/TeamSite",$iwhome);
$iwhome = $tmp_home[0];
my ($jobid, $taskid, $area ) = (shift, shift, shift);
#my $task = TeamSite::WFtask->new($taskid);
my $task = new TeamSite::WFtask($taskid);
my $taskname=$task->GetName();
$area =~ tr |\\|/|;
my $branch = $area;
$branch =~ /default\\main\\(.*)\\WORKAREA/;
$branch = $1;
my @workArea =split("/",$area);
my $source;
my $target_production;
my $path;
my $od_conf;
my $execute_cmd = 1;
# $filelist = "C:\\Users\\Administrator\\Desktop\\Test\\printFile.txt";
$cmd = "D:\\Interwoven\\OpenDeployNG\\bin\\iwodcmd start D:\\Interwoven\\OpenDeployNG\\conf\\tsadm\\test_jignesh";
@output = `$cmd`;
$rc = $?;
my $success_flag = 0;
foreach (@output) {
$success_flag = 1 if (/ERROR/i);
$success_flag = 1 if (/Status: Failed/i);
}
# Check for the success/failure of the deployment process.
if ($rc eq "0" && $success_flag != 1) {
print "Your Files have been deployed Successfully.
";
#print "Below is output...
";
#print "@output
";
# Deployment successful... transition to closure
$task->CallBack(0, "Completed Deploy Process");
}
else
{
print "Deployment Failed.
";
print "Please Contact TeamSite Admin with the following error...
\@output";
print "
";
# Deployment failed... Do not close this job.
print "Your Job is still active. To initiate deployment again, you can switch to 'Workflow' tab and use the existing job
";
$task->CallBack(1, "Deployment Failed");
}
# $filelist = "C:\\Documents and Settings\\Administrator\\Desktop\\test\\printFile.txt";
#
# print "FileList : ". $filelist;
#
# my @files = (file1, file2, file3);
# open(WRITEFILE, ">$filelist") || die("ERROR: unable to open file: $! \n");
# select WRITEFILE;
# foreach my $file (@files){
# print WRITEFILE "$file\n";
# }
# close WRITEFILE;