Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect OS for npm install #429

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
OS Detection for Windows and Linux Unix MACOS
biodivAtlasAT committed Oct 29, 2021
commit 14dde3fb56af35f37b58b4453149f5eacc5f65eb
26 changes: 24 additions & 2 deletions _Events.groovy
Original file line number Diff line number Diff line change
@@ -7,7 +7,18 @@ def build(String baseDir) {
final workdir = new File(baseDir, '')
final proc = new ProcessBuilder().inheritIO()
// npm for UNIX, npm.cmd for Windows
final exec = proc.command('npm.cmd', '-dd', 'install').start()
final exec = null;
if (OperatingSystem.current().isLinux()) {
exec = proc.command('npm', '-dd', 'install').start()
} else if (OperatingSystem.current().isUnix()) {
exec = proc.command('npm', '-dd', 'install').start()
} else if (OperatingSystem.current().isWindows()) {
exec = proc.command('npm.cmd', '-dd', 'install').start()
} else if (OperatingSystem.current().isMacOsX()) {
exec = proc.command('npm', '-dd', 'install').start()
} else {
exec = proc.command('npm', '-dd', 'install').start()
}
def exitValue = exec.waitFor()
if (exitValue) {
println '*****************************************************'
@@ -65,7 +76,18 @@ def build(String baseDir) {

// jsdoc
println 'Starting JSDoc'
final exec2 = proc.command('npm.cmd', 'run', 'jsdoc').start()
final exec2 = null;
if (OperatingSystem.current().isLinux()) {
exec2 = proc.command('npm', 'run', 'jsdoc').start()
} else if (OperatingSystem.current().isUnix()) {
exec2 = proc.command('npm', 'run', 'jsdoc').start()
} else if (OperatingSystem.current().isWindows()) {
exec2 = proc.command('npm.cmd', 'run', 'jsdoc').start()
} else if (OperatingSystem.current().isMacOsX()) {
exec2 = proc.command('npm', 'run', 'jsdoc').start()
} else {
exec2 = proc.command('npm', 'run', 'jsdoc').start()
}
def exitValue2 = exec2.waitFor()
if (exitValue2) {
println '*****************************************************'