-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcommands.ts
executable file
·46 lines (42 loc) · 1.53 KB
/
commands.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import * as child_process from 'child_process';
import {Configuration} from './Configuration';
import { platform } from 'os';
import { rubySpawn } from 'ruby-spawn';
var commonOptions = function(configuration) {
var opts = {};
if (configuration.workspace) {
opts['cwd'] = configuration.workspace;
}
if (configuration.shell) {
opts['shell'] = configuration.shell;
}
return opts;
}
export function solargraphCommand(args: string[], configuration: Configuration): child_process.ChildProcess {
let cmd = [];
if (configuration.useBundler && configuration.workspace) {
cmd.push(configuration.bundlerPath, 'exec', 'solargraph');
} else {
cmd.push(configuration.commandPath);
}
var env = commonOptions(configuration);
return rubySpawn(cmd.shift(), cmd.concat(args), env, true);
}
export function gemCommand(args: string[], configuration: Configuration): child_process.ChildProcess {
let cmd = [];
if (configuration.useBundler && configuration.workspace) {
cmd.push(configuration.bundlerPath, 'exec');
}
cmd.push('gem');
var env = commonOptions(configuration);
return rubySpawn(cmd.shift(), cmd.concat(args), env, true);
}
export function yardCommand(args: string[], configuration: Configuration): child_process.ChildProcess {
let cmd = [];
if (configuration.useBundler && configuration.workspace) {
cmd.push(configuration.bundlerPath, 'exec');
}
cmd.push('yard');
var env = commonOptions(configuration);
return rubySpawn(cmd.shift(), cmd.concat(args), env, true);
}