diff --git a/cycle.go b/cycle.go index 98f9fa2..4a913c5 100644 --- a/cycle.go +++ b/cycle.go @@ -7,6 +7,7 @@ package main import ( "encoding/json" "errors" + "fmt" "io/ioutil" "os" "path/filepath" @@ -219,6 +220,13 @@ func (p *Project) release() { 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))) { + return + } + //build successfull, remove working dir p.errHandled(os.RemoveAll(p.workingDir())) diff --git a/project.go b/project.go index 20e3b58..e456bf4 100644 --- a/project.go +++ b/project.go @@ -25,12 +25,13 @@ const ( //stages const ( - stageLoad = "loading" - stageFetch = "fetching" - stageBuild = "building" - stageTest = "testing" - stageRelease = "releasing" - stageWait = "waiting" + stageLoad = "loading" + stageFetch = "fetching" + stageBuild = "building" + stageTest = "testing" + stageRelease = "releasing" + stageReleased = "released" + stageWait = "waiting" ) const projectFilePoll = 30 * time.Second diff --git a/web/index.html b/web/index.html index 5887cd0..a433261 100644 --- a/web/index.html +++ b/web/index.html @@ -57,28 +57,6 @@ margin: 10px; } - /*stages*/ - - .stage-load { - - } - - .stage-fetch { - - } - - .stage-build { - - } - - .stage-test { - - } - - .stage-release { - - } - /* breadcrumbs */ #breadcrumbs { @@ -177,9 +155,37 @@ {{/partial}} {{#partial project}} +
+ + + + + + + + + + + {{#project.versions:i}} + + + + + + + {{/versions}} + +
VersionStageLast LogRelease File
{{.version}}{{.stage}}{{#if .log}}{{.log.substring(0,100) + " ..."}}{{/if}} + {{#if .stage == "released"}} + Download + {{/if}} +
+
+ {{/partial}} {{#partial version}} + {{/partial}} {{#partial stage}} diff --git a/web/js/index.js b/web/js/index.js index 61fc987..74ef888 100644 --- a/web/js/index.js +++ b/web/js/index.js @@ -3,6 +3,8 @@ // that can be found in the LICENSE file. /* jshint strict: true */ +Ractive.DEBUG = false; + (function() { "use strict"; @@ -39,14 +41,11 @@ if (paths[2]) { getProject(paths[2]); if (paths[3]) { - r.set("version", paths[3]); + getVersion(paths[2], paths[3]); if (paths[4]) { - r.set("stage", paths[4]); - //get stage + getStage(paths[2], paths[3], paths[4]); } - //get version } - } getProjects(); return; @@ -80,9 +79,29 @@ }); } + function getVersion(id, version) { + get("/log/" + id + "/" + version, + function(result) { + r.set("version", result.data); + }, + function(result) { + r.set("error", err(result).message); + }); + } + + function getStage(id, version, stage) { + get("/log/" + id + "/" + version + "/" + stage, + function(result) { + r.set("stage", result.data); + }, + function(result) { + r.set("error", err(result).message); + }); + } + function setStatus(project) { //statuses - if (project.lastLog.version == project.releaseVersion) { + if (project.lastLog.version.trim() == project.releaseVersion.trim()) { project.status = "Success"; } else { if (project.lastLog.stage == "loading") { diff --git a/webProject.go b/webProject.go index 3fbe501..17b6418 100644 --- a/webProject.go +++ b/webProject.go @@ -10,6 +10,8 @@ import ( "net/url" "strings" "time" + + "git.townsourced.com/ironsmith/datastore" ) // /path/// @@ -73,9 +75,21 @@ func logGet(w http.ResponseWriter, r *http.Request) { if errHandled(err, w, r) { return } + + prjData, err := project.webData() + if errHandled(err, w, r) { + return + } + respondJsend(w, &JSend{ Status: statusSuccess, - Data: vers, + Data: struct { + *webProject + Versions []*datastore.Log `json:"versions"` + }{ + webProject: prjData, + Versions: vers, + }, }) return }