-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6682f38
commit 1ffaa3b
Showing
6 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const Promise = require('bluebird'); | ||
const workspaceDir = require('./workspaceDir'); | ||
const gitFactory = require('./gitFactory'); | ||
const output = require('./output'); | ||
|
||
module.exports = forceLatest; | ||
|
||
function forceLatest(sourceResult) { | ||
return new Promise((resolve) => { | ||
if (fs.existsSync(sourceResult.repoDir)) { | ||
let git = gitFactory.getInstance(sourceResult.repoDir); | ||
return git.checkout('master', (checkoutErr) => { | ||
output.error(checkoutErr); | ||
return git.pull('origin', 'master', { '--rebase': true }, (pullErr, data) => { | ||
output.error(pullErr); | ||
return resolve(sourceResult); | ||
}); | ||
}); | ||
} else { | ||
return resolve(sourceResult); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
'use strict'; | ||
const chalk = require('chalk'); | ||
const _ = require('lodash'); | ||
|
||
module.exports = { | ||
log: (...args) => { | ||
console.log.apply(console, args); | ||
}, | ||
error: (...args) => { | ||
if (args[0] != null) { | ||
console.error.apply(console, _.map(args, chalk.bold.red)); | ||
} | ||
} | ||
}; |