Skip to content

Commit

Permalink
repo verify
Browse files Browse the repository at this point in the history
  • Loading branch information
jlord committed Dec 29, 2013
1 parent 6f80d39 commit 8f7738d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
7 changes: 2 additions & 5 deletions problems/get_git/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ var username = spawn('git', ['config', 'user.name'])
var email = spawn('git', ['config', 'user.email'])

username.stdout.pipe(concat(onUsername))
// email.stdout.pipe(concat(onEmail))

// var pending = 2

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

function onEmail(output) {
var emailOutput = output.toString().trim()
if (emailOutput == "") console.error("error")
else console.log(emailOutput)
else console.log(true)
}

3 changes: 3 additions & 0 deletions problems/repository/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function () {
return { args: [], stdin: null }
}
1 change: 1 addition & 0 deletions problems/repository/solution.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log(true)
18 changes: 18 additions & 0 deletions problems/repository/verify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node

// should have them type in the path of their
// repo OR have them create a new folder from
// the start.

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

var status = spawn('git', ['status'])

status.stdout.pipe(concat(onStatus))

function onStatus(output) {
var status = output.toString().trim()
if (status != "fatal: Not a git repository (or any of the parent directories): .git")
console.log(true)
}

0 comments on commit 8f7738d

Please sign in to comment.