Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
GitHub.prototype.createRepo = function (repo) {
if (this.createdRepos[repo]) return this.createdRepos[repo];
var def = Q.defer();
var self = this;
var oldLog = require('github/util').log;
require('github/util').log = function () {};
function create() {
return Q.nfcall(self.client.repos.createFromOrg, {
org: self.settings.organisation,
name: repo,
auto_init: true,
team_id: self.settings.team
})
.fail(function (err) {
if (err && !(err.message && /already exists/.test(err.message))) {
throw err;
}
});
}
return this.createdRepos[repo] = retry(create, 5)
.then(function () {
.then(function () {
require('github/util').log = oldLog;
}, function (err) {
require('github/util').log = oldLog;
var TOKEN = ''
var Readable = require('stream').Readable || require('readable-stream').Readable
var Transform = require('stream').Transform || require('readable-stream').Transform
var Writable = require('stream').Writable || require('readable-stream').Writable
var util = require('util')
var path = require('path')
var join = path.join
var relative = path.relative
var fs = require('fs')
var rimraf = require('rimraf')
var gethub = require('gethub')
var Client = require('github')
require('github/util').log = function () {}
var mongojs = require('mongojs')
var fix = require('../')
require('./fix-json')
var processed = join(__dirname, '..', 'processed')
try { fs.mkdirSync(processed) } catch (ex) { if (ex.code != 'EEXIST') throw ex }
var temp = join(__dirname, '..', 'temp')
try { fs.mkdirSync(temp) } catch (ex) { if (ex.code != 'EEXIST') throw ex }
var client = new Client({version: '3.0.0', debug: false});
client.authenticate({
type: 'oauth',
token: TOKEN
})
var join = require('path').join;
var fs = require('fs');
var transform = require('transform-stream');
var GitHub = new require('github');
var spawn = require('win-spawn');
require('github/util').log = function () {};
var cloneCMD = 'git clone git@github.com:[user]/[repo].git';
exports.outputToDir = outputToDir;
function outputToDir(dir, github) {
try {
fs.mkdirSync(dir);
} catch (ex) {
if (ex.code !== 'EEXIST') throw ex;
}
var folders = [];
var modified = {};
var pendingFolders = {};
return transform(function (item, finish) {
var date = normaliseDate(item.header.date);
if (pendingFolders[date] === true) {