Skip to content

Commit

Permalink
making bitbucket server support more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
machellerogden committed Feb 20, 2017
1 parent 71d1679 commit acfa1cb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions lib/getSourceData.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ function getSourceData(forceRefresh = false) {
sourceData = _.mapValues(sourceData, _.flow(_.flattenDeep, _.compact));
sourceData = _.mapValues(sourceData, (entries) => _.uniqBy(entries, 'name'));
return new Promise((resolve, reject) => {
let bitbucketConfig = _.find(rc.sources, { type: 'bitbucket-server' });
if (bitbucketConfig) {
sourceData[bitbucketConfig.host] = sourceData['bitbucket-server'];
delete sourceData['bitbucket-server'];
}
fs.writeJSON(CACHE_PATH, sourceData, null, 4);
fs.commit((err) => {
if (err) return reject(err);
Expand Down
5 changes: 2 additions & 3 deletions setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ function setup() {
{
type: 'input',
name: 'bitbucketHost',
message: 'Please type the Bitbucket domain which contains repos you want bitcar to track:',
default: 'git.cars.com',
message: 'Please type the Bitbucket Server domain which contains repos you want bitcar to track (NOTE: there is no support for bitbucket.org at this time):',
when: (answers) => answers.addBitbucketServer
}
]).then((answers) => {
Expand All @@ -91,7 +90,7 @@ source $HOME/.bitcar/completions.sh
}

if (answers.addBitbucketServer) {
configContent.sources.push({ type: 'bitbucketServer', host: answers.bitbucketHost });
configContent.sources.push({ type: 'bitbucket-server', host: answers.bitbucketHost });
}

const mkdirp = require('mkdirp');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const inquirer = require('inquirer');
module.exports = bitbucketSourcePromise;

function bitbucketSourcePromise(config) {
const bitbucketConfig = _.find(config.sources, { type: 'bitbucketServer' });
const bitbucketConfig = _.find(config.sources, { type: 'bitbucket-server' });
if (bitbucketConfig && bitbucketConfig.host) {
return inquirer.prompt([
{
Expand Down
2 changes: 1 addition & 1 deletion sources/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
'use strict';
exports['git.cars.com'] = require('./git.cars.com');
exports['bitbucket-server'] = require('./bitbucket-server');
exports['github.com'] = require('./github.com');

0 comments on commit acfa1cb

Please sign in to comment.