Automatically update README upon build

This commit is contained in:
Adam Stankiewicz 2015-07-18 22:34:26 +02:00
parent ee6b1ea157
commit 548653cafe
2 changed files with 27 additions and 2 deletions

View File

@ -66,6 +66,7 @@ Optionally download one of the [releases](https://github.com/sheerun/vim-polyglo
- [protobuf](https://github.com/uarun/vim-protobuf) (syntax, ftdetect)
- [python](https://github.com/mitsuhiko/vim-python-combined) (syntax, indent)
- [r-lang](https://github.com/vim-scripts/R.vim) (syntax, ftplugin)
- [ragel](https://github.com/jneen/ragel.vim) (syntax)
- [rspec](https://github.com/sheerun/rspec.vim) (syntax, ftdetect)
- [ruby](https://github.com/vim-ruby/vim-ruby) (syntax, indent, compiler, autoload, ftplugin, ftdetect)
- [rust](https://github.com/wting/rust.vim) (syntax, indent, compiler, autoload, ftplugin, ftdetect)

28
build
View File

@ -5,6 +5,13 @@ set -E
DIRS="syntax indent compiler autoload ftplugin ftdetect after/syntax after/indent after/ftplugin after/ftdetect"
DIRS_BASIC="syntax indent ftdetect after/syntax after/indent after/ftdetect"
OUTPUT=""
output() {
OUTPUT="$OUTPUT$1"
printf -- "$1"
}
download() {
for pack in $1; do
path="$(printf "$pack" | cut -d ':' -f 2)"
@ -24,7 +31,7 @@ extract() {
dir="tmp/$(printf "$path" | cut -d '/' -f 2)"
directories="DIRS$(printf "$pack" | cut -d ':' -f 3)"
subtree="$(printf "$pack" | cut -d ':' -f 4)"
printf -- "- [$name](https://github.com/$path) ("
output "- [$name](https://github.com/$path) ("
subdirs=""
for subdir in ${!directories}; do
@ -39,7 +46,7 @@ extract() {
done
printf "${subdirs##, })\n"
output "${subdirs##, })\n"
done
for pack in $1; do
@ -69,6 +76,22 @@ concat_ftdetect() {
mv tmp/polyglot.vim ftdetect/
}
update_readme() {
OLD_README="$(cat README.md)"
ed README.md <<- EOF
/Language packs
+2kb
/##
'b,-2c
$(printf -- "$OUTPUT")
.
w
q
EOF
}
PACKS="
arduino:sudar/vim-arduino-syntax
blade:xsbeats/vim-blade
@ -144,5 +167,6 @@ printf "Downloading packs..."
download "$PACKS"
extract "$PACKS"
concat_ftdetect
update_readme
rm -rf tmp