File tree Expand file tree Collapse file tree 3 files changed +36
-4
lines changed
approvaltests/src/main/java/org/approvaltests Expand file tree Collapse file tree 3 files changed +36
-4
lines changed Original file line number Diff line number Diff line change 11package org .approvaltests ;
22
3+ import com .spun .util .SystemUtils ;
34import com .spun .util .io .FileUtils ;
5+ import com .spun .util .io .NetUtils ;
46
57import java .io .File ;
68
@@ -11,6 +13,36 @@ public class FailedFileLog
1113 static
1214 {
1315 FileUtils .writeFile (get (), "" );
16+ downloadApproveAllScriptIfMissing ();
17+ }
18+ private static void downloadApproveAllScriptIfMissing ()
19+ {
20+ try
21+ {
22+ if (SystemUtils .isWindowsEnvironment ())
23+ {
24+ String url = "https://raw.githubusercontent.com/approvals/ApprovalTests.Java/refs/heads/master/resources/approve_all.bat" ;
25+ File batScript = new File (APPROVAL_TEMP_DIRECTORY + "/approve_all.bat" );
26+ if (!batScript .exists ())
27+ {
28+ FileUtils .writeFile (batScript , NetUtils .loadWebPage (url , null ));
29+ }
30+ }
31+ else
32+ {
33+ String url = "https://raw.githubusercontent.com/approvals/ApprovalTests.Java/refs/heads/master/resources/approve_all.sh" ;
34+ File bashScript = new File (APPROVAL_TEMP_DIRECTORY + "/approve_all.sh" );
35+ if (!bashScript .exists ())
36+ {
37+ FileUtils .writeFile (bashScript , NetUtils .loadWebPage (url , null ));
38+ bashScript .setExecutable (true );
39+ }
40+ }
41+ }
42+ catch (Exception e )
43+ {
44+ // do nothing
45+ }
1446 }
1547 public static File get ()
1648 {
Original file line number Diff line number Diff line change 11@ echo off
22
3- FOR /F " usebackq delims=" %%L IN (" ..\approvaltests-tests\ .approval_tests_temp\.failed_comparison.log" ) DO (
3+ FOR /F " usebackq delims=" %%L IN (" ..\.approval_tests_temp\.failed_comparison.log" ) DO (
44 REM Store the entire line in an environment variable named LINE
55 SET " LINE = %%L "
66 REM Call a subroutine to parse and handle the line
@@ -23,4 +23,4 @@ GOTO :EOF
2323 )
2424
2525 ENDLOCAL
26- GOTO :EOF
26+ GOTO :EOF
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33
4- LOGFILE=" ../approvaltests-tests/ .approval_tests_temp/.failed_comparison.log"
4+ LOGFILE=" ../.approval_tests_temp/.failed_comparison.log"
55
66while IFS= read -r line; do
77 # 1) Parse the line to get source (before '->') and destination (after '->')
@@ -17,4 +17,4 @@ while IFS= read -r line; do
1717 # 3) Perform the move
1818 echo " Moving '$src ' to '$dst '"
1919 mv " $src " " $dst "
20- done < " $LOGFILE "
20+ done < " $LOGFILE "
You can’t perform that action at this time.
0 commit comments