浏览代码

removed init() and added ignore file

bmallred 9 年之前
父节点
当前提交
92447a8d67
共有 2 个文件被更改,包括 24 次插入34 次删除
  1. 22 0
      .gitignore
  2. 2 34
      code-notify.go

+ 22 - 0
.gitignore

@ -0,0 +1,22 @@
1
# Compiled Object files, Static and Dynamic libs (Shared Objects)
2
*.o
3
*.a
4
*.so
5
6
# Folders
7
_obj
8
_test
9
10
# Architecture specific extensions/prefixes
11
*.[568vq]
12
[568vq].out
13
14
*.cgo1.go
15
*.cgo2.c
16
_cgo_defun.c
17
_cgo_gotypes.go
18
_cgo_export.*
19
20
_testmain.go
21
22
*.exe

+ 2 - 34
code-notify.go

@ -5,42 +5,10 @@ import (
5 5
	"fmt"
6 6
	"os"
7 7
	"path/filepath"
8
	"strings"
9 8
10 9
	"code.revolvingcow.com/revolvingcow/code/cmd"
11 10
)
12 11
13
func init() {
14
	for _, vcs := range cmd.GetVersionControlSystems() {
15
		key := fmt.Sprintf("CODE_%s_INCOMING", strings.ToUpper(vcs))
16
		env := os.Getenv(key)
17
18
		// Temporarily define the subcommand `incoming` for known version control systems
19
		if env == "" {
20
			incoming := ""
21
22
			switch vcs {
23
			case "git":
24
				incoming = "log ..@{u}"
25
				break
26
			case "hg":
27
				incoming = "incoming"
28
				break
29
			case "bzr":
30
				incoming = "missing"
31
				break
32
			case "tf":
33
				incoming = ""
34
				break
35
			}
36
37
			if incoming != "" {
38
				os.Setenv(key, incoming)
39
			}
40
		}
41
	}
42
}
43
44 12
func main() {
45 13
	filepath.Walk(cmd.GetWorkingDirectory(), walk)
46 14
}
@ -56,8 +24,8 @@ func walk(path string, fileInfo os.FileInfo, e error) error {
56 24
	app := &cmd.App{
57 25
		Directory: path,
58 26
		Args:      []string{"incoming"},
59
		Stdout:    &buffer,
60
		Stderr:    &buffer,
27
		//Stdout:    &buffer,
28
		Stderr: &buffer,
61 29
	}
62 30
63 31
	return app.Run()