Skip to content

Commit

Permalink
better console messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica Lord committed Jan 21, 2014
1 parent de05b05 commit d94c913
Show file tree
Hide file tree
Showing 20 changed files with 38 additions and 35 deletions.
4 changes: 2 additions & 2 deletions problems/branches_arent_just_for_birds/solution.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
console.log(true)
console.log(true)
console.log("Found the branch as expected!")
console.log("Changes have been pushed!")
4 changes: 2 additions & 2 deletions problems/branches_arent_just_for_birds/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ exec('git config user.username', function(err, stdout, stdrr) {
exec('git reflog show origin/' + branchName, function(err, stdout, stderr) {

var ref = stdout.trim()
if (branch.match(branchName)) console.log(true)
if (branch.match(branchName)) console.log("Found the branch as expected!")
else console.log("branch name was not '" + branchName + "'")

if (ref.match("update by push")) console.log(true)
if (ref.match("update by push")) console.log("Changes have been pushed!")
else console.log("Changes not pushed")

})
Expand Down
2 changes: 1 addition & 1 deletion problems/commit_to_it/solution.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log(true)
console.log("Changes have been committed!")
4 changes: 2 additions & 2 deletions problems/commit_to_it/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ show.stdout.pipe(concat(onShow))
function onShow(output) {
var show = output.toString().trim()
if (show.match("new file mode") && show.match("commit"))
console.log(true)
else console.log(false)
console.log("Changes have been committed!")
else console.log("Seems no changes have been committed.")
}
2 changes: 1 addition & 1 deletion problems/forks_and_clones/solution.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log(true)
console.log("Upstream remote set up!")
2 changes: 1 addition & 1 deletion problems/forks_and_clones/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ remote.stdout.pipe(concat(onRemote))
function onRemote(output) {
var show = output.toString().trim()
if (show.match("upstream") && show.match("github.com/jlord/"))
console.log(true)
console.log("Upstream remote set up!")
else return console.log("No upstream remote")
}
2 changes: 1 addition & 1 deletion problems/get_git/solution.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log(true)
console.log("Found Git installed.")
2 changes: 1 addition & 1 deletion problems/get_git/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ git.stdout.pipe(concat(onGit))
function onGit(output) {
var gitOutput = output.toString().trim()
if (gitOutput.match("git version")) {
console.log(true)
console.log("Found Git installed.")
}
else console.log("Found no Git installed.")
}
Expand Down
2 changes: 1 addition & 1 deletion problems/its_a_small_world/solution.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log(true)
console.log("Reporobot has been added!")
2 changes: 1 addition & 1 deletion problems/its_a_small_world/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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) console.log(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)
}
Expand Down
4 changes: 2 additions & 2 deletions problems/merge_tada/solution.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
console.log(true)
console.log(true)
console.log("Branch has been merged!")
console.log("Branch deleted!")
8 changes: 4 additions & 4 deletions problems/merge_tada/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ username.stdout.pipe(concat(onUser))
function onRef(output) {
var ref = output.toString().trim()
if (ref.match("merge"))
console.log(true)
else return console.log("no upstream remote")
console.log("Branch has been merged!")
else return console.log("No merge in the history.")
}

function onUser(output) {
Expand All @@ -34,7 +34,7 @@ function getBranches(callback) {
function onBranch(output) {
var branch = output.toString().trim()
if (branch.match(user)) {
console.log(false)
console.log("Uh oh, branch is still there.")
}
else return console.log(true)
else return console.log("Branch deleted!")
}
2 changes: 1 addition & 1 deletion problems/pull_never_out_of_date/solution.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log(true)
console.log("Up to date!")
4 changes: 2 additions & 2 deletions problems/pull_never_out_of_date/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ pull.stdout.pipe(concat(onPull))
function onPull(output) {
var status = output.toString().trim()
if (!status)
console.log(true)
else console.log("There are changes to pull in")
console.log("Up to date!")
else console.log("There are changes to pull in.")
}

// // check they have no changes to push
Expand Down
6 changes: 3 additions & 3 deletions problems/remote_control/solution.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
console.log(true)
console.log(true)
console.log(true)
onsole.log("Bingo! Detected a push.")
console.log("Username added!")
console.log("Email added!")
12 changes: 6 additions & 6 deletions problems/remote_control/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ ref.stdout.pipe(concat(onRef))

function onRef(output) {
var ref = output.toString().trim()
if (ref.match("update by push")) console.log(true)
else console.log(false)
if (ref.match("update by push")) console.log("Bingo! Detected a push.")
else console.log("No evidence of a push, please try again!")
}

// verify they set up git config
Expand All @@ -22,9 +22,9 @@ 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(false)
else console.log(true)
if (email === "") console.error(false)
else console.log(true)
if (user === "") console.error("No username found.")
else console.log("Username added!")
if (email === "") console.error("No email found.")
else console.log("Email added!")
})
})
2 changes: 1 addition & 1 deletion problems/repository/solution.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log(true)
console.log("This is a git repository!")
5 changes: 4 additions & 1 deletion problems/repository/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ 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)
console.log("This is a Git repository!")
else console.log("This folder isn't being tracked by Git."
+ "Re-run this challenge verify in a folder using Git"
+ "or `git init` to initialize Git in this folder.")
}
2 changes: 1 addition & 1 deletion problems/requesting_you_pull_please/solution.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log(true)
console.log("Nice! Found your pull request!")
2 changes: 1 addition & 1 deletion problems/requesting_you_pull_please/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function pullrequest(username) {
request(url + username, {json: true}, function (error, response, body) {
if (!error && response.statusCode == 200) {
var pr = body.pr
if (pr) console.log(true)
if (pr) console.log("Nice! Found your pull request!")
else console.log("No pull request found for " + username)
}
})
Expand Down

0 comments on commit d94c913

Please sign in to comment.