Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:13:25

0001 #!/usr/bin/env ruby
0002 # -----------------------------------------------------------------------------
0003 # @file   copy-to-core.rb
0004 # @author Derek Anderson
0005 # @date   12.21.2023
0006 #
0007 # Script to automate copying files over to
0008 # a fork of the sPHENIX coresoftware repo.
0009 # -----------------------------------------------------------------------------
0010 
0011 # modules to use
0012 require 'fileutils'
0013 
0014 # top directory to copy from/to
0015 copy_from = "/sphenix/user/danderson/jets/TriggerClusterMaker/src"
0016 copy_to   = "/sphenix/user/danderson/sphenix/ForkedCoreSoftware/offline/packages/trigger"
0017 
0018 # what files to copy
0019 to_copy = [
0020   "TriggerClusterMaker.cc",
0021   "TriggerClusterMaker.h",
0022   "TriggerClusterMakerLinkDef.h"
0023 ]
0024 
0025 # do copying
0026 to_copy.each do |file|
0027 
0028   # make directory in target if needed
0029   if file.include? "/"
0030 
0031     # grab relative path to file
0032     relative_path = file.clone
0033     relative_path.gsub!(copy_from, "")
0034 
0035     # clean up and isolate path
0036     relative_path.gsub!("//",  "/")
0037     relative_path.gsub!("/./", "/")
0038     relative_path.slice!(relative_path.rindex("/")..-1)
0039 
0040     # make directory
0041     to_make = copy_to + "/" + relative_path
0042     FileUtils.mkdir_p(to_make, :verbose => true) unless File.exists?(to_make)
0043   end
0044 
0045   # make source and target paths
0046   source = copy_from + "/" + file
0047   target = copy_to + "/" + file
0048 
0049   # remove any unwanted patterns
0050   source.gsub!("//",  "/")
0051   target.gsub!("//",  "/")
0052   source.gsub!("/./", "/")
0053   target.gsub!("/./", "/")
0054 
0055   # copy file
0056   FileUtils.cp_r(source, target, :verbose => true)
0057 end
0058 
0059 # end -------------------------------------------------------------------------