-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbackend.go
More file actions
36 lines (31 loc) · 777 Bytes
/
backend.go
File metadata and controls
36 lines (31 loc) · 777 Bytes
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
package shimgo
import (
"errors"
"os/exec"
"path/filepath"
)
type backend int
const (
pythonServer backend = iota
rubyServer
)
func (b backend) writeFiles(workingDirectory string) error {
switch b {
case pythonServer:
return writeFiles([]string{pythonService, asciidoc, asciidocapi}, workingDirectory)
case rubyServer:
return writeFiles([]string{rubyService}, workingDirectory)
default:
return errors.New("unsupported backend")
}
}
func (b backend) getCommand(workingDirectory, port string) *exec.Cmd {
switch b {
case pythonServer:
return exec.Command(getPython2(), filepath.Join(workingDirectory, pythonService), port)
case rubyServer:
return exec.Command(getRuby(), filepath.Join(workingDirectory, rubyService), port)
default:
return nil
}
}