替换正则报错

dev_forum
daiao 5 years ago
parent e49bc7faba
commit f7551021bb

@ -124,12 +124,9 @@ module ShixunsHelper
if script.present? if script.present?
source_class_name = [] source_class_name = []
challenge_program_name = [] challenge_program_name = []
logger.info("########-----shixun.challenges.map(&:exec_path):#{shixun.challenges.map(&:exec_path)}")
shixun.challenges.map(&:exec_path).each do |exec_path| shixun.challenges.map(&:exec_path).each do |exec_path|
challenge_program_name << "\"#{exec_path}\"" challenge_program_name << "\"#{exec_path}\""
logger.info("----mirror_name: #{shixun.main_mirror_name.try(:first)}") if shixun.main_mirror_name == "Java"
logger.info("----mirror_name1: #{shixun.main_mirror_name.try(:first) == "Java"}")
if shixun.main_mirror_name.try(:first) == "Java"
if exec_path.nil? || exec_path.split("src/")[1].nil? if exec_path.nil? || exec_path.split("src/")[1].nil?
source = "\"\"" source = "\"\""
else else
@ -146,7 +143,6 @@ module ShixunsHelper
source_class_name << source if source.present? source_class_name << source if source.present?
end end
end end
logger.info("######source_class_name: #{source_class_name}")
script = if script.include?("sourceClassName") && script.include?("challengeProgramName") script = if script.include?("sourceClassName") && script.include?("challengeProgramName")
script.gsub(/challengeProgramNames=\(.*\)/,"challengeProgramNames=\(#{challenge_program_name.reject(&:blank?).join(" ")}\)").gsub(/sourceClassNames=\(.*\)/, "sourceClassNames=\(#{source_class_name.reject(&:blank?).join(" ")}\)") script.gsub(/challengeProgramNames=\(.*\)/,"challengeProgramNames=\(#{challenge_program_name.reject(&:blank?).join(" ")}\)").gsub(/sourceClassNames=\(.*\)/, "sourceClassNames=\(#{source_class_name.reject(&:blank?).join(" ")}\)")
else else

Loading…
Cancel
Save