diff --git a/.travis.yml b/.travis.yml index 882ba23..1f42df6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,20 +45,22 @@ before_install: - node --version - postgres --version - redis-server --version - - psql -d template1 -c "CREATE USER nolan CREATEDB;" before_script: - npm run lint script: npm run test-browser env: global: - PGPORT=5433 - matrix: - - BROWSER=chrome:headless - - BROWSER=firefox:headless +matrix: + include: + - env: BROWSER=chrome:headless + - env: BROWSER=firefox:headless + allow_failures: + - env: BROWSER=firefox:headless branches: only: - master - /^greenkeeper/.*$/ cache: directories: - - $HOME/.npm \ No newline at end of file + - $HOME/.npm diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 70b8a87..9ce0a7c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,8 +45,6 @@ Automatically fix most linting issues: ## Testing -_**Note:** If you have a local `mastodon_development` Postgres database, this will erase it._ - Run integration tests, using headless Chrome by default: npm test @@ -62,8 +60,6 @@ Run tests for a particular browser: ## Testing in development mode -_**Note:** If you have a local `mastodon_development` Postgres database, this will erase it._ - In separate terminals: 1\. Run a Mastodon dev server: diff --git a/bin/run-mastodon.js b/bin/run-mastodon.js index 14f53cd..178dd45 100644 --- a/bin/run-mastodon.js +++ b/bin/run-mastodon.js @@ -15,7 +15,9 @@ const dir = __dirname const GIT_URL = 'https://github.com/nolanlawson/mastodon' const GIT_BRANCH = 'for-pinafore' -const DB_USER = 'nolan' + +const DB_NAME = 'pinafore_development' +const DB_USER = 'pinafore' const envFile = ` PAPERCLIP_SECRET=foo @@ -24,6 +26,7 @@ OTP_SECRET=foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoo DB_HOST=127.0.0.1 DB_PORT=${process.env.PGPORT || 5432} DB_USER=${DB_USER} +DB_NAME=${DB_NAME} ` const mastodonDir = path.join(dir, '../mastodon') @@ -35,8 +38,7 @@ async function cloneMastodon () { await stat(mastodonDir) } catch (e) { console.log('Cloning mastodon...') - await exec(`git clone ${GIT_URL} "${mastodonDir}"`) - await exec(`git checkout ${GIT_BRANCH}`, {cwd: mastodonDir}) + await exec(`git clone ${GIT_URL} --branch ${GIT_BRANCH} --single-branch --depth 1 "${mastodonDir}"`) await writeFile(path.join(dir, '../mastodon/.env'), envFile, 'utf8') } } @@ -44,14 +46,15 @@ async function cloneMastodon () { async function setupMastodonDatabase () { console.log('Setting up mastodon database...') try { - await exec(`dropdb -h 127.0.0.1 -U ${DB_USER} --no-password mastodon_development`, {cwd: mastodonDir}) + await exec(`psql -d template1 -c "CREATE USER ${DB_USER} CREATEDB;"`, {cwd: mastodonDir}) } catch (e) { /* ignore */ } - await exec(`createdb -h 127.0.0.1 -U ${DB_USER} --no-password mastodon_development`, {cwd: mastodonDir}) + try { + await exec(`dropdb -h 127.0.0.1 -U ${DB_USER} -w ${DB_NAME}`, {cwd: mastodonDir}) + } catch (e) { /* ignore */ } + await exec(`createdb -h 127.0.0.1 -U ${DB_USER} -w ${DB_NAME}`, {cwd: mastodonDir}) let dumpFile = path.join(dir, '../fixtures/dump.sql') - await exec(`pg_restore -h 127.0.0.1 -U ${DB_USER} --no-password -Fc -d mastodon_development "${dumpFile}"`, { - cwd: mastodonDir - }) + await exec(`psql -h 127.0.0.1 -U ${DB_USER} -w -d ${DB_NAME} -f "${dumpFile}"`, {cwd: mastodonDir}) let tgzFile = path.join(dir, '../fixtures/system.tgz') let systemDir = path.join(mastodonDir, 'public/system') diff --git a/fixtures/dump.sql b/fixtures/dump.sql index af6f4d8..1145e99 100644 Binary files a/fixtures/dump.sql and b/fixtures/dump.sql differ