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



![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) ![](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 | | Web | UI | Preview |
|:-------------:|:-------:|:-------:| |:-------------:|:-------:|:-------:|

+ 3
- 0
conf/app.ini View File

MAX_CREATION_LIMIT = -1 MAX_CREATION_LIMIT = -1
; Patch test queue length, make it as large as possible ; Patch test queue length, make it as large as possible
PULL_REQUEST_QUEUE_LENGTH = 10000 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] [repository.editor]
; List of file extensions that should have line wraps in the CodeMirror editor ; List of file extensions that should have line wraps in the CodeMirror editor

+ 1
- 1
gogs.go View File

"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )


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


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

+ 15
- 0
models/repo.go View File



func LoadRepoConfig() { func LoadRepoConfig() {
// Load .gitignore and license files and readme templates. // Load .gitignore and license files and readme templates.
// TODO: should we allow custom files overwrite default ones?
types := []string{"gitignore", "license", "readme"} types := []string{"gitignore", "license", "readme"}
typeFiles := make([][]string, 3) typeFiles := make([][]string, 3)
for i, t := range types { for i, t := range types {
sort.Strings(Gitignores) sort.Strings(Gitignores)
sort.Strings(Licenses) sort.Strings(Licenses)
sort.Strings(Readmes) 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() { 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

ForcePrivate bool ForcePrivate bool
MaxCreationLimit int MaxCreationLimit int
PullRequestQueueLength int PullRequestQueueLength int
PreferredLicenses []string


// Repository editor settings // Repository editor settings
Editor struct { Editor struct {

+ 1
- 1
templates/.VERSION View File

0.9.89.0827
0.9.90.0828

Loading…
Cancel
Save