Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
Remove comments. CORD-129
Browse files Browse the repository at this point in the history
  • Loading branch information
Clipeus committed Jun 19, 2019
1 parent 1a1c1e0 commit d3c29d2
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 134 deletions.
15 changes: 2 additions & 13 deletions branch/branch.go
Expand Up @@ -14,9 +14,9 @@ func CreateBranch(url string, login string, password string, name string, gameID
fmt.Printf("Creating branch ...\n")

_, err := games.GetGameInfo(qilinUrl, gameID)
/*if err != nil {
if err != nil {
return fmt.Errorf("Cannot get game info: %v", err)
}*/
}

api := cordapi.NewCordAPI(url)
err = api.Login(login, password)
Expand Down Expand Up @@ -138,17 +138,6 @@ func PublishBuild(url string, login string, password string, gameID string, bran
return err
}

/*build, err := api.GetBuild(buildId)
if err != nil {
return err
}
brn.LiveBuild = build.ID
err = api.UpdateBranch(brn)
if err != nil {
return err
}*/

fmt.Printf("Branch \"%s\" with id %s has published build with id %s\n", brn.Name, brn.ID, brn.LiveBuild)
return nil
}
Expand Down
6 changes: 0 additions & 6 deletions cmd/create/create.go
@@ -1,13 +1,9 @@
package create

import (
//"fmt"

"cord.stool/context"
"cord.stool/updater"
// "github.com/kr/pretty"
"github.com/urfave/cli"
//"github.com/kr/pretty"
)

var args = struct {
Expand Down Expand Up @@ -55,7 +51,5 @@ func Register(ctx *context.StoolContext) {
func do(ctx *context.StoolContext, c *cli.Context) error {
_, e := updater.PrepairDistr(args.SourceDir, args.TargetDir, args.Archive)

//fmt.Printf("%# v", pretty.Formatter(u))

return e
}
54 changes: 0 additions & 54 deletions service/controllers/branch.go
Expand Up @@ -521,21 +521,6 @@ func PublishBuildCmd(context echo.Context) error {

builtinAnnounceList := strings.Split(config.Get().Tracker.TrackersList, ";")

/*files, err := utils2.GetAllFiles(path.Join(fpath, "content"))
if !ok {
return utils.BuildInternalServerError(context, models.ErrorFileIOFailure, err.Error())
}
manifest, err := utils.GetConfigManifest(path.Join(fpath, "config.json"), platform, &context)
if err != nil {
return err
}
ignoreFiles, err := getIgnoreFiles(manifest, fpath, files, context)
if err != nil {
return err
}*/

ignoreFiles := map[string]bool{}

targetFile := path.Join(fpath, "torrent.torrent")
Expand Down Expand Up @@ -574,35 +559,6 @@ func PublishBuildCmd(context echo.Context) error {
return context.JSON(http.StatusOK, result)
}

/*func getIgnoreFiles(manifest *models.ConfigManifest, fpath string, files []string, context echo.Context) (map[string]bool, error) {
result := make(map[string]bool)
needFiles, err := filterFiles(manifest, locale, fpath, files, context)
if err != nil {
return nil, err
}
IgnoreFile := true
for _, f := range files {
for _, nf := range needFiles {
if f == nf {
IgnoreFile = false
break
}
}
if IgnoreFile {
result[f] = true
}
}
return result, nil
}*/

func filterFiles(manifest *models.ConfigManifest, locale string, fpath string, files []string, context echo.Context) ([]string, error) {

var result []string
Expand Down Expand Up @@ -755,10 +711,6 @@ func GetUpdateInfoCmd(context echo.Context) error {
return err
}

/*if currVer == context.QueryParam("ver") {
return utils.BuildBadRequestError(context, models.ErrorNoUpdateAvailable, "")
}*/

if _, err := os.Stat(configFile); os.IsNotExist(err) { // the file is not exist
return utils.BuildBadRequestError(context, models.ErrorConfigFileNotFound, "")
}
Expand Down Expand Up @@ -796,12 +748,6 @@ func GetUpdatePatchCmd(context echo.Context) error {
return utils.BuildBadRequestError(context, models.ErrorBuildIsNotPublished, "")
}

/*reqCmp := &models.GetPatchCmd{}
err = context.Bind(reqCmp)
if err != nil {
return utils.BuildBadRequestError(context, models.ErrorInvalidJSONFormat, err.Error())
}*/

platform := context.QueryParam("platform")
fpath, err := utils.GetUserBuildDepotPath(context.Request().Header.Get("ClientID"), result.LiveBuild, platform, context, false)
if err != nil {
Expand Down
45 changes: 1 addition & 44 deletions update/patch.go
Expand Up @@ -3,49 +3,15 @@ package update
import (
"fmt"
"io/ioutil"
"path/filepath"
//"time"
"os"
"path/filepath"

"cord.stool/utils"

"github.com/gosuri/uiprogress"
"github.com/gosuri/uiprogress/util/strutil"
)

/*var _bar *uiprogress.Bar
var _barTotal *uiprogress.Bar
var _curTitle string
var _totalTitle string
func newStateConsumer() *state.Consumer {
return &state.Consumer{
OnProgress: progress,
OnProgressLabel: progressLabel,
OnPauseProgress: pauseProgress,
OnResumeProgress: resumeProgress,
OnMessage: logl,
}
}
func progressLabel(label string) {
}
func pauseProgress() {
}
func resumeProgress() {
}
func progress(alpha float64) {
_bar.Set(int(100 * alpha))
_barTotal.Set(int(5*alpha) + (_barTotal.Total - 7))
}
func logl(level string, msg string) {
}*/

func CreatePatch(sourceOldDir string, sourceNewDir string, patchFile string) error {

fmt.Println("Making patch ...")
Expand Down Expand Up @@ -86,39 +52,30 @@ func CreatePatch(sourceOldDir string, sourceNewDir string, patchFile string) err
defer os.Remove(signFile.Name())
signFile.Close()

//time.Sleep(2 * time.Second)
//_bar.Incr()
_barTotal.Incr()

err = utils.CreateSignatureFile(fullSourceOldDir, signFile.Name(), newStateConsumer())
if err != nil {
return err
}

//time.Sleep(2 * time.Second)
//_bar.Incr()
_barTotal.Incr()

signInfo, err := utils.GetSignatureInfoFromFile(signFile.Name(), newStateConsumer())
if err != nil {
return err
}

//time.Sleep(2 * time.Second)
//_bar.Incr()
_barTotal.Incr()

_curTitle = "Creating patch ..."
_bar.Set(0)
//_bar.Total = 1

err = utils.CreatePatchFile(fullSourceNewDir, fullPatchFile, signInfo, newStateConsumer())
if err != nil {
return err
}

//time.Sleep(2 * time.Second)
//_bar.Incr()
_barTotal.Incr()

_totalTitle = "Finished"
Expand Down
8 changes: 0 additions & 8 deletions update/torrent.go
Expand Up @@ -12,7 +12,6 @@ import (
"path/filepath"
"syscall"
"time"
//"log"

"github.com/anacrolix/envpprof"
"github.com/anacrolix/torrent"
Expand All @@ -22,7 +21,6 @@ import (
humanize "github.com/dustin/go-humanize"
"github.com/edsrzf/mmap-go"
"github.com/gosuri/uiprogress"
//"github.com/gosuri/uiprogress/util/strutil"
)

func exitSignalHandlers(client *torrent.Client) {
Expand All @@ -38,9 +36,6 @@ func exitSignalHandlers(client *torrent.Client) {
func torrentBar(t *torrent.Torrent, bar *uiprogress.Bar) {

bar.Set(0)
/*bar.PrependFunc(func(*uiprogress.Bar) string {
return strutil.Resize("Downloading", 35)
})*/

bar.AppendFunc(func(*uiprogress.Bar) (ret string) {
select {
Expand Down Expand Up @@ -118,8 +113,6 @@ func StartDownLoad(torrentData []byte, output string, bar *uiprogress.Bar) error
f := func() { os.Stdout = old }
defer f()

//log.SetOutput(os.NewFile(uintptr(0), "NUL"))

defer envpprof.Stop()

clientConfig := torrent.NewDefaultClientConfig()
Expand Down Expand Up @@ -200,7 +193,6 @@ func verifyTorrent(info *metainfo.Info, source string, bar *uiprogress.Bar) erro
if !good {
return fmt.Errorf("hash mismatch at piece %d", i)
}
//fmt.Printf("%d: %x: %v\n", i, p.Hash(), good)
bar.Incr()
}
return nil
Expand Down
9 changes: 0 additions & 9 deletions updater/updateInfo_test.go
Expand Up @@ -58,12 +58,3 @@ func Test_UpdateInfoPack(t *testing.T) {

assert.Equal(t, info.Version1, u.Version1)
}

// func Test_Prepair2(t *testing.T) {
// sd := `E:\Pone\cord.stool.test\src\QGNA`
// od := `E:\Pone\cord.stool.test\dst`

// _, e := PrepairDistr(sd, od, true)
// assert.True(t, e == nil)

// }

0 comments on commit d3c29d2

Please sign in to comment.