Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git-it, Share it

Git-it, Share it

On building Git-it, a Node.js terminal app with real time server for GitHub learning GitHub and using time with new users to make GitHub better.



May 22, 2014

More Decks by Jessica

Other Decks in Programming


  1. Git-it, Share it Building servers and tools to teach the

    Gits! Jessica Lord, GitHub github/jlord ! ⚡ #
  2. Why Git-it Building Git-it Git-it and GitHub ? # $

  3. Why Git-it ?

  4. Wanted: GitHub hosted hack night Leave with your first pull

    request, shiny green contribution squares Late 2013
  5. NodeConf 2013 @substack creates `stream-adventure` module @rodvagg creates `workshopper` framework

    Summer 2013 NodeSchool
  6. Summer 2013

  7. www.nodeschool.io `stream-adventure` `learnyounode` `levelmeup` `byewiser` `functional javascript` …

  8. jlord finds ways to write Node at GitHub Alternative talk

    title: (we do a lot of Ruby)
  9. Building Git-it #

  10. Building Git-it fork`workshopper` GitHub API create fork-able repo @reporobot teaching

    Git #
  11. Git Real Real terminal. Real Git. Real GitHub. And one

    non-real human, but real robot.
  12. GitHub Flow » GET GIT ! » REPOSITORY » COMMIT

  13. Building Git-it fork`workshopper` GitHub API create fork-able repo @reporobot teaching

    Git #
  14. None
  15. `workshopper` typical Compare console.log(“Hello World”) // Hello World console.log(“Hello World”)

    // Hello World Expected: Submitted:
  16. But Git — Fork of `workshopper` that lets me run

    Git and requests in the background to verify user did the right thing. Is not JS, isn’t in files.
  17. $ Git-it git-it verify the! verify.js! for each challenge run

    Git in background hit GitHub API hit my server other things
  18. Toolbox $ Git-it patchwork GitHub API @reporobot

  19. $ Git-it patchwork user

  20. $ Git-it GitHub API @reporobot patchwork user

  21. Git-it, checking user’s Git in verify.js: 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.” }) Compare Git Expected/Actual
  22. git --config user.username jlord Useful Made up Thing So that

    I can always know a user’s GitHub name for which to make queries with! exec('git config user.username', function(e, so, se) { var user = stdout.trim() })
  23. Building Git-it fork`workshopper` GitHub API create fork-able repo @reporobot teaching

    Git #
  24. Git-it to GitHub API Verify user set up GitHub account

    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…”) else console.log("You're on GitHub!") } }) Use require(‘request’) directly from app
  25. Building Git-it fork`workshopper` GitHub API create fork-able repo @reporobot teaching

    Git #
  26. A repo to fork GH Pages hosted site with the

    names of all who have completed the workshop. jlord/patchwork User submits name in Pull Request.
  27. None
  28. Building Git-it fork`workshopper` GitHub API create fork-able repo @reporobot teaching

    Git #
  29. @reporobot

  30. None
  31. @reporobot Node.js server Digital Ocean Droplet maxogden/taco GitHub API via

    michael/github $5
  32. No hooks on added as a collaborator :( reporobot.jlord.us/push #8:

    It’s a small world @reporobot account email with cloudmailin.com which sends JSON to server. {JSON}
  33. #8: It’s a small world Check if user added @reporobot

    as collaborator http://reporobot.jlord.us/collab?username= Git-it verify @reporobot, GitHub API permissions.push?
  34. @reporobot, GitHub API write to repo

  35. Git-it sends request to @reporobot who hits the GitHub API

    to check for a PR, responds true/false #10: Request you pull http://reporobot.jlord.us/pr?username= Webhook on patchwork sends push on PR to @reporobot http://reporobot.jlord.us/orderin
  36. Check filename (contributors/add-username.txt) #10: Request you pull Check file content

    (ascii art) Not Ok? Comment. All ok? Merge!
  37. add name, date, ascii to contributors.json on server Rebuild Patchwork

    Site rebuilds /patchwork site @reporobot is a collaborator on jlord/patchwork @reporobot also a static site generator
  38. None
  39. Node.js, GitHub API FTW email json requests in collab. check

    PR check requests out write ascii permission.push loop PRs comment PR merge PR push patchwork
  40. a little crazy Testing use test accounts and run through:

    create branch, create file (with ascii art), create PR. @reporobot is doing the writing which means each test account must have patchwork fork & RR as a collaborator. then delete it all & repeat.
  41. Share Git-it $

  42. Patchwork Night

  43. None
  44. NUX Team NUX Team: designers, developers,! user research How can

    GitHub.com be easier, better for new users? What is being new to GitHub like? What tools can we make to help? Experiment!
  45. Patchwork at GitHub Future? Soon to be more places! UK!

    % Merge conflict!
  46. Share what you know Host an event! nodeschool.io/events Build a

    workshop! Mentor at an event! nodeschool.io/events Watch the GitHub blog - github.com/blog
  47. Takk! @jllord gh/jlord