2b86a17478
Theme resources can now be restricted to logged in users to avoid wasting bandwidth. The template building step is now a flag to gosora.exe / Gosora. Added build_templates.bat for test and development purposes. Added some extra error checks to the batch files. Fixed a compile error in the installer. Fixed a big data race in the template transpiler and cleaned up a few loose ends. Renamed CTemplateSet.log() to CTemplateSet.detail() to bring it in line with the /common/ logging Renamed CTemplateSet.logf() to CTemplateSet.detailf() to bring it in line with the /common/ logging You can now override templates in /templates/ without overwriting them by adding a modified version of a template with the same name in /templates/overrides/ Added Go Git as a dependency. Removed config.go from the repository, you need to rely on the installer to generate this now, or make one yourself based on the implementation of it in the installer. Travis now does tests for Go 1.10 Began work on the upgrader.
69 lines
1.2 KiB
Go
69 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
"os"
|
|
"runtime/debug"
|
|
|
|
"gopkg.in/src-d/go-git.v4"
|
|
)
|
|
|
|
func main() {
|
|
scanner := bufio.NewScanner(os.Stdin)
|
|
|
|
// Capture panics instead of closing the window at a superhuman speed before the user can read the message on Windows
|
|
defer func() {
|
|
r := recover()
|
|
if r != nil {
|
|
fmt.Println(r)
|
|
debug.PrintStack()
|
|
pressAnyKey(scanner)
|
|
return
|
|
}
|
|
}()
|
|
|
|
err := updater(scanner)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
}
|
|
}
|
|
|
|
func pressAnyKey(scanner *bufio.Scanner) {
|
|
fmt.Println("Please press enter to exit...")
|
|
for scanner.Scan() {
|
|
_ = scanner.Text()
|
|
return
|
|
}
|
|
}
|
|
|
|
func updater(scanner *bufio.Scanner) error {
|
|
fmt.Println("Welcome to Gosora's Upgrader")
|
|
fmt.Print("We're going to check for new updates, please wait patiently")
|
|
|
|
repo, err := git.PlainOpen("./.git")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
workTree, err := repo.Worktree()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
err = workTree.Pull(&git.PullOptions{RemoteName: "origin"})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Println("Updated to the latest commit")
|
|
headRef, err := repo.Head()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Println("Commit details:")
|
|
commit, err := repo.CommitObject(headRef.Hash())
|
|
return err
|
|
}
|