Skip to content

Commit

Permalink
run jscs over changes to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
samccone committed May 6, 2015
1 parent 1184e66 commit 3b725f0
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules
/bower_components
/dist
/tests/node_modules
1 change: 1 addition & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"function",
"typeof"
],
"excludeFiles": ["**/node_modules/**", "**/bower_components/**"],
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": true,
Expand Down
5 changes: 5 additions & 0 deletions browser-tests/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

npm i && \
eval "npm test -- $@"

10 changes: 10 additions & 0 deletions tests/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "todomvc-tests",
"private": true,
"scripts": {
"lint": "jscs"
},
"dependencies": {
"jscs": "^1.13.1"
}
}
16 changes: 16 additions & 0 deletions tests/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

PATHS=""
EXAMPLES_DIR="../examples/"

for arg in "$@"
do
case $arg in
--framework=*)
PATHS+=" "$EXAMPLES_DIR$(echo $arg | awk '{split($0,a,"="); print a[2]}')
;;
esac
done

npm i && \
eval "npm run lint -- -c ../.jscsrc $PATHS"
11 changes: 5 additions & 6 deletions travis-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ then
# Any command that using GH_OAUTH_TOKEN must pipe the output to /dev/null to not expose your oauth token
git push https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} HEAD:gh-pages > /dev/null 2>&1
else
git remote add current https://github.com/tastejs/todomvc.git && \
git fetch current && \
cd browser-tests/ && \
npm i && \
changes=$(git diff HEAD origin/master --name-only | awk 'BEGIN {FS = "/"}; {print $1 "/" $2 "/" $3}' | uniq | grep -v \/\/ | grep examples | awk -F '[/]' '{print "--framework=" $2}')
changes=$(./util/get-changes.sh) && \

if [ "${#changes}" = 0 ]
then
exit 0
else
echo changes | xargs npm run test --
cd tests && \
echo $changes | xargs ./run.sh && \
cd ../browser-tests && \
echo $changes | xargs ./run.sh
fi

exit $?
Expand Down
5 changes: 5 additions & 0 deletions util/get-changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

git remote add current https://github.com/tastejs/todomvc.git && \
git fetch --quiet current && \
git diff HEAD origin/master --name-only | awk 'BEGIN {FS = "/"}; {print $1 "/" $2 "/" $3}' | uniq | grep -v \/\/ | grep examples | awk -F '[/]' '{print "--framework=" $2}'

0 comments on commit 3b725f0

Please sign in to comment.