mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-08-03 22:15:42 +02:00
Added make lint-changed which lints changed files only.
This commit is contained in:
parent
075c96c3ce
commit
4b44492314
3 changed files with 13 additions and 2 deletions
8
Makefile
8
Makefile
|
@ -7,8 +7,12 @@ setup:
|
|||
@chmod +x .git/hooks/pre-commit
|
||||
@echo "Git pre-commit hook installed."
|
||||
|
||||
@gem install mdl --install-dir .gem
|
||||
@gem install mdl --install-dir .gem --no-rdoc --no-ri
|
||||
@echo "Installed required Ruby gems under .gem"
|
||||
|
||||
lint:
|
||||
@GEM_PATH=.gem PATH=$(PATH):.gem/bin find pages -exec mdl {} --style ./scripts/markdown-style.rb 1>&2 \;
|
||||
@GEM_PATH=.gem find pages -exec .gem/bin/mdl {} --style ./scripts/markdown-style.rb 1>&2 \;
|
||||
|
||||
lint-changed:
|
||||
@./scripts/lint-changed.sh
|
||||
|
||||
|
|
6
scripts/lint-changed.sh
Executable file
6
scripts/lint-changed.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
MD_FILES=`git diff --cached --name-only | tr " " "\n" | egrep ^.*\.md$`
|
||||
|
||||
# Execute Markdown lint if any markdown files have been changed and added to git
|
||||
[[ -z "$MD_FILES" ]] || GEM_PATH=.gem .gem/bin/mdl "$MD_FILES"
|
|
@ -2,3 +2,4 @@
|
|||
|
||||
make index
|
||||
git add ./pages/index.json
|
||||
make lint-changed
|
||||
|
|
Loading…
Add table
Reference in a new issue