Documentation ¶
Index ¶
- Constants
- Variables
- func Clean(dr util.DateRange, terminalOnly bool, appOnly bool) error
- func Initialize(terminal bool, tags []string, clearTags bool, autoLog string, local bool, ...) (string, error)
- func LoadTags(gtmPath string) ([]string, error)
- func Paths(wd ...string) (string, string, error)
- func SetUpPaths(cwd, wd string, err error) (gitRepoPath, workDirRoot, gtmPath string, setupError error)
- func SetupHooks(local bool, gitRepoPath, autoLog string) error
- func SetupTags(err error, tags []string, gtmPath string) ([]string, error)
- func Uninitialize() (string, error)
- type Index
Constants ¶
View Source
const ( // NoteNameSpace is the gtm git note namespace NoteNameSpace = "gtm-data" // GTMDir is the subdir for gtm within the git repo root directory GTMDir = ".gtm" )
Variables ¶
View Source
var ( // ErrNotInitialized is raised when a git repo not initialized for time tracking ErrNotInitialized = errors.New("Git Time Metric is not initialized") // ErrFileNotFound is raised when record an event for a file that does not exist ErrFileNotFound = errors.New("File does not exist") // AppEventFileContentRegex regex for app event files AppEventFileContentRegex = regexp.MustCompile(`\.gtm[\\/](?P<appName>.*)\.(?P<eventType>app|run|build)`) )
View Source
var ( // GitHooks is map of hooks to apply to the git repo GitHooks = map[string]scm.GitHook{ "post-commit": { Exe: "gtm", Command: "gtm commit --yes", RE: regexp.MustCompile(`(?s)[/:a-zA-Z0-9$_=()"\.\|\-\\ ]*gtm(.exe"|)\s+commit\s+--yes\.*`), }, } // GitConfig is map of git configuration settings GitConfig = map[string]string{ "alias.pushgtm": "push origin refs/notes/gtm-data", "alias.fetchgtm": "fetch origin refs/notes/gtm-data:refs/notes/gtm-data", "notes.rewriteRef": "refs/notes/gtm-data", "notes.rewriteMode": "concatenate", "notes.rewrite.rebase": "true", "notes.rewrite.amend": "true"} // GitIgnore is file ignore to apply to git repo GitIgnore = "/.gtm/" GitFetchRefs = []string{ "+refs/notes/gtm-data:refs/notes/gtm-data", } GitPushRefsHooks = map[string]scm.GitHook{ "pre-push": { Exe: "git", Command: "git push origin refs/notes/gtm-data --no-verify", RE: regexp.MustCompile( `(?s)[/:a-zA-Z0-9$_=()"\.\|\-\\ ]*git\s+push\s+origin\s+refs/notes/gtm-data\s+--no-verify\.*`), }, } GitLabHooks = map[string]scm.GitHook{ "prepare-commit-msg": { Exe: "gtm", Command: "gtm status --auto-log=gitlab >> $1", RE: regexp.MustCompile( `(?s)[/:a-zA-Z0-9$_=()"\.\|\-\\ ]*gtm(.exe"|)\s+status\s+--auto-log=gitlab\s+>>\s+\$1\.*`), }, } JiraHooks = map[string]scm.GitHook{ "prepare-commit-msg": { Exe: "gtm", Command: "gtm status --auto-log=jira >> $1", RE: regexp.MustCompile( `(?s)[/:a-zA-Z0-9$_=()"\.\|\-\\ ]*gtm(.exe"|)\s+status\s+--auto-log=jira\s+>>\s+\$1\.*`), }, } )
Functions ¶
func Initialize ¶
func Initialize( terminal bool, tags []string, clearTags bool, autoLog string, local bool, cwd string, ) (string, error)
Initialize initializes a git repo for time tracking
func SetUpPaths ¶
func SetupHooks ¶
func Uninitialize ¶
Uninitialize remove GTM tracking from the project in the current working directory
Types ¶
Click to show internal directories.
Click to hide internal directories.