Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jlord/git-it
Browse files Browse the repository at this point in the history
  • Loading branch information
jlord committed Jan 20, 2014
2 parents 38f17fe + f9617f2 commit b76d239
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
1 change: 1 addition & 0 deletions problems/remote_control/solution.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
console.log(true)
console.log(true)
console.log(true)
32 changes: 13 additions & 19 deletions problems/remote_control/verify.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node

var spawn = require('child_process').spawn
var child = require('child_process')
var spawn = child.spawn
var concat = require('concat-stream')

var ref = spawn('git', ['reflog', 'show', 'origin/master'])
Expand All @@ -11,26 +12,19 @@ ref.stdout.pipe(concat(onRef))

function onRef(output) {
var ref = output.toString().trim()
if (ref.match("update by push"))
console.log(true)
if (ref.match("update by push")) console.log(true)
else console.log(false)
}

// verify they set up git config

var username = spawn('git', ['config', 'user.name'])
var email = spawn('git', ['config', 'user.email'])

username.stdout.pipe(concat(onUsername))

function onUsername(output) {
var userOutput = output.toString().trim()
if (userOutput == "") console.error("error")
else email.stdout.pipe(concat(onEmail))
}

function onEmail(output) {
var emailOutput = output.toString().trim()
if (emailOutput == "") console.error("error")
else console.log(true)
}
child.exec('git config user.email', function(err, stdout, stderr) {
var email = stdout.trim()
child.exec('git config user.name', function(err, stdout, stderr) {
var user = stdout.trim()
if (user === "") console.error(false)
else console.log(true)
if (email === "") console.error(false)
else console.log(true)
})
})

0 comments on commit b76d239

Please sign in to comment.