Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overwrite when default platform/arch are used #794

Merged
merged 1 commit into from Jan 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion index.js
Expand Up @@ -63,6 +63,7 @@ class Packager {
}

overwriteAndCreateApp (outDir, comboOpts, zipPath) {
debug(`Removing ${outDir} due to setting overwrite: true`)
return fs.remove(outDir)
.then(() => this.createApp(comboOpts, zipPath))
}
Expand Down Expand Up @@ -94,7 +95,7 @@ class Packager {
}

checkOverwrite (comboOpts, zipPath) {
const finalPath = common.generateFinalPath(this.opts)
const finalPath = common.generateFinalPath(comboOpts)
return fs.pathExists(finalPath)
.then(exists => {
if (exists) {
Expand Down
15 changes: 15 additions & 0 deletions test/basic.js
Expand Up @@ -195,6 +195,21 @@ util.testSinglePlatform('overwrite test', (t, opts) => {
.then(exists => t.false(exists, 'The output directory should be regenerated when overwrite is true'))
})

util.testSinglePlatform('overwrite test sans platform/arch set', (t, opts) => {
delete opts.platfrom
delete opts.arch
opts.dir = util.fixtureSubdir('basic')
opts.overwrite = true

return packager(opts)
.then(paths => fs.pathExists(paths[0]))
.then(exists => {
t.true(exists, 'The output directory exists')
return packager(opts)
}).then(paths => fs.pathExists(paths[0]))
.then(exists => t.true(exists, 'The output directory exists'))
})

util.testSinglePlatform('tmpdir test', (t, opts) => {
opts.name = 'tmpdirTest'
opts.dir = path.join(__dirname, 'fixtures', 'basic')
Expand Down