abee8add31b476e9b847b604be887931b10d81f6
larrym
  Mon Sep 19 13:36:05 2011 -0700
restore functionality of copying over a non-versioned copy on production machines b/c these are used by static files
diff --git src/hg/utils/cpAndLinkToResourceFiles.pl src/hg/utils/cpAndLinkToResourceFiles.pl
index 7bb3dd0..9da1e49 100755
--- src/hg/utils/cpAndLinkToResourceFiles.pl
+++ src/hg/utils/cpAndLinkToResourceFiles.pl
@@ -145,33 +145,34 @@
                 if($f =~ /^$prefix-\d+\.$suffix$/ || $f =~ /^$prefix-v\d+\.$suffix$/) {
                     if($f ne $softLink) {
                         print STDERR "Deleting old soft-link $f\n" if($debug);
                         unlink($f) || die "Couldn't unlink obsolete softlink '$f'; err: $!";
                     }
                 }
             }
             # create new symlink
             if(!(-l "$softLink")) {
                 my $cmd = "ln -s $file $softLink";
                 print STDERR "cmd: $cmd\n" if($debug);
                 !system($cmd) || die "Couldn't $cmd; err: $!";
             }
         } else {
             # On production machines, we make a copy of git file with the CGI version burned in (see redmine #5104).
-
-            my $destFile = $file;
-            $destFile =~ s/\.$suffix$/-v$cgiVersion.$suffix/;
+            # We also copy over a non-versioned copy for use by static files.
+            my $versionedFile = $file;
+            $versionedFile =~ s/\.$suffix$/-v$cgiVersion.$suffix/;
+            for my $destFile ($file, $versionedFile) {
             my $update = 0;
             my $exists = 0;
             if(-e $destFile) {
                 my @destStat = stat("$destFile") or die "Couldn't stat '$destFile'; err: $!";
                 $update = ($destStat[9] < $mtime);
                 $exists = 1;
             } else {
                 $update = 1;
             }
             $update = $update || $force;
             if($update) {
                 # delete obsolete files
                 for my $f (@destFiles) {
                     if($f =~ /^$prefix-v\d+\.$suffix$/) {
                         if($f ne $destFile) {
@@ -184,15 +185,16 @@
                     unlink($destFile) || die "Couldn't unlink '$destFile'";
                 }
                 if($minify && $suffix eq 'js') {
                     my $cmd = "/usr/bin/java -jar $minifyJar $srcFile -o $destFile";
                     print STDERR "cmd: $cmd\n" if($debug);
                     !system($cmd) || die "Couldn't run cmd '$cmd': err: $!";
                 } else {
                     my $cmd = "cp -p $srcFile $destFile";
                     print STDERR "cmd: $cmd\n" if($debug);
                     !system($cmd) || die "Couldn't $cmd; err: $!";
                 }
             }
         }
     }
 }
+}
