forked from semantic-release/semantic-release
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(registry): lib to start and stop an npm-registry-couchapp
- Loading branch information
1 parent
4093bb2
commit 32c1dcf
Showing
6 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ node_modules | |
|
||
# build-artifacts | ||
dist | ||
test/registry/couchdb.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { exec } = require('child_process') | ||
const { join } = require('path') | ||
|
||
const opts = { | ||
cwd: join(__dirname, '../../test/registry') | ||
} | ||
|
||
module.exports = { | ||
start: exec.bind(null, './start.sh', opts), | ||
stop: exec.bind(null, './stop.sh', opts), | ||
uri: 'http://localhost:5984/registry/_design/app/_rewrite/' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[couch_httpd_auth] | ||
public_fields = appdotnet, avatar, avatarMedium, avatarLarge, date, email, fields, freenode, fullname, github, homepage, name, roles, twitter, type, _id, _rev | ||
users_db_public = true | ||
|
||
[httpd] | ||
bind_address = 0.0.0.0 | ||
secure_rewrites = false | ||
|
||
[couchdb] | ||
delayed_commits = false | ||
|
||
[admins] | ||
admin = -pbkdf2-89582b49cd2e8443e29a841f5a76d367956a8e58,1afa2f1531a17ac97f2ac9e334293753,10 | ||
|
||
[log] | ||
level = none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# exit if an error occurs | ||
set -e | ||
|
||
cd $(dirname $0) | ||
|
||
# start couchdb as a background process, reset config, load local config | ||
couchdb -b -a local.ini | ||
|
||
COUCH=http://admin:password@127.0.0.1:5984 | ||
|
||
# create "registry" database | ||
curl -X PUT $COUCH/registry | ||
|
||
# create sample npm user | ||
curl -X PUT $COUCH/_users/org.couchdb.user:integration -H Content-Type:application/json --data-binary '{"_id": "org.couchdb.user:integration","name": "integration","roles": [],"type": "user","password": "suchsecure","email": "integration@test.com"}' | ||
|
||
# npm-registry-couchpp needs this variable set to run | ||
export DEPLOY_VERSION=nope | ||
|
||
# setup npm-registry-couchapp | ||
npm explore npm-registry-couchapp -- npm start --npm-registry-couchapp:couch=$COUCH/registry | ||
npm explore npm-registry-couchapp -- npm run load --npm-registry-couchapp:couch=$COUCH/registry | ||
npm explore npm-registry-couchapp -- NO_PROMPT=yes npm run copy --npm-registry-couchapp:couch=$COUCH/registry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
# delete "registry" database | ||
curl -X DELETE http://admin:password@127.0.0.1:5984/registry | ||
|
||
# delete "_users" database | ||
curl -X DELETE http://admin:password@127.0.0.1:5984/_users | ||
|
||
# close couchdb background process | ||
couchdb -d |