Skip to content

Commit

Permalink
version reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Mar 22, 2018
1 parent 93c3adf commit 32803f0
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 1 deletion.
12 changes: 12 additions & 0 deletions app/napcomp/napcomp.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@ package main
// in both files.

import (
"flag"
"fmt"
"os"
"os/signal"
"runtime"
"syscall"

"github.com/nsip/nias2/napcomp"
"github.com/nsip/nias2/version"
)

var vers = flag.Bool("version", false, "Reports version of NIAS distribution")

func main() {

flag.Parse()

// shutdown handler
c := make(chan os.Signal, 2)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
Expand All @@ -25,6 +32,11 @@ func main() {
os.Exit(1)
}()

if *vers {
fmt.Printf("NIAS: Version %s\n", version.TagName)
os.Exit(1)
}

napcomp.IngestData()
napcomp.WriteReports()
// shut down
Expand Down
7 changes: 7 additions & 0 deletions app/naprrql/naprrql.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"syscall"

"github.com/nsip/nias2/naprrql"
"github.com/nsip/nias2/version"
)

var ingest = flag.Bool("ingest", false, "Loads data from results file. Exisitng data is overwritten.")
Expand All @@ -23,6 +24,7 @@ var report = flag.Bool("report", false, "Creates .csv reports. Existing reports
// var isrprint = flag.Bool("isrprint", false, "Creates .csv files for use in isr printing")
// var itemprint = flag.Bool("itemprint", false, "Creates .csv files reporting item results for each student against items")
var qa = flag.Bool("qa", false, "Creates .csv files for QA checking of NAPLAN results")
var vers = flag.Bool("version", false, "Reports version of NIAS distribution")

func main() {

Expand All @@ -39,6 +41,11 @@ func main() {
os.Exit(1)
}()

if *vers {
fmt.Printf("NIAS: Version %s\n", version.TagName)
os.Exit(1)
}

// ingest results data, rebuild reports, and exit to save memory
if *ingest {
ingestData()
Expand Down
11 changes: 11 additions & 0 deletions app/napval/napval.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@
package main

import (
"fmt"
"github.com/nsip/nias2/lib"
"github.com/nsip/nias2/napval"
"github.com/nsip/nias2/version"
"log"
"runtime"
)

var vers = flag.Bool("version", false, "Reports version of NIAS distribution")

func main() {

flag.Parse()

if *vers {
fmt.Printf("NIAS: Version %s\n", version.TagName)
os.Exit(1)
}

config := napval.LoadNAPLANConfig()
NAPLAN_NATS_CFG := lib.NATSConfig{Port: config.NATSPort}
log.Println("NAPVAL: Loading default config")
Expand Down
2 changes: 2 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

cd tools; go build release.go; cd ..
./tools/release > version/version.go
sh build.sh
./tools/release nias2 nias-Mac.zip build/nias-Mac.zip
./tools/release nias2 nias-Win64.zip build/nias-Win64.zip
./tools/release nias2 nias-Win32.zip build/nias-Win32.zip
Expand Down
8 changes: 7 additions & 1 deletion tools/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
Expand Down Expand Up @@ -131,6 +132,7 @@ func uploadFile(release jsonRelease, name string, filename string) jsonUpload {
// 1 = Project name
// 2 = File name to upload
// 3 = Local file path
// If called with just the project name, we generate versioning code
func main() {
// Load configuration
if _, err := toml.DecodeFile(os.Getenv("HOME")+"/.nsip.toml", &cfg); err != nil {
Expand All @@ -147,5 +149,9 @@ func main() {

log.Printf("Received release %d as %s", release.Id, release.TagName)

uploadFile(release, os.Args[2], os.Args[3])
if len(os.Args) == 2 {
fmt.Printf("package version\nvar(\nId = %d\nTagName = \"%s\"\n)\n", release.Id, release.TagName)
} else {
uploadFile(release, os.Args[2], os.Args[3])
}
}
5 changes: 5 additions & 0 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package version
var(
Id = 10054986
TagName = "0-9-21"
)

0 comments on commit 32803f0

Please sign in to comment.