gitlab-2-github
Advanced tools
Comparing version 0.1.1 to 0.1.2
93
index.js
@@ -53,40 +53,29 @@ var GitHubApi = require("github"); | ||
}); | ||
github.issues.getAllMilestones({ | ||
user: settings.github.username, | ||
repo: settings.github.repo | ||
}, function(err, milestoneDataOpen) { | ||
github.issues.getAllMilestones({ | ||
user: settings.github.username, | ||
repo: settings.github.repo, | ||
state: 'closed' | ||
}, function(err, milestoneDataClosed) { | ||
milestoneData = milestoneDataClosed.concat(milestoneDataOpen).map(function(item) { | ||
return { | ||
number: item.number, | ||
title: item.title | ||
}; | ||
}); | ||
milestoneDataMapped = milestoneData.map(function(item) { | ||
return item.title; | ||
}); | ||
getAllGHMilestones(function(milestoneDataA, milestoneDataMappedA) { | ||
// for now use globals | ||
milestoneData = milestoneDataA; | ||
milestoneDataMapped = milestoneDataMappedA; | ||
console.log('\n\n\n\n\n\n\n>>>>'); | ||
console.log(milestoneDataMapped); | ||
console.log('\n\n\n\n\n\n\n'); | ||
console.log(milestoneDataClosed[0]); | ||
console.log('\n\n\n\n\n\n\n>>>>'); | ||
console.log(milestoneDataMapped); | ||
console.log('\n\n\n\n\n\n\n'); | ||
async.each(data, function(item, cb) { | ||
if (milestoneDataMapped.indexOf(item.title) < 0) { | ||
console.log('Creating new Milestone', item.title); | ||
createMilestone(item, function(err, createMilestoneData) { | ||
console.log(createMilestoneData); | ||
return cb(err); | ||
}); | ||
} else { | ||
return cb(err); | ||
} | ||
}, function(err) { | ||
if (err) return console.log(err); | ||
// all milestones are created | ||
getAllGHMilestones(function(milestoneDataA, milestoneDataMappedA) { | ||
// for now use globals | ||
milestoneData = milestoneDataA; | ||
milestoneDataMapped = milestoneDataMappedA; | ||
console.log('\n\n\n\n\n\n\n'); | ||
async.each(data, function(item, cb) { | ||
if (milestoneDataMapped.indexOf(item.title) < 0) { | ||
console.log('Creating new Milestone', item.title); | ||
createMilestone(item, function(err, createMilestoneData) { | ||
console.log(createMilestoneData); | ||
return cb(err); | ||
}); | ||
} else { | ||
return cb(err); | ||
} | ||
}, function(err) { | ||
if (err) return console.log(err); | ||
// all milestones are created | ||
createAllIssuesAndComments(milestoneData, function(err, data) { | ||
@@ -96,5 +85,5 @@ console.log('\n\n\n\nFinished creating all issues and Comments\n\n\n\n') | ||
}); | ||
}); // async | ||
}); // closed Issues | ||
}); // opend issues | ||
}); | ||
}); // async | ||
}) | ||
}); // gitlab list milestones | ||
@@ -149,2 +138,28 @@ } | ||
function getAllGHMilestones(callback) { | ||
github.issues.getAllMilestones({ | ||
user: settings.github.username, | ||
repo: settings.github.repo | ||
}, function(err, milestoneDataOpen) { | ||
github.issues.getAllMilestones({ | ||
user: settings.github.username, | ||
repo: settings.github.repo, | ||
state: 'closed' | ||
}, function(err, milestoneDataClosed) { | ||
milestoneData = milestoneDataClosed.concat(milestoneDataOpen).map(function(item) { | ||
return { | ||
number: item.number, | ||
title: item.title | ||
}; | ||
}); | ||
milestoneDataMapped = milestoneData.map(function(item) { | ||
return item.title; | ||
}); | ||
return callback(milestoneData, milestoneDataMapped); | ||
}); // openMilestones | ||
}); //closedMilestones | ||
} | ||
function getAllGHIssues(callback) { | ||
@@ -151,0 +166,0 @@ var lastItem = null; |
{ | ||
"name": "gitlab-2-github", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Migrate Issues, Wiki from gitlab to github", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
12818
290