Browse Source

#2901 allow setting preferred licenses

- Closes #3488
tags/v0.9.99
Unknwon 7 years ago
parent
commit
dad5c15520
7 changed files with 24 additions and 5 deletions
  1. 1
    1
      README.md
  2. 3
    0
      conf/app.ini
  3. 1
    1
      gogs.go
  4. 15
    0
      models/repo.go
  5. 2
    2
      modules/bindata/bindata.go
  6. 1
    0
      modules/setting/setting.go
  7. 1
    1
      templates/.VERSION

+ 1
- 1
README.md View File

@@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra

![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)

##### Current tip version: 0.9.89 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
##### Current tip version: 0.9.90 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)

| Web | UI | Preview |
|:-------------:|:-------:|:-------:|

+ 3
- 0
conf/app.ini View File

@@ -19,6 +19,9 @@ FORCE_PRIVATE = false
MAX_CREATION_LIMIT = -1
; Patch test queue length, make it as large as possible
PULL_REQUEST_QUEUE_LENGTH = 10000
; Preferred Licenses to place at the top of the List
; Name must match file name in conf/license or custom/conf/license
PREFERRED_LICENSES = Apache License 2.0,MIT License

[repository.editor]
; List of file extensions that should have line wraps in the CodeMirror editor

+ 1
- 1
gogs.go View File

@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)

const APP_VER = "0.9.89.0827"
const APP_VER = "0.9.90.0828"

func init() {
runtime.GOMAXPROCS(runtime.NumCPU())

+ 15
- 0
models/repo.go View File

@@ -62,6 +62,7 @@ var (

func LoadRepoConfig() {
// Load .gitignore and license files and readme templates.
// TODO: should we allow custom files overwrite default ones?
types := []string{"gitignore", "license", "readme"}
typeFiles := make([][]string, 3)
for i, t := range types {
@@ -91,6 +92,20 @@ func LoadRepoConfig() {
sort.Strings(Gitignores)
sort.Strings(Licenses)
sort.Strings(Readmes)

// Filter out invalid names and promote preferred licenses.
sortedLicenses := make([]string, 0, len(Licenses))
for _, name := range setting.Repository.PreferredLicenses {
if com.IsSliceContainsStr(Licenses, name) {
sortedLicenses = append(sortedLicenses, name)
}
}
for _, name := range Licenses {
if !com.IsSliceContainsStr(setting.Repository.PreferredLicenses, name) {
sortedLicenses = append(sortedLicenses, name)
}
}
Licenses = sortedLicenses
}

func NewRepoContext() {

+ 2
- 2
modules/bindata/bindata.go
File diff suppressed because it is too large
View File


+ 1
- 0
modules/setting/setting.go View File

@@ -114,6 +114,7 @@ var (
ForcePrivate bool
MaxCreationLimit int
PullRequestQueueLength int
PreferredLicenses []string

// Repository editor settings
Editor struct {

+ 1
- 1
templates/.VERSION View File

@@ -1 +1 @@
0.9.89.0827
0.9.90.0828

Loading…
Cancel
Save