Browse Source

remove unused scripts and simplify migrate form definition

pull/1038/head
Unknwon 10 years ago
parent
commit
34102f7889
  1. 22
      .gobuild.yml
  2. 2
      gogs.go
  3. 14
      modules/auth/repo_form.go
  4. 6
      routers/api/v1/repo.go
  5. 6
      routers/repo/repo.go
  6. 2
      templates/.VERSION
  7. 4
      templates/repo/migrate.tmpl
  8. 1
      wercker.yml

22
.gobuild.yml

@ -1,22 +0,0 @@
filesets:
includes:
- conf
- etc
- public
- scripts
- templates
- LICENSE
- README.md
- README_ZH.md
excludes:
- \.git
depth: 5
settings:
build: |
if test "$GOOS" = "windows" -a "$GOARCH" = "386"
then
go install -v
else
go get -v -tags "sqlite redis memcache cert" github.com/gogits/gogs
go install -v -tags "sqlite redis memcache cert"
fi

2
gogs.go

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.5.16.0301 Beta" const APP_VER = "0.5.16.0311 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

14
modules/auth/repo_form.go

@ -32,13 +32,13 @@ func (f *CreateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) bin
type MigrateRepoForm struct { type MigrateRepoForm struct {
CloneAddr string `binding:"Required"` CloneAddr string `binding:"Required"`
AuthUserName string `form:"auth_username"` AuthUsername string
AuthPasswd string `form:"auth_password"` AuthPassword string
Uid int64 `form:"uid" binding:"Required"` Uid int64 `binding:"Required"`
RepoName string `form:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"` RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
Mirror bool `form:"mirror"` Mirror bool
Private bool `form:"private"` Private bool
Description string `form:"desc" binding:"MaxSize(255)"` Description string `binding:"MaxSize(255)"`
} }
func (f *MigrateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { func (f *MigrateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {

6
routers/api/v1/repo.go

@ -196,7 +196,7 @@ func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) {
} }
} }
// Remote address can be HTTPS URL or local path. // Remote address can be HTTP/HTTPS URL or local path.
remoteAddr := form.CloneAddr remoteAddr := form.CloneAddr
if strings.HasPrefix(form.CloneAddr, "http") { if strings.HasPrefix(form.CloneAddr, "http") {
u, err := url.Parse(form.CloneAddr) u, err := url.Parse(form.CloneAddr)
@ -204,8 +204,8 @@ func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) {
ctx.HandleAPI(422, err) ctx.HandleAPI(422, err)
return return
} }
if len(form.AuthUserName) > 0 || len(form.AuthPasswd) > 0 { if len(form.AuthUsername) > 0 || len(form.AuthPassword) > 0 {
u.User = url.UserPassword(form.AuthUserName, form.AuthPasswd) u.User = url.UserPassword(form.AuthUsername, form.AuthPassword)
} }
remoteAddr = u.String() remoteAddr = u.String()
} else if !com.IsDir(remoteAddr) { } else if !com.IsDir(remoteAddr) {

6
routers/repo/repo.go

@ -181,7 +181,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
} }
} }
// Remote address can be HTTPS URL or local path. // Remote address can be HTTP/HTTPS URL or local path.
remoteAddr := form.CloneAddr remoteAddr := form.CloneAddr
if strings.HasPrefix(form.CloneAddr, "http") { if strings.HasPrefix(form.CloneAddr, "http") {
u, err := url.Parse(form.CloneAddr) u, err := url.Parse(form.CloneAddr)
@ -190,8 +190,8 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
ctx.RenderWithErr(ctx.Tr("form.url_error"), MIGRATE, &form) ctx.RenderWithErr(ctx.Tr("form.url_error"), MIGRATE, &form)
return return
} }
if len(form.AuthUserName) > 0 || len(form.AuthPasswd) > 0 { if len(form.AuthUsername) > 0 || len(form.AuthPassword) > 0 {
u.User = url.UserPassword(form.AuthUserName, form.AuthPasswd) u.User = url.UserPassword(form.AuthUsername, form.AuthPassword)
} }
remoteAddr = u.String() remoteAddr = u.String()
} else if !com.IsDir(remoteAddr) { } else if !com.IsDir(remoteAddr) {

2
templates/.VERSION

@ -1 +1 @@
0.5.16.0301 Beta 0.5.16.0311 Beta

4
templates/repo/migrate.tmpl

@ -68,8 +68,8 @@
<span>{{.i18n.Tr "repo.migrate_type_helper" | Str2html}}</span> <span>{{.i18n.Tr "repo.migrate_type_helper" | Str2html}}</span>
</div> </div>
<div class="field clear"> <div class="field clear">
<label class="left" for="desc">{{.i18n.Tr "repo.repo_desc"}}</label> <label class="left" for="description">{{.i18n.Tr "repo.repo_desc"}}</label>
<textarea class="ipt ipt-large ipt-radius {{if .Err_Description}}ipt-error{{end}}" id="desc" name="desc">{{.desc}}</textarea> <textarea class="ipt ipt-large ipt-radius {{if .Err_Description}}ipt-error{{end}}" id="description" name="description">{{.description}}</textarea>
</div> </div>
<div class="field"> <div class="field">
<label for="repo-create-submit"></label> <label for="repo-create-submit"></label>

1
wercker.yml

@ -1 +0,0 @@
box: wercker/default
Loading…
Cancel
Save