From 24b541801a32b79093acb9dd9932fb79f073b9f6 Mon Sep 17 00:00:00 2001 From: Tim Shannon Date: Mon, 25 Apr 2016 21:02:01 +0000 Subject: [PATCH] Added time took to release log statement Changed release file name handling to only include the base of the file path. --- README.md | 2 +- cycle.go | 7 +++++-- project.go | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c4bf67c..4e70109 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ You'll setup a project which will need the following information: 2. Script to build the repository 3. Script to test the repository 4. Script to build the release file -5. Path to the release file +5. Path to the release file / can also be a script that returns a file name 6. Script to set release name / version An optional set of environment strings can be set to define the environment in which the scripts run. diff --git a/cycle.go b/cycle.go index 8a1613b..9ddf1ee 100644 --- a/cycle.go +++ b/cycle.go @@ -33,6 +33,7 @@ func (p *Project) load() { p.setStage(stageLoad) p.setVersion("Version not yet set") + p.start = time.Time{} if p.filename == "" { p.errHandled(errors.New("Invalid project file name")) @@ -82,6 +83,7 @@ func (p *Project) load() { // fetched code, if there is then the temp dir is renamed to the version name func (p *Project) fetch() { p.setStage(stageFetch) + p.start = time.Now() if p.Fetch == "" { return @@ -216,14 +218,15 @@ func (p *Project) release() { return } - if p.errHandled(p.ds.AddRelease(p.version, p.ReleaseFile, buff)) { + if p.errHandled(p.ds.AddRelease(p.version, filepath.Base(p.ReleaseFile), buff)) { return } p.setStage(stageReleased) if p.errHandled(p.ds.AddLog(p.version, p.stage, - fmt.Sprintf("Project %s Version %s built, tested, and released successfully.\n", p.id(), p.version))) { + fmt.Sprintf("Project %s Version %s built, tested, and released successfully and took %s.\n", p.id(), p.version, + time.Now().Sub(p.start)))) { return } diff --git a/project.go b/project.go index df3e824..19112f2 100644 --- a/project.go +++ b/project.go @@ -68,6 +68,7 @@ type Project struct { status string version string hash string + start time.Time // the last start time of the latest cycle sync.RWMutex processing sync.Mutex