Comparing version 3.3.1 to 3.4.0
@@ -12,3 +12,12 @@ module.exports = { | ||
shouldPromptDescription: false, // Boolean. Set to true if you'll need a description with your demo. | ||
basePath: '' // String. Base path to your demo (ex. https://mydemo.com/). Provide only if needing a demo. It will be ignored otherwise. | ||
demoIntro: '', // String. Introduction appearing in your pull request description right before your demo url | ||
basePath: '', // String. Base path to your demo (ex. https://mydemo.com/). Provide only if needing a demo. It will be ignored otherwise. | ||
// You can also provide a basePath with the below path variables as such https://mydemo.com/{{repositoryName}}/{{sourceBranch}}/{{orAnyPathVariableListedBelow}} | ||
pathVariables: { | ||
repositoryName: null, // null or Function with signature (repositoryName) => String. Formatting function for repositoryName. | ||
repositoryOwner: null, // null or Function with signature (repositoryOwner) => String. Formatting function for repositoryOwner. | ||
pullRequestAuthor: null, // null or Function with signature (pullRequestAuthor) => String. Formatting function for pullRequestAuthor. | ||
sourceBranch: null, // null or Function with signature (sourceBranch) => String. Formatting function for sourceBranch. | ||
destinationBranch: null // null or Function with signature (destinationBranch) => String. Formatting function for destinationBranch. | ||
} | ||
}, | ||
@@ -15,0 +24,0 @@ reviewers: { |
@@ -7,4 +7,2 @@ #!/usr/bin/env node | ||
configFile.resetConfig() | ||
} else if (terminalOptions.getConfigFlag() && terminalOptions.isAllTrueConfigRequested()) { | ||
configFile.setAllTrueConfig() | ||
} else if (terminalOptions.getConfigFlag() && terminalOptions.isTailoredConfigRequested() && terminalOptions.isRemoteConfigRequested()) { | ||
@@ -11,0 +9,0 @@ configFile.setRemoteConfig(terminalOptions.getTailoredConfigFilePath()) |
@@ -41,15 +41,2 @@ require('colors') | ||
function setAllTrueConfig () { | ||
co(function * () { | ||
console.log(`${configStrings.noBackup}`.yellow.bold) | ||
const shouldReset = yield prompt.confirm(`${configStrings.reset}`.bold) | ||
if (shouldReset) { | ||
shell.cp(path.join(globalPath, 'config_presets', 'all-true.js'), configFile) | ||
} | ||
process.exit() | ||
}) | ||
} | ||
function setTailoredConfig (pathToFile) { | ||
@@ -106,5 +93,4 @@ co(function * () { | ||
resetConfig, | ||
setAllTrueConfig, | ||
setTailoredConfig, | ||
setRemoteConfig | ||
} |
const fs = require('fs') | ||
const jasmine = require('./jasmine') | ||
const paths = ['./lib/', './spec/'] | ||
const paths = ['./'] | ||
@@ -5,0 +5,0 @@ paths.forEach(path => { |
@@ -55,3 +55,3 @@ { | ||
}, | ||
"version": "3.3.1" | ||
"version": "3.4.0" | ||
} |
@@ -5,8 +5,24 @@ #!/ usr/bin/env node | ||
const pathToNodeModules = path.resolve().substr(0, path.resolve().lastIndexOf('/')) | ||
const srcPath = path.join(pathToNodeModules, 'bbpr.backup.config.js') | ||
const srcFileName = 'bbpr.backup.config.js' | ||
const srcPath = path.join(pathToNodeModules, srcFileName) | ||
const destPath = './bbpr.config.js' | ||
if (fs.existsSync(srcPath)) { | ||
fs.writeFileSync(destPath, fs.readFileSync(srcPath, 'utf8')) | ||
fs.unlinkSync(srcPath) | ||
function writeBackupConfig () { | ||
if (fs.existsSync(srcPath)) { | ||
const srcFile = fs.readFileSync(srcPath, 'utf8') | ||
fs.writeFileSync(destPath, srcFile) | ||
fs.unlinkSync(srcPath) | ||
} | ||
} | ||
if (require.main === module) { | ||
writeBackupConfig() | ||
} | ||
module.exports = { | ||
destPath, | ||
pathToNodeModules, | ||
srcFileName, | ||
srcPath, | ||
writeBackupConfig | ||
} |
@@ -5,7 +5,22 @@ #!/ usr/bin/env node | ||
const pathToNodeModules = [1, 2].reduce(pathToNode => pathToNode.substr(0, pathToNode.lastIndexOf('/')), path.resolve()) | ||
const destPath = path.join(pathToNodeModules, 'bbpr.backup.config.js') | ||
const srcPath = path.join(pathToNodeModules, 'bbpr/bbpr.config.js') | ||
const destPath = path.join(pathToNodeModules, 'bbpr.backup.config.js') | ||
if (fs.existsSync(srcPath)) { | ||
fs.writeFileSync(destPath, fs.readFileSync(srcPath, 'utf8')) | ||
function backupConfig () { | ||
if (fs.existsSync(srcPath)) { | ||
const fileContent = fs.readFileSync(srcPath, 'utf8') | ||
fs.writeFileSync(destPath, fileContent) | ||
} | ||
} | ||
if (require.main === module) { | ||
backupConfig() | ||
} | ||
module.exports = { | ||
backupConfig, | ||
destPath, | ||
pathToNodeModules, | ||
srcPath | ||
} |
@@ -1,1 +0,1 @@ | ||
const configFile = require('../../lib/config-file') | ||
// const configFile = require('../../lib/config-file') |
@@ -1,1 +0,5 @@ | ||
const crypt = require('../../lib/crypt') | ||
describe('crypt.js', () => { | ||
it('should require without error', () => { | ||
expect(() => require('../../lib/crypt')).not.toThrow() | ||
}) | ||
}) |
@@ -1,1 +0,5 @@ | ||
const normalize = require('../../lib/normalize-config') | ||
describe('normalize-config.js', () => { | ||
it('should require without error', () => { | ||
expect(() => require('../../lib/normalize-config')).not.toThrow() | ||
}) | ||
}) |
@@ -1,1 +0,28 @@ | ||
const open = require('../../lib/open') | ||
describe('open.js', () => { | ||
const shell = require('shelljs') | ||
let exec | ||
let tempFileName | ||
beforeEach(() => { | ||
exec = spyOn(shell, 'exec') | ||
tempFileName = 'tempFileName' | ||
}) | ||
it('should require without error', () => { | ||
expect(() => require('../../lib/open')).not.toThrow() | ||
}) | ||
describe('after require', () => { | ||
let open = require('../../lib/open') | ||
beforeEach(() => { | ||
open(tempFileName) | ||
}) | ||
it('should call shell exec with a platform dependent open command and the file name provided', () => { | ||
if (process.platform === 'darwin') expect(exec).toHaveBeenCalledWith(`open ${tempFileName}`) | ||
if (process.platform === 'win32') expect(exec).toHaveBeenCalledWith(`start ${tempFileName}`) | ||
if (process.platform === 'anythingelse') expect(exec).toHaveBeenCalledWith(`xdg-open ${tempFileName}`) | ||
}) | ||
}) | ||
}) |
@@ -1,1 +0,5 @@ | ||
const pr = require('../../lib/pr') | ||
describe('pr.js', () => { | ||
it('should require without error', () => { | ||
expect(() => require('../../lib/pr')).not.toThrow() | ||
}) | ||
}) |
@@ -1,1 +0,44 @@ | ||
const presentInfo = require('../../lib/present-info') | ||
// const presentInfo = require('../../lib/present-info') | ||
describe('present-info.js', () => { | ||
const vcs = require('../../lib/vcs') | ||
const reviewStrings = require('../../lib/strings').infoReview | ||
beforeEach(() => { | ||
spyOn(vcs, 'getCurrentBranchName').and.returnValue('feature-branch') | ||
spyOn(vcs, 'getRepositoryName').and.returnValue('testrepo') | ||
}) | ||
it('should require without error', () => { | ||
expect(() => require('../../lib/present-info')).not.toThrow() | ||
}) | ||
describe('after require', () => { | ||
const presentInfo = require('../../lib/present-info') | ||
const reviewer = 'reviewer' | ||
const args = ['destinationBranch', 'pullRequestTitle', 'pullRequestDescription', ['reviewer'], 'repositoryOwner', 'pullRequestAuthor'] | ||
let log | ||
beforeEach(() => { | ||
log = spyOn(console, 'log') | ||
}) | ||
it('should log only one time to the console', () => { | ||
presentInfo(...args) | ||
expect(log).toHaveBeenCalledTimes(1) | ||
}) | ||
it('should log a string containing all the arguments pass to it', () => { | ||
presentInfo(...args) | ||
args.forEach(arg => { | ||
if (typeof arg === 'string') expect(log.calls.mostRecent().args[0]).toContain(arg) | ||
if (typeof arg === 'array') expect(log.calls.mostRecent().args[0]).toContain(arg[0]) | ||
}) | ||
}) | ||
it('should log a string containing all the review strings', () => { | ||
presentInfo(...args) | ||
for (let str in reviewStrings) { | ||
expect(log.calls.mostRecent().args[0]).toContain(reviewStrings[str]) | ||
} | ||
}) | ||
}) | ||
}) |
@@ -1,1 +0,1 @@ | ||
const prompt = require('../../lib/prompt') | ||
// const prompt = require('../../lib/prompt') |
@@ -1,1 +0,5 @@ | ||
const reviewers = require('../../lib/reviewers') | ||
describe('reviewers.js', () => { | ||
it('should require without error', () => { | ||
expect(() => require('../../lib/reviewers')).not.toThrow() | ||
}) | ||
}) |
@@ -1,1 +0,20 @@ | ||
const strings = require('../../lib/strings') | ||
// const strings = require('../../lib/strings') | ||
describe('strings.js', () => { | ||
it('should require without error', () => { | ||
expect(() => require('../../lib/strings')).not.toThrow() | ||
}) | ||
it('should have only strings as end values', () => { | ||
function checkIfEndValueIsString (obj) { | ||
for (let key in obj) { | ||
if (typeof obj[key] === 'object') { | ||
checkIfEndValueIsString(obj[key]) | ||
} else { | ||
expect(typeof obj[key]).toBe('string') | ||
} | ||
} | ||
} | ||
checkIfEndValueIsString(require('../../lib/strings')) | ||
}) | ||
}) |
@@ -1,1 +0,5 @@ | ||
const terminalOptions = require('../../lib/terminal-options') | ||
describe('terminal-options.js', () => { | ||
it('should require without error', () => { | ||
expect(() => require('../../lib/terminal-options')).not.toThrow() | ||
}) | ||
}) |
@@ -1,1 +0,5 @@ | ||
const vcs = require('../../lib/vcs') | ||
describe('vcs.js', () => { | ||
it('should require without error', () => { | ||
expect(() => require('../../lib/vcs')).not.toThrow() | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
1011734
1047
48
9