-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
77 lines (63 loc) · 1.3 KB
/
main.go
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package main
import (
"bufio"
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"strings"
)
type Provider interface {
filename() string
runTests() error
getCommandsFromYAML([]byte) error
}
//
// Circle is used to unmarshal the yaml
// Overrides is an array of the tests to run
//
func main() {
providers := []Provider{&Circle{}, &Travis{}}
err := errors.New("")
for _, provider := range providers {
err = provider.runTests()
if err != nil {
fmt.Println(err)
}
fmt.Println("===================")
}
log.Println(err)
}
func cleanVendorBin(unclean string) (clean string) {
return strings.Replace(unclean, "./vendor/bin/", "./", 1)
}
func readFile(filename string) (contents string) {
data, err := ioutil.ReadFile(filename)
if err != nil {
}
return string(data)
}
func executeCommands(incoming string) error {
//
// Taken from http://nathanleclaire.com/blog/2014/12/29/shelled-out-commands-in-golang/
//
cmd := exec.Command("bash", "-c", incoming)
cmdReader, err := cmd.StdoutPipe()
scanner := bufio.NewScanner(cmdReader)
go func() {
for scanner.Scan() {
fmt.Printf("%s\n", scanner.Text())
}
}()
err = cmd.Start()
err = cmd.Wait()
return err
}
func doesFileExist(filename string) bool {
if _, err := os.Stat(filename); os.IsNotExist(err) {
return false
}
return true
}