From e06ec9bcbde7b5326095fdbcfb7b9a2bf9efb42e Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Sat, 29 Dec 2018 09:43:50 -0600 Subject: [PATCH] Add script to generate followHEAD page (#2391) --- .../autoload/SpaceVim/dev/followHEAD.vim | 62 ++++++++++++++++++ .../autoload/SpaceVim/dev/releases.vim | 65 +++++++++++++------ .github/PULL_REQUEST_TEMPLATE.md | 1 - .../2018-09-26-SpaceVim-release-v0.9.0.md | 1 + .../2018-12-25-SpaceVim-release-v1.0.0.md | 3 + wiki/cn/Following-HEAD.md | 24 +++---- wiki/en/Following-HEAD.md | 25 ++++--- 7 files changed, 135 insertions(+), 46 deletions(-) create mode 100644 .SpaceVim.d/autoload/SpaceVim/dev/followHEAD.vim diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/followHEAD.vim b/.SpaceVim.d/autoload/SpaceVim/dev/followHEAD.vim new file mode 100644 index 000000000..ac262c682 --- /dev/null +++ b/.SpaceVim.d/autoload/SpaceVim/dev/followHEAD.vim @@ -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 = '^$' +let s:AUTODOC.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 diff --git a/.SpaceVim.d/autoload/SpaceVim/dev/releases.vim b/.SpaceVim.d/autoload/SpaceVim/dev/releases.vim index 8fb7678ec..1985b666f 100644 --- a/.SpaceVim.d/autoload/SpaceVim/dev/releases.vim +++ b/.SpaceVim.d/autoload/SpaceVim/dev/releases.vim @@ -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 diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1b7c80909..d56345420 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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? diff --git a/docs/_posts/2018-09-26-SpaceVim-release-v0.9.0.md b/docs/_posts/2018-09-26-SpaceVim-release-v0.9.0.md index 648e7c1bb..56b72e9b7 100644 --- a/docs/_posts/2018-09-26-SpaceVim-release-v0.9.0.md +++ b/docs/_posts/2018-09-26-SpaceVim-release-v0.9.0.md @@ -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 diff --git a/docs/_posts/2018-12-25-SpaceVim-release-v1.0.0.md b/docs/_posts/2018-12-25-SpaceVim-release-v1.0.0.md index 1521681e9..ffb5c2282 100644 --- a/docs/_posts/2018-12-25-SpaceVim-release-v1.0.0.md +++ b/docs/_posts/2018-12-25-SpaceVim-release-v1.0.0.md @@ -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)) diff --git a/wiki/cn/Following-HEAD.md b/wiki/cn/Following-HEAD.md index b00f9ece5..e5f3905ea 100644 --- a/wiki/cn/Following-HEAD.md +++ b/wiki/cn/Following-HEAD.md @@ -4,25 +4,25 @@ 下一个版本号为 v1.1.0 -### 新特性 + + -### 功能改进 +#### 新特性 -- 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 及官网变动 - - -### 其他 + ## 上一个版本 diff --git a/wiki/en/Following-HEAD.md b/wiki/en/Following-HEAD.md index 85273a51a..f5af4ccc5 100644 --- a/wiki/en/Following-HEAD.md +++ b/wiki/en/Following-HEAD.md @@ -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 + + -### 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 + ## Latest Release