mirror of
https://github.com/gogs/gogs.git
synced 2025-05-23 07:50:23 +00:00
Refactoring: rename package routers -> routes
This commit is contained in:
parent
6197a7639a
commit
4400d2fdd9
@ -23,7 +23,7 @@ import (
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/httplib"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
http "github.com/gogits/gogs/routers/repo"
|
||||
http "github.com/gogits/gogs/routes/repo"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/models/errors"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
http "github.com/gogits/gogs/routers/repo"
|
||||
http "github.com/gogits/gogs/routes/repo"
|
||||
)
|
||||
|
||||
const (
|
||||
|
30
cmd/web.go
30
cmd/web.go
@ -36,13 +36,13 @@ import (
|
||||
"github.com/gogits/gogs/pkg/mailer"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/pkg/template"
|
||||
"github.com/gogits/gogs/routers"
|
||||
"github.com/gogits/gogs/routers/admin"
|
||||
apiv1 "github.com/gogits/gogs/routers/api/v1"
|
||||
"github.com/gogits/gogs/routers/dev"
|
||||
"github.com/gogits/gogs/routers/org"
|
||||
"github.com/gogits/gogs/routers/repo"
|
||||
"github.com/gogits/gogs/routers/user"
|
||||
"github.com/gogits/gogs/routes"
|
||||
"github.com/gogits/gogs/routes/admin"
|
||||
apiv1 "github.com/gogits/gogs/routes/api/v1"
|
||||
"github.com/gogits/gogs/routes/dev"
|
||||
"github.com/gogits/gogs/routes/org"
|
||||
"github.com/gogits/gogs/routes/repo"
|
||||
"github.com/gogits/gogs/routes/user"
|
||||
)
|
||||
|
||||
var Web = cli.Command{
|
||||
@ -160,7 +160,7 @@ func runWeb(c *cli.Context) error {
|
||||
if c.IsSet("config") {
|
||||
setting.CustomConf = c.String("config")
|
||||
}
|
||||
routers.GlobalInit()
|
||||
routes.GlobalInit()
|
||||
checkVersion()
|
||||
|
||||
m := newMacaron()
|
||||
@ -175,17 +175,17 @@ func runWeb(c *cli.Context) error {
|
||||
// FIXME: not all routes need go through same middlewares.
|
||||
// Especially some AJAX requests, we can reduce middleware number to improve performance.
|
||||
// Routers.
|
||||
m.Get("/", ignSignIn, routers.Home)
|
||||
m.Get("/", ignSignIn, routes.Home)
|
||||
m.Group("/explore", func() {
|
||||
m.Get("", func(c *context.Context) {
|
||||
c.Redirect(setting.AppSubURL + "/explore/repos")
|
||||
})
|
||||
m.Get("/repos", routers.ExploreRepos)
|
||||
m.Get("/users", routers.ExploreUsers)
|
||||
m.Get("/organizations", routers.ExploreOrganizations)
|
||||
m.Get("/repos", routes.ExploreRepos)
|
||||
m.Get("/users", routes.ExploreUsers)
|
||||
m.Get("/organizations", routes.ExploreOrganizations)
|
||||
}, ignSignIn)
|
||||
m.Combo("/install", routers.InstallInit).Get(routers.Install).
|
||||
Post(bindIgnErr(form.Install{}), routers.InstallPost)
|
||||
m.Combo("/install", routes.InstallInit).Get(routes.Install).
|
||||
Post(bindIgnErr(form.Install{}), routes.InstallPost)
|
||||
m.Get("/^:type(issues|pulls)$", reqSignIn, user.Issues)
|
||||
|
||||
// ***** START: User *****
|
||||
@ -651,7 +651,7 @@ func runWeb(c *cli.Context) error {
|
||||
})
|
||||
|
||||
// Not found handler.
|
||||
m.NotFound(routers.NotFound)
|
||||
m.NotFound(routes.NotFound)
|
||||
|
||||
// Flag for port number in case first time run conflict.
|
||||
if c.IsSet("port") {
|
||||
|
2
gogs.go
2
gogs.go
@ -16,7 +16,7 @@ import (
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
)
|
||||
|
||||
const APP_VER = "0.11.19.0609"
|
||||
const APP_VER = "0.11.19.0611"
|
||||
|
||||
func init() {
|
||||
setting.AppVer = APP_VER
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/routers"
|
||||
"github.com/gogits/gogs/routes"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -20,7 +20,7 @@ func Organizations(c *context.Context) {
|
||||
c.Data["PageIsAdmin"] = true
|
||||
c.Data["PageIsAdminOrganizations"] = true
|
||||
|
||||
routers.RenderUserSearch(c, &routers.UserSearchOptions{
|
||||
routes.RenderUserSearch(c, &routes.UserSearchOptions{
|
||||
Type: models.USER_TYPE_ORGANIZATION,
|
||||
Counter: models.CountOrganizations,
|
||||
Ranger: models.Organizations,
|
@ -15,7 +15,7 @@ import (
|
||||
"github.com/gogits/gogs/pkg/form"
|
||||
"github.com/gogits/gogs/pkg/mailer"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/routers"
|
||||
"github.com/gogits/gogs/routes"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -29,7 +29,7 @@ func Users(c *context.Context) {
|
||||
c.Data["PageIsAdmin"] = true
|
||||
c.Data["PageIsAdminUsers"] = true
|
||||
|
||||
routers.RenderUserSearch(c, &routers.UserSearchOptions{
|
||||
routes.RenderUserSearch(c, &routes.UserSearchOptions{
|
||||
Type: models.USER_TYPE_INDIVIDUAL,
|
||||
Counter: models.CountUsers,
|
||||
Ranger: models.Users,
|
@ -9,8 +9,8 @@ import (
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/routers/api/v1/convert"
|
||||
"github.com/gogits/gogs/routers/api/v1/user"
|
||||
"github.com/gogits/gogs/routes/api/v1/convert"
|
||||
"github.com/gogits/gogs/routes/api/v1/user"
|
||||
)
|
||||
|
||||
// https://github.com/gogits/go-gogs-client/wiki/Administration-Organizations#create-a-new-organization
|
@ -9,8 +9,8 @@ import (
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/routers/api/v1/convert"
|
||||
"github.com/gogits/gogs/routers/api/v1/user"
|
||||
"github.com/gogits/gogs/routes/api/v1/convert"
|
||||
"github.com/gogits/gogs/routes/api/v1/user"
|
||||
)
|
||||
|
||||
func CreateTeam(c *context.APIContext, form api.CreateTeamOption) {
|
@ -8,8 +8,8 @@ import (
|
||||
api "github.com/gogits/go-gogs-client"
|
||||
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/routers/api/v1/repo"
|
||||
"github.com/gogits/gogs/routers/api/v1/user"
|
||||
"github.com/gogits/gogs/routes/api/v1/repo"
|
||||
"github.com/gogits/gogs/routes/api/v1/user"
|
||||
)
|
||||
|
||||
// https://github.com/gogits/go-gogs-client/wiki/Administration-Repositories#create-a-new-repository
|
@ -13,7 +13,7 @@ import (
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/pkg/mailer"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/routers/api/v1/user"
|
||||
"github.com/gogits/gogs/routes/api/v1/user"
|
||||
)
|
||||
|
||||
func parseLoginSource(c *context.APIContext, u *models.User, sourceID int64, loginName string) {
|
@ -16,11 +16,11 @@ import (
|
||||
"github.com/gogits/gogs/models/errors"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/pkg/form"
|
||||
"github.com/gogits/gogs/routers/api/v1/admin"
|
||||
"github.com/gogits/gogs/routers/api/v1/misc"
|
||||
"github.com/gogits/gogs/routers/api/v1/org"
|
||||
"github.com/gogits/gogs/routers/api/v1/repo"
|
||||
"github.com/gogits/gogs/routers/api/v1/user"
|
||||
"github.com/gogits/gogs/routes/api/v1/admin"
|
||||
"github.com/gogits/gogs/routes/api/v1/misc"
|
||||
"github.com/gogits/gogs/routes/api/v1/org"
|
||||
"github.com/gogits/gogs/routes/api/v1/repo"
|
||||
"github.com/gogits/gogs/routes/api/v1/user"
|
||||
)
|
||||
|
||||
func repoAssignment() macaron.Handler {
|
@ -9,8 +9,8 @@ import (
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/routers/api/v1/convert"
|
||||
"github.com/gogits/gogs/routers/api/v1/user"
|
||||
"github.com/gogits/gogs/routes/api/v1/convert"
|
||||
"github.com/gogits/gogs/routes/api/v1/user"
|
||||
)
|
||||
|
||||
func listUserOrgs(c *context.APIContext, u *models.User, all bool) {
|
@ -8,7 +8,7 @@ import (
|
||||
api "github.com/gogits/go-gogs-client"
|
||||
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/routers/api/v1/convert"
|
||||
"github.com/gogits/gogs/routes/api/v1/convert"
|
||||
)
|
||||
|
||||
func ListTeams(c *context.APIContext) {
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/routers/api/v1/convert"
|
||||
"github.com/gogits/gogs/routes/api/v1/convert"
|
||||
)
|
||||
|
||||
// https://github.com/gogits/go-gogs-client/wiki/Repositories#get-branch
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/routers/repo"
|
||||
"github.com/gogits/gogs/routes/repo"
|
||||
)
|
||||
|
||||
// https://github.com/gogits/go-gogs-client/wiki/Repositories-Contents#download-raw-content
|
@ -14,7 +14,7 @@ import (
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/models/errors"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/routers/api/v1/convert"
|
||||
"github.com/gogits/gogs/routes/api/v1/convert"
|
||||
)
|
||||
|
||||
// https://github.com/gogits/go-gogs-client/wiki/Repositories#list-hooks
|
@ -12,7 +12,7 @@ import (
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/routers/api/v1/convert"
|
||||
"github.com/gogits/gogs/routes/api/v1/convert"
|
||||
)
|
||||
|
||||
func composeDeployKeysAPILink(repoPath string) string {
|
@ -16,7 +16,7 @@ import (
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/pkg/form"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/routers/api/v1/convert"
|
||||
"github.com/gogits/gogs/routes/api/v1/convert"
|
||||
)
|
||||
|
||||
// https://github.com/gogits/go-gogs-client/wiki/Repositories#search-repositories
|
@ -10,7 +10,7 @@ import (
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/routers/api/v1/convert"
|
||||
"github.com/gogits/gogs/routes/api/v1/convert"
|
||||
)
|
||||
|
||||
// https://github.com/gogits/go-gogs-client/wiki/Users-Emails#list-email-addresses-for-a-user
|
@ -11,8 +11,8 @@ import (
|
||||
"github.com/gogits/gogs/models/errors"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/routers/api/v1/convert"
|
||||
"github.com/gogits/gogs/routers/api/v1/repo"
|
||||
"github.com/gogits/gogs/routes/api/v1/convert"
|
||||
"github.com/gogits/gogs/routes/api/v1/repo"
|
||||
)
|
||||
|
||||
func GetUserByParamsName(c *context.APIContext, name string) *models.User {
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package routers
|
||||
package routes
|
||||
|
||||
import (
|
||||
"github.com/Unknwon/paginater"
|
||||
@ -10,7 +10,7 @@ import (
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/routers/user"
|
||||
"github.com/gogits/gogs/routes/user"
|
||||
)
|
||||
|
||||
const (
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package routers
|
||||
package routes
|
||||
|
||||
import (
|
||||
"net/mail"
|
@ -14,7 +14,7 @@ import (
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/pkg/form"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/routers/user"
|
||||
"github.com/gogits/gogs/routes/user"
|
||||
)
|
||||
|
||||
const (
|
@ -15,7 +15,7 @@ import (
|
||||
"github.com/gogits/gogs/models/errors"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/routers/repo"
|
||||
"github.com/gogits/gogs/routes/repo"
|
||||
)
|
||||
|
||||
const (
|
@ -1 +1 @@
|
||||
0.11.19.0609
|
||||
0.11.19.0611
|
Loading…
x
Reference in New Issue
Block a user