Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quickstart test: fail when server responds with error #759

Merged
merged 4 commits into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions bin/quick-start-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,36 @@ trap "{ CODE=$?; popd; rm -rf $TEMP_ROOT; exit $CODE; }" EXIT

## docs/guides/quickstart.rst:41

echo "$ npm init -y"
npm init -y

## docs/guides/quickstart.rst:47

echo "$ npm install $HOODIE_FOLDER --save"
npm install $HOODIE_FOLDER --save

## docs/guides/quickstart.rst:98

echo "$ npm install --save pouchdb-browser @hoodie/client"
npm install --save pouchdb-browser @hoodie/client

## docs/guides/quickstart.rst:72

echo "$ npm start"
npm start & HOODIE_PROCESS=$!

## Give the process a generous sixty seconds to start

RETRIES=60
while [ "$RETRIES" -gt 0 ] ; do
sleep 1
kill -0 $HOODIE_PROCESS 2&>1 > /dev/null || { echo "Hoodie exited prematurely"; wait $HOODIE_PROCESS ; exit $? ; }
curl -I http://localhost:8080/hoodie/client.js > /dev/null && break
curl -fI http://localhost:8080 > /dev/null && break
let RETRIES=RETRIES-1
done

## Fail if hoodie client cannot be loaded
curl -fI http://localhost:8080/hoodie/client.js > /dev/null

kill $HOODIE_PROCESS

[ $RETRIES -le 0 ] && { echo "Timed out waiting for hoodie to start"; exit 1 ; }
Expand Down
11 changes: 11 additions & 0 deletions docs/guides/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ at http://127.0.0.1:8080 after you restart the server. All assets in the public
folder, like images, CSS files or JavaScript files, will be served by your
Hoodie Backend at :code:`http://127.0.0.1:8080/<path/to/your/file.ext>`.

Note for npm v2
---------------

Because of how npm v2 installs sub dependencies, the hoodie client cannot be
bundled. As a workaround, just install ``pouchdb-browser`` and ``@hoodie/client``
as a dependency of your hoodie app

.. code:: bash

$ npm install --save pouchdb-browser @hoodie/client

What’s next?
~~~~~~~~~~~~

Expand Down