24 lines
698 B
Groovy
24 lines
698 B
Groovy
def comparefiles(importedfile, currentfile, boolean ignorewhitespace = true) {
|
|
echo "Comparing file: ${importedfile} with: ${currentfile} option: ${ignorewhitespace}"
|
|
def wsparameter = "-w"
|
|
if (!ignorewhitespace) {
|
|
wsparameter = ""
|
|
}
|
|
if (isUnix()) {
|
|
sh """
|
|
diff -c ${wsparameter} "${importedfile}" "${currentfile}"
|
|
"""
|
|
}
|
|
else {
|
|
// diffutils can be installed on windows with chocolatey
|
|
powershell """
|
|
# echo Checking utilities exist
|
|
# where diff
|
|
# if errorlevel 1 EXIT /b 1
|
|
|
|
diff.exe -c ${wsparameter} "${importedfile}" "${currentfile}"
|
|
"""
|
|
}
|
|
}
|
|
|
|
return this;
|