Skip to content

Commit

Permalink
fixes #13 git/github its own challenge and verify gh account
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica Lord committed Jan 24, 2014
1 parent 7af9790 commit 545045d
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 70 deletions.
2 changes: 1 addition & 1 deletion git-it.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Workshopper({
appDir: __dirname,
helpFile: path.join(__dirname, 'help.txt'),
menu: {
bg: 'cyan',
bg: 'magenta',
fg: 'white'
}
}).init()
1 change: 1 addition & 0 deletions menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"GET GIT",
"REPOSITORY",
"COMMIT TO IT",
"GITHUBBIN",
"REMOTE CONTROL",
"FORKS AND CLONES",
"BRANCHES AREN'T JUST FOR BIRDS",
Expand Down
40 changes: 40 additions & 0 deletions problems/githubbin/problem.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Configure Git and GitHub.

--------------------------------------------------------------------

Join the 5 million building things together on GitHub by creating an
account, then configure your Git so that it knows who is doing
the editing.

{bold}{cyan}
Create a GitHub Account{/bold}
-----------------------{/cyan}

GitHub is a website that alows people everywhere to share what
they're working on with Git and to easily work together.

- Visit {bold}http://www.github.com{/bold} and sign up for a free account.
- High five, welcome!

{bold}{cyan}
Configure Git{/bold}
-------------{/cyan}

You'll want to let Git know who to associate the changes you make to
by telling it your name, GitHub account name and email address.

Open a new terminal {bold}(CMD + N){/bold} window and set your name:

$ git config --global user.name "Your Name"

Then add your GitHub username:

$ git config --global user.username githubusername

Now set your email:

$ git config --global user.email [email protected]

When you've set everything up, run `git-it verify`

--------------------------------------------------------------------
3 changes: 3 additions & 0 deletions problems/githubbin/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function () {
return { args: [], stdin: null }
}
3 changes: 3 additions & 0 deletions problems/githubbin/solution.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
console.log("Username added!")
console.log("Email added!")
console.log("You're on GitHub!")
33 changes: 33 additions & 0 deletions problems/githubbin/verify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env node

var exec = require('child_process').exec
var request = require('request')

var url = "http://www.github.com/"

// 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!")
checkGitHub(user)
}
if (email === "") console.error("No email found.")
else console.log("Email added!")
})
})

function checkGitHub(user, callback) {
request(url + user + '.json', {json: true}, function (error, response, body) {
if (error) return console.log(error)
if (!error && response.statusCode == 200) {
if (body.error) return console.log("GitHub account matching Git\n username wasn't found.")
else console.log("You're on GitHub!")
}
})
}

37 changes: 0 additions & 37 deletions problems/pull_never_out_of_date/problem2.txt

This file was deleted.

29 changes: 0 additions & 29 deletions problems/remote_control/problem.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,6 @@
is handy, but makes it pretty hard to share and work with others on.
No worries, that's what GitHub.com is for!

{bold}{cyan}
Create a GitHub Account{/bold}
-----------------------{/cyan}

GitHub is a website that alows people everywhere to share what
they're working on with Git and to easily work together.

- Visit {bold}http://www.github.com{/bold} and sign up for a free account.
- High five, welcome!

{bold}{cyan}
Configure Git{/bold}
-------------{/cyan}

You'll want to let Git know who to associate the changes you make to
by telling it your GitHub account name and email address.

Open a new terminal {bold}(CMD + N){/bold} window and set your name:

$ git config --global user.name "Your Name"

Then add your GitHub username:

$ git config --global user.username githubusername

Now set your email:

$ git config --global user.email [email protected]

{bold}{cyan}
Create a Remote Repository{/bold}
--------------------------{/cyan}
Expand Down
4 changes: 1 addition & 3 deletions problems/remote_control/solution.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
console.log("Bingo! Detected a push.")
console.log("Username added!")
console.log("Email added!")
console.log("Bingo! Detected a push.")

0 comments on commit 545045d

Please sign in to comment.