mirror of
https://github.com/correl/elm.git
synced 2024-12-18 11:06:17 +00:00
commit
1e71d6c3f9
4 changed files with 52 additions and 22 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,6 +2,7 @@
|
|||
.DS_Store
|
||||
bin/configlet
|
||||
bin/configlet.exe
|
||||
bin/elm-format
|
||||
elm-stuff
|
||||
CHECKLIST
|
||||
build.js
|
||||
|
|
|
@ -9,6 +9,8 @@ install:
|
|||
- nvm use 6
|
||||
- npm install -g elm@0.17.1 elm-test@0.17.3
|
||||
- elm package install -y
|
||||
- bin/install-elm-format linux
|
||||
- export PATH=$PATH:$PWD/bin
|
||||
|
||||
script:
|
||||
- bin/fetch-configlet
|
||||
|
|
52
bin/build.sh
52
bin/build.sh
|
@ -1,10 +1,38 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# FORMAT
|
||||
|
||||
echo '-------------------------------------------------------'
|
||||
echo "Checking Formatting"
|
||||
|
||||
which elm-format > /dev/null
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "elm-format not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
elm-format --yes --validate exercises/**/*{.example,Tests.elm}
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "*******************************************************************"
|
||||
echo "*******************************************************************"
|
||||
echo "** elm-format failed **"
|
||||
echo "** perhaps some of your changes are not formatted? **"
|
||||
echo "** Please run elm-format before pushing. **"
|
||||
echo "*******************************************************************"
|
||||
echo "*******************************************************************"
|
||||
exit 1
|
||||
else
|
||||
echo "formatting looks good!"
|
||||
fi
|
||||
|
||||
|
||||
# TEST
|
||||
|
||||
declare -i TEST_RESULT=0
|
||||
FAILED_EXERCISES=''
|
||||
|
||||
elm-package install
|
||||
|
||||
for example_file in exercises/**/*.example
|
||||
do
|
||||
exercise_dir=$(dirname $example_file)
|
||||
|
@ -27,11 +55,6 @@ do
|
|||
|
||||
# be kind, rewind
|
||||
mv $exercise_dir/elm-package.json.disabled $exercise_dir/elm-package.json
|
||||
|
||||
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
|
||||
|
@ -41,18 +64,3 @@ 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
|
||||
|
||||
|
|
19
bin/install-elm-format
Executable file
19
bin/install-elm-format
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
OS=$(
|
||||
case $(uname) in
|
||||
(Darwin*)
|
||||
echo "mac";;
|
||||
(Linux*)
|
||||
echo "linux";;
|
||||
(Windows*)
|
||||
echo "windows";;
|
||||
(*)
|
||||
echo "linux";;
|
||||
esac)
|
||||
|
||||
URL=https://github.com/avh4/elm-format/releases/download/0.4.0-alpha/elm-format-0.17-0.4.0-alpha-$OS-x64.tgz
|
||||
|
||||
curl -L $URL | tar -xvzO > bin/elm-format
|
||||
|
||||
chmod u+x bin/elm-format
|
Loading…
Reference in a new issue