From a4fb4dc6b7bb1a18e8389ed758d0bc494f9e1923 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Thu, 17 May 2018 21:02:51 -0700 Subject: [PATCH 1/5] Automatically generate environment after install --- package.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 1a6711e..3c88037 100755 --- a/package.json +++ b/package.json @@ -4,12 +4,13 @@ "description": "Generate Aragon local dev environment snapshots", "main": "index.js", "scripts": { - "prepublishOnly": "npm run start", - "start": "npm run start-ganache-bg && npm run gen", - "gen": "npm run get-repos && scripts/deploy-base && scripts/deploy-beta", + "prepublishOnly": "npm run gen", + "postinstall": "npm run gen", + "start": "npm run start-ganache-bg && npm run deploy", + "gen": "scripts/get-repos", + "deploy": "scripts/deploy-base && scripts/deploy-beta", "start-ganache": "scripts/start-ganache", "start-ganache-bg": "scripts/start-ganache-bg", - "get-repos": "scripts/get-repos", "deploy-base": "scripts/deploy-base", "deploy-beta": "scripts/deploy-beta" }, From 2bbc324efeeb56616559ed239eb8e38b42c06a6f Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Thu, 17 May 2018 21:08:22 -0700 Subject: [PATCH 2/5] Check if ganache is running before trying to kill it --- scripts/start-ganache-bg | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/start-ganache-bg b/scripts/start-ganache-bg index ac7e646..8fc79d3 100755 --- a/scripts/start-ganache-bg +++ b/scripts/start-ganache-bg @@ -1,10 +1,20 @@ #!/bin/bash +ganache_port=8545 +ganache_running() { + nc -z localhost "$ganache_port" &> /dev/null +} + set +e; rm -rf aragon-ganache; -kill -9 $(lsof -t -i:8545); + +if ganache_running; then + echo "Killing ganache instance at port $ganache_port" + kill -9 $(lsof -t -i:$ganache_port); +fi + mkdir aragon-ganache; set -e; -echo \"Starting ganache in the background\n\n\"; -nohup npm run start-ganache & \ No newline at end of file +printf "Starting ganache in the background\n\n"; +nohup npm run start-ganache & From 96110b89852ccda01af14487d820ed035a6064f0 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Tue, 22 May 2018 14:48:56 -0600 Subject: [PATCH 3/5] Use dao-kits instead of aragon-apps for kits --- package.json | 11 ++++++----- scripts/deploy-beta | 4 ++-- scripts/deploy-survey | 1 + scripts/get-repos | 6 +++--- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 3c88037..319c04e 100755 --- a/package.json +++ b/package.json @@ -6,13 +6,14 @@ "scripts": { "prepublishOnly": "npm run gen", "postinstall": "npm run gen", - "start": "npm run start-ganache-bg && npm run deploy", + "start": "npm run start:beta", + "start:beta": "npm run start-ganache-bg && npm run deploy:beta", + "start:survey": "npm run start-ganache-bg && npm run deploy:survey", "gen": "scripts/get-repos", - "deploy": "scripts/deploy-base && scripts/deploy-beta", + "deploy:beta": "scripts/deploy-base && scripts/deploy-beta", + "deploy:survey": "scripts/deploy-base && scripts/deploy-survey", "start-ganache": "scripts/start-ganache", - "start-ganache-bg": "scripts/start-ganache-bg", - "deploy-base": "scripts/deploy-base", - "deploy-beta": "scripts/deploy-beta" + "start-ganache-bg": "scripts/start-ganache-bg" }, "files": [ "index.js", diff --git a/scripts/deploy-beta b/scripts/deploy-beta index faeaeba..0f1993e 100755 --- a/scripts/deploy-beta +++ b/scripts/deploy-beta @@ -3,7 +3,7 @@ set -e; source scripts/set-env; -cd repos/aragon-apps/templates/beta; +cd repos/dao-kits/kits/beta; npx truffle migrate --reset --network rpc -echo "Beta templates deployed and packages created in APM" \ No newline at end of file +echo "Beta kit deployed and packages created in APM" diff --git a/scripts/deploy-survey b/scripts/deploy-survey index 00e150e..c9ae500 100755 --- a/scripts/deploy-survey +++ b/scripts/deploy-survey @@ -6,3 +6,4 @@ source scripts/set-env; cd repos/dao-kits/kits/survey; npx truffle migrate --reset --network rpc +echo "Survey kit deployed and packages created in APM" diff --git a/scripts/get-repos b/scripts/get-repos index 912791c..fbde008 100755 --- a/scripts/get-repos +++ b/scripts/get-repos @@ -18,7 +18,7 @@ cd aragon-id; npm i; cd ..; -echo "Fetching aragon-apps and installing dependencies (this may take a while 😉)" -git clone https://github.com/aragon/aragon-apps.git -b master; -cd aragon-apps; +echo "Fetching dao-kits and installing dependencies (this may take a while 😉)" +git clone https://github.com/aragon/dao-kits.git -b master; +cd dao-kits; npm i; From 580bcd4cac0d0d58d2fffd059b9269aeebad5376 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Tue, 22 May 2018 19:40:20 -0600 Subject: [PATCH 4/5] Use ssh to clone repos to avoid manual authentication if you've already added SSH keys --- scripts/get-repos | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/get-repos b/scripts/get-repos index fbde008..f36e971 100755 --- a/scripts/get-repos +++ b/scripts/get-repos @@ -7,18 +7,18 @@ mkdir repos; cd repos; echo "Fetching aragonOS and installing dependencies..." -git clone https://github.com/aragon/aragonOS.git -b v3.1.4; +git clone git@github.com:aragon/aragonOS -b v3.1.4; cd aragonOS; npm i; cd ..; echo "Fetching aragon-id and installing dependencies..." -git clone https://github.com/aragon/aragon-id.git -b master; +git clone git@github.com:aragon/aragon-id -b master; cd aragon-id; npm i; cd ..; echo "Fetching dao-kits and installing dependencies (this may take a while 😉)" -git clone https://github.com/aragon/dao-kits.git -b master; +git clone git@github.com:aragon/dao-kits.git -b master; cd dao-kits; npm i; From ccf970c8f55be69fb2c8662d3b939f4e7fe71bf4 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Wed, 23 May 2018 02:15:10 -0600 Subject: [PATCH 5/5] Upgrade aragonOS --- scripts/get-repos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/get-repos b/scripts/get-repos index f36e971..40ccb77 100755 --- a/scripts/get-repos +++ b/scripts/get-repos @@ -7,7 +7,7 @@ mkdir repos; cd repos; echo "Fetching aragonOS and installing dependencies..." -git clone git@github.com:aragon/aragonOS -b v3.1.4; +git clone git@github.com:aragon/aragonOS -b v3.1.8; cd aragonOS; npm i; cd ..;