Merge pull request #43 from parkerl/add_elm_format_to_build

Make it easy to run `elm-format` locally
This commit is contained in:
Erik Simmler 2016-03-19 15:04:45 -04:00
commit c3c20ffeb1
2 changed files with 25 additions and 2 deletions

View file

@ -50,6 +50,8 @@ Please keep the following in mind:
- Make sure everything is good to go by running all tests with `bin/build.sh`.
- If you have [elm-format](https://github.com/avh4/elm-format) installed, you can easily check the project by running `WITH_FORMAT=true bin/build.sh`. If you get diffs on exercises other than the one you are working on, please submit a separate pull request.
- Please do not commit any Elm configuration files or directories inside the exercise, such as `elm-stuff`. Please include only the standard `elm-package.json`.
- Test files should use the following format:

View file

@ -10,10 +10,16 @@ do
echo '-------------------------------------------------------'
echo "Testing $exercise"
elm-test $exercise_dir/*Tests.elm
if [ $? -ne 0 ]; then
TEST_RESULT=1
FAILED_EXERCISES+="$exercise\n"
TEST_RESULT=1
FAILED_EXERCISES+="$exercise\n"
fi
if [ $WITH_FORMAT ]; then
elm-format $exercise_dir/*.elm --yes
fi
mv "$exercise_dir/$exercise.elm" "$exercise_dir/$exercise.example"
mv "$exercise_dir/$exercise.impl" "$exercise_dir/$exercise.elm"
done
@ -23,3 +29,18 @@ if [ $TEST_RESULT -ne 0 ]; then
printf $FAILED_EXERCISES
exit $TEST_RESULT
fi
if [ $WITH_FORMAT ]; then
git diff --quiet --exit-code
if [ $? -ne 0 ]; then
echo "*******************************************************************"
echo "*******************************************************************"
echo "**Git diff found - perhaps some of your changes are not formatted?*"
echo "** Please inspect the diffs before pushing. **"
echo "*******************************************************************"
echo "*******************************************************************"
exit 1
fi
fi