Update bin/build.sh to reflect the npm powered structure

This commit is contained in:
Erik Simmler 2016-12-17 13:08:08 -05:00
parent e9a8e9a660
commit b15ee1f3f2
8 changed files with 46 additions and 33 deletions

View file

@ -7,8 +7,7 @@ sudo: false
install: install:
- nvm install 6 - nvm install 6
- nvm use 6 - nvm use 6
- npm install -g elm@0.17.1 elm-test@0.17.3 - npm install
- elm package install -y
- bin/install-elm-format linux - bin/install-elm-format linux
- export PATH=$PATH:$PWD/bin - export PATH=$PATH:$PWD/bin
@ -19,4 +18,5 @@ script:
cache: cache:
directories: directories:
- elm-stuff - node_modules
- elm-stuff

View file

@ -12,7 +12,7 @@ if [ $? -ne 0 ]; then
exit 1 exit 1
fi fi
elm-format --yes --validate exercises/**/*{.example,Tests.elm} elm-format --yes --validate exercises/**/{*.example.elm,Tests.elm}
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "*******************************************************************" echo "*******************************************************************"
@ -33,19 +33,19 @@ fi
declare -i TEST_RESULT=0 declare -i TEST_RESULT=0
FAILED_EXERCISES='' FAILED_EXERCISES=''
for example_file in exercises/**/*.example for example_file in exercises/**/*.example.elm
do do
exercise_dir=$(dirname $example_file) exercise_dir=$(dirname $example_file)
exercise=$(basename $example_file .example) exercise_name=$(basename $example_file .example.elm)
mv "$exercise_dir/$exercise.elm" "$exercise_dir/$exercise.impl" mv "$exercise_dir/$exercise_name.elm" "$exercise_dir/$exercise_name.impl"
mv "$exercise_dir/$exercise.example" "$exercise_dir/$exercise.elm" mv "$exercise_dir/$exercise_name.example.elm" "$exercise_dir/$exercise_name.elm"
echo '-------------------------------------------------------' echo '-------------------------------------------------------'
echo "Testing $exercise" echo "Testing $exercise"
# prevent elm-test from installing dependencies # prevent elm-test from installing dependencies
mv $exercise_dir/elm-package.json $exercise_dir/elm-package.json.disabled mv $exercise_dir/elm-package.json $exercise_dir/elm-package.json.disabled
elm-test $exercise_dir/*Tests.elm npm test -- $exercise_dir/Tests.elm
# capture result from last command (elm-test) # capture result from last command (elm-test)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -55,8 +55,8 @@ do
# be kind, rewind # be kind, rewind
mv $exercise_dir/elm-package.json.disabled $exercise_dir/elm-package.json mv $exercise_dir/elm-package.json.disabled $exercise_dir/elm-package.json
mv "$exercise_dir/$exercise.elm" "$exercise_dir/$exercise.example" mv "$exercise_dir/$exercise_name.elm" "$exercise_dir/$exercise_name.example.elm"
mv "$exercise_dir/$exercise.impl" "$exercise_dir/$exercise.elm" mv "$exercise_dir/$exercise_name.impl" "$exercise_dir/$exercise_name.elm"
done done
if [ $TEST_RESULT -ne 0 ]; then if [ $TEST_RESULT -ne 0 ]; then

View file

@ -12,7 +12,7 @@ case $(uname) in
echo "linux";; echo "linux";;
esac) 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 URL=https://github.com/avh4/elm-format/releases/download/0.5.2-alpha/elm-format-0.18-0.5.2-alpha-$OS-x64.tgz
curl -L $URL | tar -xvzO > bin/elm-format curl -L $URL | tar -xvzO > bin/elm-format

View file

@ -1,5 +1,5 @@
{ {
"version": "2.0.0", "version": "3.0.0",
"summary": "Exercism problems in Elm.", "summary": "Exercism problems in Elm.",
"repository": "https://github.com/exercism/xelm.git", "repository": "https://github.com/exercism/xelm.git",
"license": "BSD3", "license": "BSD3",
@ -38,9 +38,9 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"elm-lang/core": "4.0.0 <= v < 5.0.0", "elm-lang/core": "5.0.0 <= v < 6.0.0",
"elm-community/elm-test": "2.0.0 <= v < 3.0.0", "elm-community/elm-test": "3.0.0 <= v < 4.0.0",
"rtfeldman/node-test-runner": "2.0.0 <= v < 3.0.0" "rtfeldman/node-test-runner": "3.0.0 <= v < 4.0.0"
}, },
"elm-version": "0.17.0 <= v < 0.18.0" "elm-version": "0.18.0 <= v < 0.19.0"
} }

View file

@ -1,9 +1,9 @@
{- {-
This is a "stub" file. It's a little start on your solution. It's not a This is a "stub" file. It's a little start on your solution. It's not a
complete solution though; you have to write some code. complete solution though; you have to write some code.
The module name is expected by the test program and must match the name of this The module name is expected by the test program and must match the name of this
file. It has to stay just the way it is. file. It has to stay just the way it is.
-} -}
@ -14,12 +14,12 @@ module HelloWorld exposing (..)
helloWorld : Maybe String -> String helloWorld : Maybe String -> String
helloWorld name = helloWorld name =
"replace with your code!" "replace with your code!"
{- {-
When you have a working solution, REMOVE ALL THE STOCK COMMENTS. When you have a working solution, REMOVE ALL THE STOCK COMMENTS.
They're here to help you get started but they only clutter a finished solution. They're here to help you get started but they only clutter a finished solution.
If you leave them in, nitpickers will protest! If you leave them in, nitpickers will protest!
-} -}

View file

@ -1,10 +1,13 @@
{ {
"scripts": { "description": "Excercism/Elm",
"postinstall": "elm package install -y", "repository": "https://github.com/exercism/xelm.git",
"test": "elm-test Tests.elm" "license": "MIT",
}, "scripts": {
"dependencies": { "postinstall": "elm-package install -y",
"elm": "^0.18.0", "test": "elm-test Tests.elm"
"elm-test": "^0.18.0" },
} "dependencies": {
"elm": "^0.18.0",
"elm-test": "^0.18.0"
}
} }

10
package.json Normal file
View file

@ -0,0 +1,10 @@
{
"scripts": {
"postinstall": "elm package install -y",
"test": "elm-test"
},
"dependencies": {
"elm": "^0.18.0",
"elm-test": "^0.18.0"
}
}