Skip to content

Commit

Permalink
fix(dryrun): Initialize isDryRun with yargs
Browse files Browse the repository at this point in the history
  • Loading branch information
James Womack committed Oct 22, 2015
1 parent d16baf1 commit 5b99059
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 10 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const

// Module-level CLI globals
var
isTrial = false,
isDryRun = false,
versionType,
repoType

Expand Down Expand Up @@ -47,7 +47,7 @@ taskManager.task(CHANGELOG_WRITE, function (done) {
const nextVersion = Deploy.getNextVersion(versionType)
log('Utilizing next version for changelog: ', colors.magenta(nextVersion))

if (isTrial === true) {
if (isDryRun === true) {
return done()
} else {
return writeChangelog({
Expand All @@ -58,7 +58,7 @@ taskManager.task(CHANGELOG_WRITE, function (done) {
})

taskManager.task('changelog:commit', function () {
if (isTrial) {
if (isDryRun) {
return true
} else {
// TODO - allow configuration of this src?
Expand All @@ -75,7 +75,6 @@ taskManager.task('changelog:commit', function () {
bumpTaskName = bumperize(bumpType)

function noTrial () {
isTrial = false
return deployWithBump({ dryRun : false })
}

Expand All @@ -87,7 +86,6 @@ taskManager.task('changelog:commit', function () {
taskManager.task(join(CHANGELOG_WRITE, bumpType), taskManager.series([CHANGELOG_WRITE]))

function dryRun () {
isTrial = true
return deployWithBump({ dryRun: true })
}

Expand Down Expand Up @@ -136,7 +134,13 @@ if (!module.parent) {
var taskName = bumperize(unleash.type)
versionType = unleash.type
repoType = unleash.repoType
unleash.dryRun && (taskName = join(taskName, DRY_RUN))

if (unleash.dryRun) {
isDryRun = true
taskName = join(taskName, DRY_RUN)
log('Utilizing dry run mode')
}

const task = taskManager.task(taskName)
task()
} else {
Expand Down
1 change: 0 additions & 1 deletion lib/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ module.exports = Object.create({
dryRun = options.dryRun

log('Utilizing bumpType', colors.magenta(options.bumpType))
log('Utilizing dryRun?', colors.magenta(!!options.dryRun))

function streamDone (finalOperation) {
const stream = new Stream.Transform({objectMode: true})
Expand Down

0 comments on commit 5b99059

Please sign in to comment.