diff --git a/.travis.yml b/.travis.yml index 339ed48d424..b7365b5aaec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,12 +2,5 @@ sudo: false language: python python: - "3.4" -install: - - pip install -r requirements_all.txt - - pip install flake8 pylint coveralls script: - - flake8 homeassistant - - pylint homeassistant - - coverage run -m unittest discover tests -after_success: - - coveralls + - script/cibuild diff --git a/script/bootstrap b/script/bootstrap new file mode 100755 index 00000000000..f4cb6753fe8 --- /dev/null +++ b/script/bootstrap @@ -0,0 +1,9 @@ +#!/bin/sh + +# script/bootstrap: Resolve all dependencies that the application requires to +# run. + +cd "$(dirname "$0")/.." + +script/bootstrap_server +script/bootstrap_frontend diff --git a/script/bootstrap_frontend b/script/bootstrap_frontend new file mode 100755 index 00000000000..6fc94f95725 --- /dev/null +++ b/script/bootstrap_frontend @@ -0,0 +1,5 @@ +echo "Bootstrapping frontend..." +cd homeassistant/components/frontend/www_static/home-assistant-polymer +npm install +npm run setup_js_dev +cd ../../../../.. diff --git a/script/bootstrap_server b/script/bootstrap_server new file mode 100755 index 00000000000..c68e198c014 --- /dev/null +++ b/script/bootstrap_server @@ -0,0 +1,10 @@ +cd "$(dirname "$0")/.." + +echo "Update the submodule to latest version..." +git submodule update + +echo "Installing dependencies..." +python3 -m pip install --upgrade -r requirements_all.txt + +echo "Installing development dependencies.." +python3 -m pip install --upgrade flake8 pylint coveralls pytest diff --git a/scripts/build_frontend b/script/build_frontend similarity index 86% rename from scripts/build_frontend rename to script/build_frontend index 9554e82256d..70eacdb6baf 100755 --- a/scripts/build_frontend +++ b/script/build_frontend @@ -1,12 +1,8 @@ # Builds the frontend for production -# If current pwd is scripts, go 1 up. -if [ ${PWD##*/} == "scripts" ]; then - cd .. -fi +cd "$(dirname "$0")/.." cd homeassistant/components/frontend/www_static/home-assistant-polymer -npm install npm run frontend_prod cp bower_components/webcomponentsjs/webcomponents-lite.min.js .. diff --git a/scripts/build_python_openzwave b/script/build_python_openzwave similarity index 87% rename from scripts/build_python_openzwave rename to script/build_python_openzwave index 24bd8e2b64f..02c088fca44 100755 --- a/scripts/build_python_openzwave +++ b/script/build_python_openzwave @@ -3,10 +3,7 @@ # apt-get install cython3 libudev-dev python-sphinx python3-setuptools # pip3 install cython -# If current pwd is scripts, go 1 up. -if [ ${PWD##*/} == "scripts" ]; then - cd .. -fi +cd "$(dirname "$0")/.." if [ ! -d build ]; then mkdir build diff --git a/script/cibuild b/script/cibuild new file mode 100755 index 00000000000..20c0719a982 --- /dev/null +++ b/script/cibuild @@ -0,0 +1,8 @@ +#!/bin/sh + +# script/cibuild: Setup environment for CI to run tests. This is primarily +# designed to run on the continuous integration server. + +script/bootstrap_server +script/test coverage +coveralls diff --git a/scripts/dev_docker b/script/dev_docker similarity index 86% rename from scripts/dev_docker rename to script/dev_docker index b3672e56095..b63afaa36da 100755 --- a/scripts/dev_docker +++ b/script/dev_docker @@ -3,10 +3,7 @@ # Optional: pass in a timezone as first argument # If not given will attempt to mount /etc/localtime -# If current pwd is scripts, go 1 up. -if [ ${PWD##*/} == "scripts" ]; then - cd .. -fi +cd "$(dirname "$0")/.." docker build -t home-assistant-dev . diff --git a/scripts/dev_openzwave_docker b/script/dev_openzwave_docker similarity index 78% rename from scripts/dev_openzwave_docker rename to script/dev_openzwave_docker index f27816a8e39..387c38ef6da 100755 --- a/scripts/dev_openzwave_docker +++ b/script/dev_openzwave_docker @@ -1,10 +1,7 @@ # Open a docker that can be used to debug/dev python-openzwave # Pass in a command line argument to build -# If current pwd is scripts, go 1 up. -if [ ${PWD##*/} == "scripts" ]; then - cd .. -fi +cd "$(dirname "$0")/.." if [ $# -gt 0 ] then diff --git a/scripts/get_entities.py b/script/get_entities.py similarity index 100% rename from scripts/get_entities.py rename to script/get_entities.py diff --git a/scripts/hass-daemon b/script/hass-daemon old mode 100644 new mode 100755 similarity index 100% rename from scripts/hass-daemon rename to script/hass-daemon diff --git a/script/lint b/script/lint new file mode 100755 index 00000000000..120f364120f --- /dev/null +++ b/script/lint @@ -0,0 +1,9 @@ +# Run style checks + +cd "$(dirname "$0")/.." + +echo "Checking style with flake8..." +flake8 homeassistant + +echo "Checking style with pylint..." +pylint homeassistant diff --git a/script/server b/script/server new file mode 100755 index 00000000000..0904bfd728e --- /dev/null +++ b/script/server @@ -0,0 +1,8 @@ +#!/bin/sh + +# script/server: Launch the application and any extra required processes +# locally. + +cd "$(dirname "$0")/.." + +python3 -m homeassistant -c config diff --git a/script/setup b/script/setup new file mode 100755 index 00000000000..80c15646eaf --- /dev/null +++ b/script/setup @@ -0,0 +1,4 @@ +cd "$(dirname "$0")/.." + +git submodule init +script/bootstrap diff --git a/script/test b/script/test new file mode 100755 index 00000000000..753ec340fd6 --- /dev/null +++ b/script/test @@ -0,0 +1,16 @@ +#!/bin/sh + +# script/test: Run test suite for application. Optionallly pass in a path to an +# individual test file to run a single test. + +cd "$(dirname "$0")/.." + +echo "Running tests..." + +if [ "$1" = "coverage" ]; then + coverage run -m unittest discover tests +else + python3 -m unittest discover tests +fi + +script/lint diff --git a/script/update b/script/update new file mode 100755 index 00000000000..9f8b2530a7e --- /dev/null +++ b/script/update @@ -0,0 +1,8 @@ +#!/bin/sh + +# script/update: Update application to run for its current checkout. + +cd "$(dirname "$0")/.." + +git pull +git submodule update diff --git a/scripts/check_style b/scripts/check_style deleted file mode 100755 index 5fc8861b91a..00000000000 --- a/scripts/check_style +++ /dev/null @@ -1,9 +0,0 @@ -# Run style checks - -# If current pwd is scripts, go 1 up. -if [ ${PWD##*/} == "scripts" ]; then - cd .. -fi - -flake8 homeassistant -pylint homeassistant diff --git a/scripts/run_tests b/scripts/run_tests deleted file mode 100755 index 75b25ca805a..00000000000 --- a/scripts/run_tests +++ /dev/null @@ -1,10 +0,0 @@ -# If current pwd is scripts, go 1 up. -if [ ${PWD##*/} == "scripts" ]; then - cd .. -fi - -if [ "$1" = "coverage" ]; then - coverage run -m unittest discover tests -else - python3 -m unittest discover tests -fi diff --git a/scripts/update b/scripts/update deleted file mode 100755 index be5e8fc01bf..00000000000 --- a/scripts/update +++ /dev/null @@ -1,6 +0,0 @@ -echo "The update script has been deprecated since Home Assistant v0.7" -echo -echo "Home Assistant is now distributed via PyPi and can be installed and" -echo "upgraded by running: pip3 install --upgrade homeassistant" -echo -echo "If you are developing a new feature for Home Assistant, run: git pull"