dokku-deploy
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -40,2 +40,16 @@ const inquirer = require('inquirer'); | ||
return Promise.resolve().then(() => { | ||
if (!this.project) { | ||
return readPackageJSON(this.cwd).then((app) => { | ||
this.project = app; | ||
}).catch(() => { | ||
throw new Error('Not a Node.js project'); | ||
}); | ||
} | ||
return Promise.resolve(); | ||
}).then(() => { | ||
return execPromise('git remote get-url dokku').catch((err) => null); | ||
}).then((currentURL) => { | ||
if (currentURL) { | ||
return Promise.resolve({choice: true, currentURL: currentURL.trim()}); | ||
} | ||
if (!choice) { | ||
@@ -55,11 +69,14 @@ console.log(chalk.whiteBright('Looks like this repo isn\'t setup to deploy to dokku.')); | ||
} | ||
const example = chalk.gray(`(e.g ssh://dokku@example.com/${this.project.name || 'my-project'})`); | ||
const example = chalk.gray(` (e.g ssh://dokku@example.com/${this.project.name || 'my-project'})`); | ||
return inquirer.prompt({ | ||
type: 'input', | ||
name: 'url', | ||
message: `Enter your dokku URL ${example}:`, | ||
message: `Enter your dokku URL${!answer.currentURL && example || ''}:`, | ||
default: answer.currentURL || undefined | ||
}); | ||
}).then((answer) => { | ||
console.log(chalk.gray('Setting up dokku remote URL...')); | ||
return execPromise(`git remote add dokku ${answer.url}`); | ||
return execPromise(`git remote add dokku ${answer.url}`).catch(() => { | ||
return execPromise(`git remote set-url dokku ${answer.url}`); | ||
}); | ||
}).then(() => { | ||
@@ -204,3 +221,3 @@ console.log(chalk.whiteBright('done! You can now re-run your command')); | ||
} | ||
}); | ||
}).catch(() => null); | ||
}).then(() => { | ||
@@ -215,3 +232,3 @@ return wait(3, (count) => { | ||
return spawnPromise(`git push -f dokku ${tag}~0:master`, (data) => { | ||
return spawnPromise(`git push -f dokku ${tag}~0:refs/heads/master`, (data) => { | ||
process.stdout.write(chalk.gray(data)); | ||
@@ -218,0 +235,0 @@ }).catch(() => { |
{ | ||
"name": "dokku-deploy", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A deployment tool for dokku.", | ||
@@ -5,0 +5,0 @@ "main": "dokku-deploy.js", |
36435
341