forked from loafle/openapi-generator-original
rename perl environment variable (#1172)
This commit is contained in:
parent
06d31cfedb
commit
b4d835f683
@ -133,8 +133,8 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
public void processOpts() {
|
public void processOpts() {
|
||||||
super.processOpts();
|
super.processOpts();
|
||||||
|
|
||||||
if (StringUtils.isEmpty(System.getenv("PERLTIDY_PATH"))) {
|
if (StringUtils.isEmpty(System.getenv("PERL_POST_PROCESS_FILE"))) {
|
||||||
LOGGER.info("Environment variable PERLTIDY_PATH not defined so the Perl code may not be properly formatted. To define it, try 'export PERLTIDY_PATH=/usr/local/bin/perltidy' (Linux/Mac)");
|
LOGGER.info("Environment variable PERL_POST_PROCESS_FILE not defined so the Perl code may not be properly formatted. To define it, try 'export PERL_POST_PROCESS_FILE=/usr/local/bin/perltidy -b -bext=\"/\"' (Linux/Mac)");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalProperties.containsKey(MODULE_VERSION)) {
|
if (additionalProperties.containsKey(MODULE_VERSION)) {
|
||||||
@ -571,9 +571,9 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String perlTidyPath = System.getenv("PERLTIDY_PATH");
|
String perlTidyPath = System.getenv("PERL_POST_PROCESS_FILE");
|
||||||
if (StringUtils.isEmpty(perlTidyPath)) {
|
if (StringUtils.isEmpty(perlTidyPath)) {
|
||||||
return; // skip if PERLTIDY_PATH env variable is not defined
|
return; // skip if PERL_POST_PROCESS_FILE env variable is not defined
|
||||||
}
|
}
|
||||||
|
|
||||||
// only process files with .t, .pm extension
|
// only process files with .t, .pm extension
|
||||||
@ -583,11 +583,12 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
String command = perlTidyPath + " -b -bext='/' " + file.toString();
|
String command = perlTidyPath + " -b -bext='/' " + file.toString();
|
||||||
try {
|
try {
|
||||||
Process p = Runtime.getRuntime().exec(command);
|
Process p = Runtime.getRuntime().exec(command);
|
||||||
p.waitFor();
|
int exitValue = p.waitFor();
|
||||||
if (p.exitValue() != 0) {
|
if (exitValue != 0) {
|
||||||
LOGGER.error("Error running the command ({}). Exit code: {}", command, p.exitValue());
|
LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue);
|
||||||
}
|
} else {
|
||||||
LOGGER.info("Successfully executed: " + command);
|
LOGGER.info("Successfully executed: " + command);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user