Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !1172
An error occurred while fetching the assigned milestone of the selected merge_request.

Rename perl environment variable for post-processing file

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged William Cheng requested to merge perl_rename into master 6 years ago
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 1

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

For example, export PERL_POST_PROCESS_FILE=/usr/local/bin/perltidy -b -bext="/" to format the Perl code using perltidy.

Compare
  • master (base)

and
  • latest version
    c2e0b047
    1 commit, 2 years ago

1 file
+ 9
- 8

    Preferences

    File browser
    Compare changes
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java
+ 9
- 8
  • View file @ c2e0b047

  • Edit in single-file editor

  • Open in Web IDE


@@ -133,8 +133,8 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
@@ -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 {
@@ -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 {
@@ -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());
}
}
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference:
Source branch: perl_rename

Menu

Explore Projects Groups Snippets