Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tecno14 committed Oct 18, 2020
0 parents commit 5b39d66
Show file tree
Hide file tree
Showing 217 changed files with 16,063 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
5 changes: 5 additions & 0 deletions Demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const ca = require('./clone_all');

ca.clone_all('GitHub_Username');

console.log('Done !!!!');
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# CloneRepo
Clone All User Repo Github
87 changes: 87 additions & 0 deletions clone_all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// clone all github user repos
// TECNO 2020 [email protected]

// --------------------------------

// ToDo

// --------------------------------

// How its work
// 1- get user repos from github api
// 2- clone each one

// --------------------------------

const https = require('https');
const shell = require('shelljs');

module.exports.clone_all = function(username) {
if(username)
clone_all(username);
else
console.log("'username' required !!");
return;
}

function clone_all(username) {

var options = {
hostname: "api.github.com",
port: 443, //https
path: "/users/" + username + "/repos?per_page=9999",
method: 'GET',
headers: {
'content-type': 'application/json',
'User-Agent': 'Mozilla/5.0'
}
};

console.log(username);

//change to http for local testing
var req = https.get(options, function(res) {
res.setEncoding('utf8');

var body = '';

res.on('data', function(chunk) {
body = body + chunk;
});

res.on('end', function() {

repos = JSON.parse(body);
console.log(repos.length + ' repo found !!');

shell.mkdir(username);
shell.cd(username)

for (var i = 0; i < repos.length; i++) {
console.log((i + 1) + '- ' + repos[i].name);
shell.exec('git clone ' + repos[i].clone_url);
console.log('--------------');
}

if (res.statusCode != 200) {
//callback("Api call failed with response code " + res.statusCode);
console.log("Api call failed with response code " + res.statusCode);
return;
} else {
//callback(null);
return;
}
});

});

req.on('error', function(e) {
console.log("Error : " + e.message);
callback(e);
});

// write data to request body
//req.write(post_data);
req.end();

}
15 changes: 15 additions & 0 deletions node_modules/.bin/shjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions node_modules/.bin/shjs.cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions node_modules/.bin/shjs.ps1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions node_modules/balanced-match/.npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/balanced-match/LICENSE.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 91 additions & 0 deletions node_modules/balanced-match/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions node_modules/balanced-match/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5b39d66

Please sign in to comment.