You are previewing Building Tools with GitHub.
O'Reilly logo
Building Tools with GitHub

Book Description

For your next project on GitHub, take advantage of the service’s powerful API to meet your unique development requirements. This practical guide shows you how to build your own software tools for customizing the GitHub workflow. Each hands-on chapter is a compelling story that walks you through the tradeoffs and considerations for building applications on top of various GitHub technologies.

If you’re an experienced programmer familiar with GitHub, you’ll learn how to build tools with the GitHub API and related open source technologies such as Jekyll (site builder), Hubot (NodeJS chat robot), and Gollum (wiki).

Table of Contents

  1. Preface
    1. Why APIs and Why the GitHub API?
    2. Structure of This Book
    3. Who You Are
    4. What You Will Learn
    5. GitHub “First Class” Languages
    6. Operating System Prerequisites
    7. Who This Book Is Not For
    8. Conventions Used in This Book
    9. Using Code Examples
    10. Safari® Books Online
    11. How to Contact Us
    12. Acknowledgments
  2. 1. The Unclad GitHub API
    1. cURL
    2. Breadcrumbs to Successive API Paths
    3. The JavaScript Object Notation (JSON) Format
      1. Parsing JSON from the Command Line
      2. Debugging Switches for cURL
    4. Important Headers
    5. Following a Hypermedia API
    6. Authentication
      1. Username and Password Authentication
      2. OAuth
    7. Status Codes
      1. Success (200 or 201)
      2. Naughty JSON (400)
      3. Improper JSON (422)
      4. Successful Creation (201)
      5. Nothing Has Changed (304)
      6. GitHub API Rate Limits
      7. Reading Your Rate Limits
    8. Conditional Requests to Avoid Rate Limitations
    9. Accessing Content from the Web
      1. JSON-P
      2. CORS Support
      3. Specifying Response Content Format
    10. Summary
  3. 2. Gists and the Gist API
    1. Easy Code Sharing
    2. Gists Are Repositories
      1. Embedding Gists Inside HTML
      2. Embedding Inside Jekyll Blogs
    3. Gist from the Command Line
    4. Gists as Fully Functioning Apps
    5. Gists that Render Gists
      1. Going Deeper into the Gist API
      2. Using Hypermedia Data from Octokit
    6. Summary
  4. 3. GitHub Wikis with Gollum
    1. “The Story of Smeagol…”
      1. Repository Linked Wikis
      2. Markup and Structure
    2. Hacking Gollum
    3. The Starting Point of a Gollum Editor
    4. Programmatically Handling Images
    5. Using the Rugged Library
    6. Optimizing for Image Storage
    7. Reviewing on GitHub
    8. Improving Revision Navigation
    9. Fixing Linking Between Comp Pages
    10. Summary
  5. 4. Python and the Search API
    1. Search API General Principles
      1. Authentication
      2. Result Format
      3. Search Operators and Qualifiers
      4. Sorting
    2. Search APIs in Detail
      1. Repository Search
      2. Code Search
      3. Issue Search
      4. User Search
    3. Our Example Application
      1. User Flow
    4. Python
      1. AGitHub
      2. WxPython
      3. PyInstaller
    5. The Code
      1. Git Credential Helper
      2. Windowing and Interface
      3. GitHub Login
      4. GitHub Search
      5. Displaying Results
    6. Packaging
    7. Summary
  6. 5. .NET and the Commit Status API
    1. The API
      1. Raw Statuses
      2. Combined Status
      3. Creating a Status
    2. Let’s Write an App
      1. Libraries
      2. Development Environment
      3. Sending the Request
      4. OAuth Flow
      5. Status Handler
    3. Summary
  7. 6. Ruby and Jekyll
    1. Learning and Building with Jekyll
    2. What Is Jekyll?
      1. Operating Jekyll Locally
    3. Jekyll Blog Quick Start
      1. YFM: YAML Front Matter
      2. Jekyll Markup
      3. Using the Jekyll Command
      4. Privacy Levels with Jekyll
      5. Themes
      6. Publishing on GitHub
      7. Hosting On Your Own Domain
    4. Importing from Other Blogs
      1. From Wordpress
      2. Exporting from Wordpress Alternatives
    5. Scraping Sites into Jekyll
      1. Jekyll Scraping Tactics
      2. Setting Up
      3. Scraping Titles
      4. Refinining with Interactive Ruby
      5. Writing Tests and Caching
      6. Writing Jekyll Posts
      7. Using the Jekyll Command-Line Tool
      8. Master Index File with Liquid Markup
      9. Scraping Body and Author
      10. Adding Images to Jekyll
      11. Customizing Styling (CSS)
      12. Inviting Contributions with GitHub “Fork”
      13. Publishing Our Blog to GitHub
    6. Summary
  8. 7. Android and the Git Data API
    1. Setting Up
      1. Creating a Jekyll Blog
      2. Android Development Tools
    2. Creating a New Project
      1. Editing the Gradle Build File
      2. Default Android Main
    3. Android Automated Testing
      1. Unit Tests for Our GitHub Client
      2. Android UI Tests
    4. Application Implementation
      1. Code to Log In to GitHub
      2. Code to Talk to GitHub
      3. Writing the Blog Content
      4. GitHub Services
      5. The Base SHA from the Repository and Branch
      6. Creating the Blob
      7. Generating a Tree
      8. Creating the Commit
      9. Updating the Master Resource
      10. Passing All Our Tests
    5. Summary
  9. 8. CoffeeScript, Hubot, and the Activity API
    1. The Activity API
    2. Planning for PR Satisfaction Guaranteed
      1. Considerations and Limitations
      2. Creating a Vanilla Hubot
      3. Creating a Slack Account
      4. Running Hubot Locally
    3. Installation on Heroku
      1. Setting Up Heroku
    4. Activity API Overview
      1. Writing a Hubot Extension
      2. Code Reviews via Pull Requests
      3. Using the OAuth Token to Register for Events
      4. Triggering Real Pull Requests
      5. Handling PR Notifications as Post Requests over HTTP
    5. Summary
  10. 9. JavaScript and the Git Data API
    1. Building a Coffee Shop Database on GitHub
    2. Set Up
      1. Mapping Hostnames
      2. Adding the Support Libraries
    3. An AngularJS Application Using GitHub.js
      1. Visualize Application Data Structure
      2. Making Our App Testable
      3. Test Data
      4. CoffeeTech.js
    4. Geocoding Support
      1. City Data
    5. Adding Login
      1. Errors Already?
    6. Displaying (Soon-to-Be) User-Reported Data
      1. User-Contributed Data
    7. Accepting Pull Requests
    8. Toward a Safe Login Implementation
      1. Authentication Requires a Server
      2. Fixing Authentication with Firebase
      3. Testing Firebase
      4. Implementing Firebase Login
    9. Summary
  11. A. GitHub Enterprise
    1. Installation
    2. Administration
    3. Endpoints
    4. Full Hostnames Versus Mount Points
    5. Command-Line Client Tools: cURL
    6. Example Request Using a Client Library
      1. Ruby Client Configuration
      2. Java
      3. JavaScript
      4. Python
      5. C#
    7. Management API
    8. Documentation
  12. B. Ruby, NodeJS, (and the Shell) at GitHub
    1. GitHub and Ruby
      1. Installing Ruby
      2. Important Ruby and RVM Concepts
      3. Potential Problems Installing Ruby
    2. GitHub Is Excited about NodeJS
      1. NodeJS Installation
      2. Node Version Manager
      3. package.json
    3. Command-Line Basics and the Shell
      1. Shell Comments
      2. Providing Variables to Commands
      3. Splitting Commands into Multiple Lines
      4. Piping Output to Successive Commands
      5. Redirection
  13. Index