- Timestamp:
- Apr 16, 2012, 4:04:12 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
projects/casparbuster/devel/bin/cbusterize
r1468 r1470 114 114 use ProjectBuilder::Base; 115 115 use ProjectBuilder::Conf; 116 use ProjectBuilder::VCS; 116 117 117 118 # settings … … 176 177 my $cb = \%cb; 177 178 ($cb->{'basedir'},$cb->{'database'},$cb->{'usemachines'},$cb->{'pluginsdir'},$cb->{'cms'}) = pb_conf_get("cbbasedir","cbdatabase","cbusemachines","cbpluginssubdir","cbcms"); 178 179 print Dumper($cb) if ($debug); 179 pb_log(2,"%cb: ",Dumper($cb)); 180 180 181 181 # Check for mandatory params … … 190 190 eval { $basedir =~ s/(\$ENV.+\})/$1/eeg }; 191 191 192 # debug mode overview 193 if ($debug) { 194 print <<EOF; 195 DEBUG MODE, not doing anything, just printing 196 DEBUG: basedir = $basedir 197 DEBUG: source = $source 198 EOF 199 if (defined ($machine)) { 200 print "DEBUG: machine = $machine\n"; 201 } 202 } 192 pb_log(1, "DEBUG MODE, not doing anything, just printing\nDEBUG: basedir = $basedir\nDEBUG: source = $source\n"); 193 pb_log(1, "DEBUG: machine = $machine\n") if (defined ($machine)); 203 194 204 195 # Create basedir if it doesn't exist 205 196 if (not -d $basedir) { 206 197 if ($debug) { 207 print "DEBUG: Creating recursively directory $basedir\n"; 208 } else { 209 mkpath($basedir,0,0755) or die "Unable to recursively create $basedir"; 210 # TODO: Add it to the CMS 198 pb_log(1, "DEBUG: Creating recursively directory $basedir\n"); 199 } else { 200 pb_mkdir_p($basedir) || die "Unable to recursively create $basedir"; 211 201 } 212 202 } … … 215 205 my $srcdir = undef; 216 206 my $srcfile = undef; 207 # TODO: That should be remote !! 217 208 if (-d $source) { 218 209 $srcdir = $source; … … 222 213 } 223 214 224 if ($debug) { 225 print "DEBUG: Found srcdir = $srcdir\n"; 226 if (defined $srcfile) { 227 print "DEBUG: Found srcfile = $srcfile\n"; 228 } else { 229 print "DEBUG: Found no srcfile\n"; 230 } 215 pb_log(1,"DEBUG: Found srcdir = $srcdir\n"); 216 if (defined $srcfile) { 217 pb_log(1,"DEBUG: Found srcfile = $srcfile\n"); 218 } else { 219 pb_log(1,"DEBUG: Found no srcfile\n"); 231 220 } 232 221 … … 236 225 $target .= "$srcdir"; 237 226 227 my $scheme = $cb->{'cms'}->{$appname}; 228 238 229 # If both source and target are dirs, then copy into the parent of the target 239 230 $target = basename($target) if ((not defined $srcfile) && (-d $target)); … … 242 233 if (not -d $target) { 243 234 if ($debug) { 244 p rint "DEBUG: Creating recursively directory $target\n";245 } else { 246 mkpath($target,0,0755) ordie "Unable to recursively create $target";247 p rint "INFO: Created $target you may want to add it to your CMS\n";248 # TODO: Add it to the CMS235 pb_log(1,"DEBUG: Creating recursively directory $target\n"); 236 } else { 237 pb_mkdir_p($target) || die "Unable to recursively create $target"; 238 pb_vcs_add($scheme,$target); 239 pb_log(0,"INFO: Created $target and added it to your $scheme system\n"); 249 240 } 250 241 } … … 264 255 265 256 # Now add content if not already there 266 if ((defined $srcfile) && (! -f "$target/$srcfile")) { 257 if (defined $srcfile) { 258 # File case 259 if (! -f "$target/$srcfile") { 260 if ($debug) { 261 pb_log(1,"DEBUG: launching $cmd\n"); 262 } else { 263 pb_system($cmd); 264 pb_vcs_add($scheme,"$target/$srcfile"); 265 pb_log(0,"INFO: Created $target/$srcfile and added it to your $scheme system\n"); 266 } 267 } else { 268 pb_log(0,"INFO: File $target/$srcfile already there\n"); 269 } 270 } else { 271 # Directory case 272 # TODO: if targetlocal dir alredy exists, take the parent 267 273 if ($debug) { 268 print "DEBUG: launching $cmd\n"; 269 } else { 270 system($cmd); 271 print "INFO: Created $target/$srcfile you may want to add it to your CMS\n"; 272 } 273 } 274 pb_log(1,"DEBUG: launching $cmd\n"); 275 } else { 276 pb_system($cmd); 277 pb_vcs_add($scheme,"$target"); 278 pb_log(0,"INFO: Created $target and added it to your $scheme system\n"); 279 } 280 }
Note:
See TracChangeset
for help on using the changeset viewer.