1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-02 22:40:06 +08:00

Add script to generate followHEAD page (#2391)

This commit is contained in:
Wang Shidong 2018-12-29 09:43:50 -06:00 committed by GitHub
parent f06abb5da4
commit e06ec9bcbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 135 additions and 46 deletions

View File

@ -0,0 +1,62 @@
"=============================================================================
" followHEAD.vim --- generate follow HEAD page
" Copyright (c) 2016-2017 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
let s:AUTODOC = SpaceVim#api#import('dev#autodoc')
let s:AUTODOC.begin = '^<!-- SpaceVim follow HEAD en start -->$'
let s:AUTODOC.end = '^<!-- SpaceVim follow HEAD en end -->$'
function! s:generate_content() abort
let content = s:follow_head_content()
return content
endfunction
let s:AUTODOC.content_func = function('s:generate_content')
let s:AUTODOC.autoformat = 1
let s:lang = 'en'
function! SpaceVim#dev#followHEAD#update(lang) abort
let s:lang = a:lang
call s:AUTODOC.update()
endfunction
function! s:list_closed_prs(owner, repo, page) abort
return github#api#util#Get('repos/' . a:owner . '/' . a:repo . '/issues?state=closed&page=' . a:page , [])
endfunction
function! s:get_list_of_PRs() abort
let prs = []
for i in range(1, 2)
let issues = s:list_closed_prs('SpaceVim','SpaceVim', i)
call extend(prs,
\ filter(issues,
\ "v:val['number'] > "
\ . SpaceVim#dev#releases#last_release_number()
\ . " && v:val['number'] < "
\ . SpaceVim#dev#releases#current_release_number()
\ . " && index(SpaceVim#dev#releases#unmerged_prs_since_current_release(), v:val['number']) == -1 "
\ ))
endfor
for i in SpaceVim#dev#releases#get_unmerged_prs()
let pr = github#api#issues#Get_issue('SpaceVim', 'SpaceVim', i)
if get(pr, 'state', '') ==# 'closed'
call add(prs, pr)
endif
endfor
return filter(prs, "has_key(v:val, 'pull_request')")
endfunction
let s:prs = []
function! s:follow_head_content() abort
let md = []
if s:prs == []
let s:prs =s:get_list_of_PRs()
endif
let md = md + SpaceVim#dev#releases#parser_prs(s:prs, s:lang)
return join(md, "\n")
endfunction

View File

@ -7,27 +7,44 @@
"=============================================================================
" v0.4.0 is released at https://github.com/SpaceVim/SpaceVim/pull/768
" v0.5.0 is released at https://github.com/SpaceVim/SpaceVim/pull/966
" 2017-08-05 v0.4.0 is released at https://github.com/SpaceVim/SpaceVim/pull/768
" 2017-11-16 v0.5.0 is released at https://github.com/SpaceVim/SpaceVim/pull/966
" v0.6.0 is released at https://github.com/SpaceVim/SpaceVim/pull/1205
" v0.7.0 is released at https://github.com/SpaceVim/SpaceVim/pull/1610
" v0.8.0 is released at https://github.com/SpaceVim/SpaceVim/pull/1841
" v0.9.0 is released at https://github.com/SpaceVim/SpaceVim/pull/2203
" v1.0.0 is released at https://github.com/SpaceVim/SpaceVim/pull/2377
" 2018-09-26 v0.9.0 is released at https://github.com/SpaceVim/SpaceVim/pull/2203
" 2018-12-25 v1.0.0 is released at https://github.com/SpaceVim/SpaceVim/pull/2377
" this option can only be changed after release
let s:unmerged_prs_since_last_release = [1306, 1697, 1725, 1777, 1786, 1802, 1833, 1838, 1926, 2004, 2056, 2101, 2155, 1963, 1977, 1993, 2014, 2016, 2092, 2131, 2150, 2164, 2165, 2190]
" This is a list of PRs which has not be merged when v1.0.0 is released:
let s:unmerged_prs_since_last_release = [2056, 1963, 1977, 1993, 2014, 2016, 2092, 2131, 2150, 2164, 2165, 2216, 2218, 2226, 2230, 2232, 2242, 2255, 2256, 2282, 2307, 2331, 2337, 2368, 2370]
" these options can be changed when going to release new tag
let s:last_release_number = 2203
let s:current_release_number = 2377
let s:last_release_number = 2377
let s:current_release_number = -1
" this is a list of pull request number which > last_release_number and <
" current_release_number
let s:unmerged_prs_since_current_release = [ 2226, 2370]
" next time when I release v1.1.0, only need to update following option
let s:unmerged_prs_since_current_release = []
" the logic should be from last_release_number to current_release_number,
" include prs in unmerged_prs_since_last_release which is merged.
" exclude prs in unmerged_prs_since_current_release
function! SpaceVim#dev#releases#get_unmerged_prs() abort
return copy(s:unmerged_prs_since_last_release)
endfunction
function! SpaceVim#dev#releases#last_release_number() abort
return s:last_release_number
endfunction
function! SpaceVim#dev#releases#current_release_number() abort
return s:current_release_number > 0 ? s:current_release_number : 999999
endfunction
function! SpaceVim#dev#releases#unmerged_prs_since_current_release() abort
return s:unmerged_prs_since_current_release
endfunction
function! s:body() abort
return 'SpaceVim development (pre-release:' . g:spacevim_version . ') build.'
endfunction
@ -81,19 +98,28 @@ endfunction
function! s:pr_to_list(pr) abort
return '- ' . a:pr.title . ' [#' . a:pr.number . '](' . a:pr.html_url . ')'
endfunction
let g:wsd = []
let s:prs = []
function! SpaceVim#dev#releases#content() abort
let md = [
\ '### SpaceVim release ' . g:spacevim_version
\ ]
if s:prs == []
let s:prs =s:get_list_of_PRs()
endif
let md = md + SpaceVim#dev#releases#parser_prs(s:prs, 'en')
return join(md, "\n")
endfunction
" this function is to generate markdown form pull request list
function! SpaceVim#dev#releases#parser_prs(prs, ...) abort
let is_cn = get(a:000, 0, '') == 'cn'
let g:is_cn = is_cn
let md = []
let adds = []
let changes = []
let fixs = []
let others = []
if g:wsd == []
let g:wsd =s:get_list_of_PRs()
endif
for pr in g:wsd
for pr in a:prs
if pr.title =~? '^ADD'
call add(adds, s:pr_to_list(pr))
elseif pr.title =~? '^CHANGE'
@ -106,32 +132,31 @@ function! SpaceVim#dev#releases#content() abort
endfor
if !empty(adds)
call add(md, '')
call add(md, '#### New Features')
call add(md, is_cn ? '#### 新特性' : '#### New Features')
call add(md, '')
call extend(md, adds)
call add(md, '')
endif
if !empty(changes)
call add(md, '')
call add(md, '#### Feature Changes')
call add(md, is_cn ? '#### 改变' : '#### Feature Changes')
call add(md, '')
call extend(md, changes)
call add(md, '')
endif
if !empty(fixs)
call add(md, '')
call add(md, '#### Bug Fixs')
call add(md, is_cn ? '#### 问题修复' : '#### Bug Fixs')
call add(md, '')
call extend(md, fixs)
call add(md, '')
endif
if !empty(others)
call add(md, '')
call add(md, '#### Unmarked PRs')
call add(md, is_cn ? '#### 未知' : '#### Unmarked PRs')
call add(md, '')
call extend(md, others)
call add(md, '')
endif
return join(md, "\n")
return md
endfunction

View File

@ -6,7 +6,6 @@ Please complete these steps and check these boxes before filing your PR:
- [ ] I have read and understood SpaceVim's [CONTRIBUTING](https://github.com/SpaceVim/SpaceVim/blob/master/CONTRIBUTING.md) document.
- [ ] I have read and understood SpaceVim's [CODE_OF_CONDUCT](https://github.com/SpaceVim/SpaceVim/blob/master/CODE_OF_CONDUCT.md) document.
- [ ] I have updated the [Following-HEAD](https://github.com/SpaceVim/SpaceVim/blob/master/wiki/en/Following-HEAD.md) page for this PR.
- [ ] I understand my PR may be closed if it becomes obvious I didn't actually perform all of these steps.
### Why this change is necessary and useful?

View File

@ -181,6 +181,7 @@ the name of the tab will be displayed on tabline and tabmanger.
- Fix toggle cursorline
- Fix cn install script ([#2181](https://github.com/SpaceVim/SpaceVim/pull/2181))
- Fix searching for the cursor word in the project w/ FlyGrep ([#2183](https://github.com/SpaceVim/SpaceVim/pull/2183))
- Fix cscope layer ([#1786](https://github.com/SpaceVim/SpaceVim/pull/1786))
### Doc, Wiki && Website

View File

@ -46,6 +46,8 @@ of SpaceVim v1.0.0 has been released.
- Add log for bootstrap function ([#2232](https://github.com/SpaceVim/SpaceVim/pull/2323))
- Add findstr support in flygrep ([#2344](https://github.com/SpaceVim/SpaceVim/pull/2344))
- Add API: `get_sid_from_path` ([#2350](https://github.com/SpaceVim/SpaceVim/pull/2350))
- Add better way to use find with vim ([#1777](https://github.com/SpaceVim/SpaceVim/pull/1777))
- Add `test` layer ([#2101](https://github.com/SpaceVim/SpaceVim/pull/2101))
### Improvement
@ -84,3 +86,4 @@ of SpaceVim v1.0.0 has been released.
### Doc
- Online tutorial ([#2004](https://github.com/SpaceVim/SpaceVim/pull/2004))
- Add some tweaks on doc instructions ([#2056](https://github.com/SpaceVim/SpaceVim/pull/2056))

View File

@ -4,25 +4,25 @@
下一个版本号为 v1.1.0
### 新特性
<!-- call SpaceVim#dev#followHEAD#update('cn') -->
<!-- SpaceVim follow HEAD en start -->
### 功能改进
#### 新特性
- Add debug info for flygrep ([#2388](https://github.com/SpaceVim/SpaceVim/pull/2388))
- Improve preview feature of flygrep ([#2256](https://github.com/SpaceVim/SpaceVim/pull/2256))
- Add some log for flygrep [#2388](https://github.com/SpaceVim/SpaceVim/pull/2388)
### 非兼容性变动
#### 问题修复
### 问题修复
- Fix debug command [#2226](https://github.com/SpaceVim/SpaceVim/pull/2226)
- Fix preview in flygrep [#2256](https://github.com/SpaceVim/SpaceVim/pull/2256)
- Clear rootDir cache after rooter pattern change([#2370](https://github.com/SpaceVim/SpaceVim/pull/2370))
#### 未知
### 移除的功能
- Rework faq.md phrasing. [#2386](https://github.com/SpaceVim/SpaceVim/pull/2386)
- Update to v1.1.0-dev [#2382](https://github.com/SpaceVim/SpaceVim/pull/2382)
- Doc: add some tweaks on doc instructions [#2056](https://github.com/SpaceVim/SpaceVim/pull/2056)
### 文档、wiki 及官网变动
### 其他
<!-- SpaceVim follow HEAD en end -->
## 上一个版本

View File

@ -4,26 +4,25 @@ This page documents changes in master branch since last release v1.0.0
The next release is v1.1.0
### Added
<!-- call SpaceVim#dev#followHEAD#update('en') -->
<!-- SpaceVim follow HEAD en start -->
### Improvement
#### New Features
- Add debug info for flygrep ([#2388](https://github.com/SpaceVim/SpaceVim/pull/2388))
- Improve preview feature of flygrep ([#2256](https://github.com/SpaceVim/SpaceVim/pull/2256))
- Add some log for flygrep [#2388](https://github.com/SpaceVim/SpaceVim/pull/2388)
### Changed
#### Bug Fixs
### Fixed
- Fix debug command [#2226](https://github.com/SpaceVim/SpaceVim/pull/2226)
- Fix preview in flygrep [#2256](https://github.com/SpaceVim/SpaceVim/pull/2256)
- Clear rootDir cache after rooter pattern change([#2370](https://github.com/SpaceVim/SpaceVim/pull/2370))
#### Unmarked PRs
### Removed
- Rework faq.md phrasing. [#2386](https://github.com/SpaceVim/SpaceVim/pull/2386)
- Update to v1.1.0-dev [#2382](https://github.com/SpaceVim/SpaceVim/pull/2382)
- Doc: add some tweaks on doc instructions [#2056](https://github.com/SpaceVim/SpaceVim/pull/2056)
### Doc, Wiki && Website
- Updated the faq page with additional links and rephrased for clarity.
### Others
<!-- SpaceVim follow HEAD en end -->
## Latest Release