Skip to content

Commit

Permalink
eslint auto-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbreiding committed Nov 22, 2017
1 parent 179dd69 commit 1f1f76c
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 78 deletions.
38 changes: 19 additions & 19 deletions cy_scripts/deploy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* eslint-disable no-console */

const path = require('path')
const chalk = require('chalk')
const Promise = require('bluebird')
const inquirer = require('inquirer')
const minimist = require('minimist')
const path = require('path')
const chalk = require('chalk')
const Promise = require('bluebird')
const inquirer = require('inquirer')
const minimist = require('minimist')
const debug = require('debug')('deploy')
const questionsRemain = require('@cypress/questions-remain')
const scrape = require('./scrape')
const scrape = require('./scrape')
const shouldDeploy = require('./should-deploy')
const R = require('ramda')
const la = require('lazy-ass')
Expand Down Expand Up @@ -43,7 +43,7 @@ function prompToScrape () {
message: 'Would you like to scrape the docs? (You only need to do this if they have changed on this deployment)',
choices: [
{ name: 'Yes', value: true },
{ name: 'No', value: false },
{ name: 'No', value: false },
],
})
.get('scrape')
Expand Down Expand Up @@ -97,12 +97,12 @@ function doDeploy (env) {
la(isValidEnvironment(env), 'invalid deploy environment', env)
debug('getting current branch')
return getBranch()
.then((branch) => {
console.log('deploying branch %s to environment %s',
chalk.green(branch), chalk.blue(env))
la(is.unemptyString(branch), 'invalid branch name', branch)
return deployEnvironmentBranch(env, branch)
})
.then((branch) => {
console.log('deploying branch %s to environment %s',
chalk.green(branch), chalk.blue(env))
la(is.unemptyString(branch), 'invalid branch name', branch)
return deployEnvironmentBranch(env, branch)
})
}

function deploy () {
Expand All @@ -126,9 +126,9 @@ function deploy () {
}

deploy()
.catch((err) => {
console.error('🔥 deploy failed')
console.error(err)
console.error(err.stack)
process.exit(-1)
})
.catch((err) => {
console.error('🔥 deploy failed')
console.error(err)
console.error(err.stack)
process.exit(-1)
})
104 changes: 52 additions & 52 deletions cy_scripts/should-deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ function isRightBranch (env) {

let branch
return git.branchName()
.then(tap((name) => {
console.log('branch name', name)
branch = name
}))
.then(isBranchAllowedToDeploy)
.then(tap((rightBranch) => {
console.log('is branch %s allowed to deploy %s?',
branch, env, rightBranch)
}))
.then(tap((name) => {
console.log('branch name', name)
branch = name
}))
.then(isBranchAllowedToDeploy)
.then(tap((rightBranch) => {
console.log('is branch %s allowed to deploy %s?',
branch, env, rightBranch)
}))
}

function buildUrlForEnvironment (env) {
Expand All @@ -79,40 +79,40 @@ function lastDeployedCommit (env) {

debug('checking last deploy info using url %s', url)
return got(url, { json: true })
.then(path(['body', 'id']))
.then(tap((id) => {
console.log('docs last deployed for commit', id)
}))
.then(path(['body', 'id']))
.then(tap((id) => {
console.log('docs last deployed for commit', id)
}))
}

const changedFilesSince = (branchName) => (sha) => {
la(is.unemptyString(branchName), 'missing branch name', branchName)
debug('finding files changed in branch %s since commit %s', branchName, sha)
return git.changedFilesAfter(sha, branchName)
.then(tap((list) => {
debug('%s changed since last docs deploy in branch %s',
pluralize('file', list.length, true), branchName)
debug(list.join('\n'))
}))
.then(tap((list) => {
debug('%s changed since last docs deploy in branch %s',
pluralize('file', list.length, true), branchName)
debug(list.join('\n'))
}))
}

function docsFilesChangedSinceLastDeploy (env, branchName) {
return lastDeployedCommit(env)
.then(changedFilesSince(branchName))
.then(tap((list) => {
console.log('changed files')
console.log(list.join('\n'))
console.log('%d documentation %s changed since last doc deploy',
list.length, pluralize('file', list.length))
console.log('in branch %s against environment %s', branchName, env)
}))
.then(docsChanged)
.then(tap((hasDocumentChanges) => {
console.log('has document changes?', hasDocumentChanges)
}))
.catch(T)
// if cannot fetch last build, or some other exception
// then should deploy!
.then(changedFilesSince(branchName))
.then(tap((list) => {
console.log('changed files')
console.log(list.join('\n'))
console.log('%d documentation %s changed since last doc deploy',
list.length, pluralize('file', list.length))
console.log('in branch %s against environment %s', branchName, env)
}))
.then(docsChanged)
.then(tap((hasDocumentChanges) => {
console.log('has document changes?', hasDocumentChanges)
}))
.catch(T)
// if cannot fetch last build, or some other exception
// then should deploy!
}

// resolves with boolean true/false
Expand All @@ -124,22 +124,22 @@ function shouldDeploy (env = 'production') {
}

return git.branchName()
.then((branchName) => {
const questions = [
isRightBranch(env),
docsFilesChangedSinceLastDeploy(env, branchName),
]
return Promise.all(questions)
.then(all(equals(true)))
.then(Boolean)
.then((result) => {
if (isForced) {
console.log('should deploy is forced!')
return isForced
}
return result
})
.then((branchName) => {
const questions = [
isRightBranch(env),
docsFilesChangedSinceLastDeploy(env, branchName),
]
return Promise.all(questions)
.then(all(equals(true)))
.then(Boolean)
.then((result) => {
if (isForced) {
console.log('should deploy is forced!')
return isForced
}
return result
})
})
}

module.exports = shouldDeploy
Expand All @@ -152,8 +152,8 @@ if (!module.parent) {
// .catch(console.error)

shouldDeploy('staging')
.then((should) => {
console.log('should deploy?', should)
})
.catch(console.error)
.then((should) => {
console.log('should deploy?', should)
})
.catch(console.error)
}
12 changes: 6 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ gulp.task('move:doc:search:css', function () {
// move font files
gulp.task('move:fira:fonts', function () {
return gulp
.src('./node_modules/fira/**')
.pipe(gulp.dest('./themes/cypress/source/fonts/vendor/fira'))
.src('./node_modules/fira/**')
.pipe(gulp.dest('./themes/cypress/source/fonts/vendor/fira'))
})

gulp.task('move:font:awesome:fonts', (cb) => {
Expand All @@ -58,14 +58,14 @@ gulp.task('move:font:awesome:fonts', (cb) => {

gulp.task('move:font:awesome:css', function () {
return gulp
.src('./node_modules/font-awesome/css/font-awesome.css')
.pipe(gulp.dest('./themes/cypress/source/fonts/vendor/font-awesome/css'))
.src('./node_modules/font-awesome/css/font-awesome.css')
.pipe(gulp.dest('./themes/cypress/source/fonts/vendor/font-awesome/css'))
})

gulp.task('move:font:awesome:fonts:folder', function () {
return gulp
.src('./node_modules/font-awesome/fonts/*')
.pipe(gulp.dest('./themes/cypress/source/fonts/vendor/font-awesome/fonts'))
.src('./node_modules/font-awesome/fonts/*')
.pipe(gulp.dest('./themes/cypress/source/fonts/vendor/font-awesome/fonts'))
})

gulp.task('revision', () => {
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ process.on('unhandledRejection', function (reason, p) {
console.error('Unhandled Rejection at: Promise ', p)
console.error('reason: ', reason)
process.exit(-1)
});
})

const fs = require('fs')
const path = require('path')
Expand Down

0 comments on commit 1f1f76c

Please sign in to comment.