Added make lint-changed which lints changed files only.
This commit is contained in:
8
Makefile
8
Makefile
@@ -7,8 +7,12 @@ setup:
|
|||||||
@chmod +x .git/hooks/pre-commit
|
@chmod +x .git/hooks/pre-commit
|
||||||
@echo "Git pre-commit hook installed."
|
@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"
|
@echo "Installed required Ruby gems under .gem"
|
||||||
|
|
||||||
lint:
|
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
|
make index
|
||||||
git add ./pages/index.json
|
git add ./pages/index.json
|
||||||
|
make lint-changed
|
||||||
|
Reference in New Issue
Block a user