From 435104842da7d235a54a08db353594850dc327b7 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Wed, 3 Feb 2016 14:46:16 -0500 Subject: [PATCH 1/4] Fix failing Ciao tests They were expecting certain parts of the response to not be there when an error is returned, but that's overspecifying the result in my opinion. --- test/ciao/search/layers_invalid.coffee | 2 -- test/ciao/search/layers_mix_invalid_valid.coffee | 2 -- test/ciao/search/sources_invalid.coffee | 2 -- 3 files changed, 6 deletions(-) diff --git a/test/ciao/search/layers_invalid.coffee b/test/ciao/search/layers_invalid.coffee index ec9c58bd..1e8e65fc 100644 --- a/test/ciao/search/layers_invalid.coffee +++ b/test/ciao/search/layers_invalid.coffee @@ -32,5 +32,3 @@ should.not.exist json.geocoding.warnings #? inputs json.geocoding.query['text'].should.eql 'a' json.geocoding.query['size'].should.eql 10 -should.not.exist json.geocoding.query['types'] -should.not.exist json.geocoding.query['type'] diff --git a/test/ciao/search/layers_mix_invalid_valid.coffee b/test/ciao/search/layers_mix_invalid_valid.coffee index fab29ef2..11a40ddc 100644 --- a/test/ciao/search/layers_mix_invalid_valid.coffee +++ b/test/ciao/search/layers_mix_invalid_valid.coffee @@ -32,5 +32,3 @@ should.not.exist json.geocoding.warnings #? inputs json.geocoding.query['text'].should.eql 'a' json.geocoding.query['size'].should.eql 10 -should.not.exist json.geocoding.query['types'] -should.not.exist json.geocoding.query['type'] diff --git a/test/ciao/search/sources_invalid.coffee b/test/ciao/search/sources_invalid.coffee index 2114c9c0..1d8df87c 100644 --- a/test/ciao/search/sources_invalid.coffee +++ b/test/ciao/search/sources_invalid.coffee @@ -32,5 +32,3 @@ should.not.exist json.geocoding.warnings #? inputs json.geocoding.query['text'].should.eql 'a' json.geocoding.query['size'].should.eql 10 -should.not.exist json.geocoding.query['types'] -should.not.exist json.geocoding.query['type'] From 0146050620357dbdba67e56321078d81c9c387e0 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Wed, 3 Feb 2016 14:48:18 -0500 Subject: [PATCH 2/4] Ignore failures removing docs directory If the docs files aren't there, it's expected that removing them would fail, and the task should continue. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eb9a4b10..901f11bc 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "ciao": "node node_modules/ciao/bin/ciao -c test/ciao.json test/ciao", "coverage": "node_modules/.bin/istanbul cover test/unit/run.js", "audit": "npm shrinkwrap; node node_modules/nsp/bin/nspCLI.js audit-shrinkwrap; rm npm-shrinkwrap.json;", - "docs": "rm -r docs; cd test/ciao; node ../../node_modules/ciao/bin/ciao -c ../ciao.json . -d ../../docs" + "docs": "rm -r docs || true; cd test/ciao; node ../../node_modules/ciao/bin/ciao -c ../ciao.json . -d ../../docs" }, "repository": { "type": "git", From 0f121c5ffeb5e1b61043a0796155ff3d383ef602 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Wed, 3 Feb 2016 14:56:22 -0500 Subject: [PATCH 3/4] Move doc generation commands to script file They were getting too large already, and I want to add more. --- bin/generate-docs | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100755 bin/generate-docs diff --git a/bin/generate-docs b/bin/generate-docs new file mode 100755 index 00000000..46fce4e6 --- /dev/null +++ b/bin/generate-docs @@ -0,0 +1,6 @@ +#!/bin/bash -ex + +rm -r docs || true + +cd test/ciao +node ../../node_modules/ciao/bin/ciao -c ../ciao.json . -d ../../docs diff --git a/package.json b/package.json index 901f11bc..e14b4d91 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "ciao": "node node_modules/ciao/bin/ciao -c test/ciao.json test/ciao", "coverage": "node_modules/.bin/istanbul cover test/unit/run.js", "audit": "npm shrinkwrap; node node_modules/nsp/bin/nspCLI.js audit-shrinkwrap; rm npm-shrinkwrap.json;", - "docs": "rm -r docs || true; cd test/ciao; node ../../node_modules/ciao/bin/ciao -c ../ciao.json . -d ../../docs" + "docs": "./bin/generate-docs" }, "repository": { "type": "git", From a129df11254352530c8cdfb4afa09ab31d56ee68 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Wed, 3 Feb 2016 14:57:02 -0500 Subject: [PATCH 4/4] Check pelias server is running before generating docs And generate a helpful error message if not. --- bin/generate-docs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/generate-docs b/bin/generate-docs index 46fce4e6..5b337e3e 100755 --- a/bin/generate-docs +++ b/bin/generate-docs @@ -2,5 +2,8 @@ rm -r docs || true +curl -s http://localhost:3100/v1 > /dev/null || die "Pelias server does not appear to be running \ +on http://localhost:3100, run npm start in another window before generating docs." + cd test/ciao node ../../node_modules/ciao/bin/ciao -c ../ciao.json . -d ../../docs