Browse Source

removed init() and added ignore file

bmallred 9 years ago
parent
commit
92447a8d67
2 changed files with 24 additions and 34 deletions
  1. 22 0
      .gitignore
  2. 2 34
      code-notify.go

+ 22 - 0
.gitignore

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
	"fmt"
5
	"fmt"
6
	"os"
6
	"os"
7
	"path/filepath"
7
	"path/filepath"
8
	"strings"
9
8
10
	"code.revolvingcow.com/revolvingcow/code/cmd"
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
func main() {
12
func main() {
45
	filepath.Walk(cmd.GetWorkingDirectory(), walk)
13
	filepath.Walk(cmd.GetWorkingDirectory(), walk)
46
}
14
}
56
	app := &cmd.App{
24
	app := &cmd.App{
57
		Directory: path,
25
		Directory: path,
58
		Args:      []string{"incoming"},
26
		Args:      []string{"incoming"},
59
		Stdout:    &buffer,
60
		Stderr:    &buffer,
27
		//Stdout:    &buffer,
28
		Stderr: &buffer,
61
	}
29
	}
62
30
63
	return app.Run()
31
	return app.Run()