-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
30 lines (24 loc) · 1.06 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const cfg = require('./config');
const welcome = `
********************* ATELIER STARTER *********************
Organisation Github : ${cfg.githubOrga}
Nom du dépôt : ${cfg.repositoryName}
Nom du projet : ${cfg.projectName}
Générer les dépôts : ${cfg.createRepository ? 'Oui' : 'Non'}
Générer les issues : ${cfg.generateIssues ? 'Oui' : 'Non'}
***********************************************************
`;
console.log(welcome);
const config = {};
config[`${cfg.repositoryName}`] = cfg.projectName;
const GitHub = require('github-api');
const gh = new GitHub({
// variable d'environnement GITHUB_TOKEN à configurer dans Travis
token: process.env.GITHUB_TOKEN
});
const promise$ = cfg.createRepository ? require('./repos').genRepos(gh, cfg.githubOrga, config).then ((data) => {
console.log(data);
require('./archetypes').push(cfg.githubOrga, config, cfg.jenkinsfile);
}) : Promise.resolve();
promise$.then(() => cfg.generateIssues ? require('./issues').genIssues(gh, cfg.githubOrga, config) : Promise.resolve())
.catch(console.log);