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

View file

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

View file

@ -12,7 +12,7 @@ case $(uname) in
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
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

View file

@ -1,5 +1,5 @@
{
"version": "2.0.0",
"version": "3.0.0",
"summary": "Exercism problems in Elm.",
"repository": "https://github.com/exercism/xelm.git",
"license": "BSD3",
@ -38,9 +38,9 @@
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "4.0.0 <= v < 5.0.0",
"elm-community/elm-test": "2.0.0 <= v < 3.0.0",
"rtfeldman/node-test-runner": "2.0.0 <= v < 3.0.0"
"elm-lang/core": "5.0.0 <= v < 6.0.0",
"elm-community/elm-test": "3.0.0 <= v < 4.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
complete solution though; you have to write some code.
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.
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.
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.
-}
@ -14,12 +14,12 @@ module HelloWorld exposing (..)
helloWorld : Maybe String -> String
helloWorld name =
"replace with your code!"
"replace with your code!"
{-
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.
If you leave them in, nitpickers will protest!
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.
If you leave them in, nitpickers will protest!
-}

View file

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