forked from jlord/git-it
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jessica Lord
committed
Jan 22, 2014
1 parent
0bfa328
commit 03000e6
Showing
8 changed files
with
63 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
#!/usr/bin/env node | ||
|
||
var spawn = require('child_process').spawn | ||
var concat = require('concat-stream') | ||
|
||
var remote = spawn('git', ['remote', '-v']) | ||
|
||
remote.stdout.pipe(concat(onRemote)) | ||
var exec = require('child_process').exec | ||
|
||
// check that they've added the remote, that shows | ||
// that they've also then forked and cloned. | ||
|
||
function onRemote(output) { | ||
var show = output.toString().trim() | ||
exec('git remote -v', function(err, stdout, stdrr) { | ||
var show = stdout.trim() | ||
|
||
if (show.match("upstream") && show.match("github.com/jlord/")) | ||
console.log("Upstream remote set up!") | ||
console.log("Upstream remote set up!") | ||
else return console.log("No upstream remote") | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
#!/usr/bin/env node | ||
|
||
var spawn = require('child_process').spawn | ||
var concat = require('concat-stream') | ||
var exec = require('child_process').exec | ||
|
||
// check that Git is installed | ||
|
||
var git = spawn('git', ['--version']) | ||
|
||
git.stdout.pipe(concat(onGit)) | ||
|
||
function onGit(output) { | ||
var gitOutput = output.toString().trim() | ||
if (gitOutput.match("git version")) { | ||
exec('git --version', function(err, stdout, stdrr) { | ||
var gitOutput = stdout.trim() | ||
|
||
if (gitOutput.match("git version")) | ||
console.log("Found Git installed.") | ||
} | ||
else console.log("Found no Git installed.") | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
#!/usr/bin/env node | ||
|
||
var request = require('request') | ||
var spawn = require('child_process').spawn | ||
var concat = require('concat-stream') | ||
var exec = require('child_process').exec | ||
|
||
// var url = "http://localhost:5563/collab?username=" | ||
var url = 'http://reporobot.jlord.us/collab?username=' | ||
var user = spawn('git', ['config', 'user.username']) | ||
|
||
user.stdout.pipe(concat(onUser)) | ||
|
||
function onUser(output) { | ||
var username = output.toString().trim() | ||
exec('git config user.username', function(err, stdout, stdrr) { | ||
var username = stdout.trim() | ||
collaborating(username) | ||
} | ||
}) | ||
|
||
// check that they've added RR as a collaborator | ||
|
||
function collaborating(username) { | ||
request(url + username, {json: true}, function (error, response, body) { | ||
if (error) console.log(error) | ||
if (!error && response.statusCode == 200) { | ||
if (body.collab = true) | ||
if (body.collab = true) console.log("Reporobot has been added!") | ||
else console.log("Reporobot doesn't have access to the fork") | ||
if (body.error) console.log(body) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,25 @@ | ||
#!/usr/bin/env node | ||
|
||
var spawn = require('child_process').spawn | ||
var concat = require('concat-stream') | ||
|
||
var ref = spawn('git', ['reflog', '-10']) | ||
var username = spawn('git', ['config', 'user.username']) | ||
|
||
var user = "" | ||
|
||
ref.stdout.pipe(concat(onRef)) | ||
username.stdout.pipe(concat(onUser)) | ||
var exec = require('child_process').exec | ||
|
||
// check that they performed a merge | ||
// check there is not username named branch | ||
|
||
function onRef(output) { | ||
var ref = output.toString().trim() | ||
if (ref.match("merge")) | ||
console.log("Branch has been merged!") | ||
else return console.log("No merge in the history.") | ||
} | ||
|
||
function onUser(output) { | ||
user = output.toString().trim() | ||
getBranches(onBranch) | ||
} | ||
|
||
function getBranches(callback) { | ||
var branches = spawn('git', ['branch']) | ||
branches.stdout.pipe(concat(callback)) | ||
} | ||
|
||
function onBranch(output) { | ||
var branch = output.toString().trim() | ||
if (branch.match(user)) { | ||
console.log("Uh oh, branch is still there.") | ||
} | ||
else return console.log("Branch deleted!") | ||
} | ||
exec('git reflog -10', function(err, stdout, stdrr) { | ||
var ref = stdout.trim() | ||
var user = "" | ||
|
||
if (ref.match("merge")) console.log("Branch has been merged!") | ||
else console.log("No merge in the history.") | ||
|
||
exec('git config user.username', function(err, stdout, stdrr) { | ||
user = stdout.trim() | ||
|
||
exec('git branch', function(err, stdout, stdrr) { | ||
branches = stdout.trim() | ||
|
||
if (branches.match(user)) console.log("Uh oh, branch is still there.") | ||
else return console.log("Branch deleted!") | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,25 @@ | ||
#!/usr/bin/env node | ||
|
||
var child = require('child_process') | ||
var spawn = child.spawn | ||
var concat = require('concat-stream') | ||
|
||
var ref = spawn('git', ['reflog', 'show', 'origin/master']) | ||
|
||
ref.stdout.pipe(concat(onRef)) | ||
var exec = require('child_process').exec | ||
|
||
// check that they've made a push | ||
|
||
function onRef(output) { | ||
var ref = output.toString().trim() | ||
exec('git reflog show origin/master', function(err, stdout, stderr) { | ||
var ref = stdout.trim() | ||
|
||
if (ref.match("update by push")) console.log("Bingo! Detected a push.") | ||
else console.log("No evidence of push.") | ||
} | ||
|
||
// verify they set up git config | ||
|
||
child.exec('git config user.email', function(err, stdout, stderr) { | ||
var email = stdout.trim() | ||
child.exec('git config user.username', function(err, stdout, stderr) { | ||
var user = stdout.trim() | ||
if (user === "") console.error("No username found.") | ||
else console.log("Username added!") | ||
if (email === "") console.error("No email found.") | ||
else console.log("Email added!") | ||
// verify they set up git config | ||
exec('git config user.email', function(err, stdout, stderr) { | ||
var email = stdout.trim() | ||
exec('git config user.username', function(err, stdout, stderr) { | ||
var user = stdout.trim() | ||
if (user === "") console.error("No username found.") | ||
else console.log("Username added!") | ||
if (email === "") console.error("No email found.") | ||
else console.log("Email added!") | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters