Skip to content

Commit

Permalink
Рефакторинг
Browse files Browse the repository at this point in the history
  • Loading branch information
nixel2007 committed Dec 3, 2021
1 parent b2d5f38 commit 8a39f16
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 1 addition & 3 deletions src/ru/pulsar/jenkins/library/steps/Swagger.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ class Swagger {

Logger.printLocation()

def env = steps.env();

steps.installLocalDependencies()

String swaggerPath = OscriptModules.getModulePath("swagger");
String swaggerPath = OscriptModules.getAppExecutable("swagger");

steps.cmd(swaggerPath + " generate --src-path $config.srcDir --out $OUT")

Expand Down
12 changes: 6 additions & 6 deletions src/ru/pulsar/jenkins/library/utils/OscriptModules.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import ru.pulsar.jenkins.library.IStepExecutor
import ru.pulsar.jenkins.library.ioc.ContextRegistry

class OscriptModules {
static String getModulePath(String moduleName) {
static String getAppExecutable(String executableName) {

IStepExecutor steps = ContextRegistry.getContext().getStepExecutor()

String moduleBinary = steps.isUnix() ? moduleName : "$moduleName.bat";
String modulePath = "oscript_modules/bin/$moduleBinary";
if (!steps.fileExists(modulePath)) {
modulePath = moduleBinary;
String executableBinary = steps.isUnix() ? executableName : "${executableName}.bat";
String executablePath = "oscript_modules/bin/$executableBinary";
if (!steps.fileExists(executablePath)) {
executablePath = executableBinary;
}

return modulePath;
return executablePath;
}
}
1 change: 0 additions & 1 deletion vars/pipeline1C.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import groovy.transform.Field
import ru.pulsar.jenkins.library.configuration.JobConfiguration
import ru.pulsar.jenkins.library.configuration.SourceFormat
import ru.pulsar.jenkins.library.steps.Swagger

import java.util.concurrent.TimeUnit

Expand Down

0 comments on commit 8a39f16

Please sign in to comment.