Update to GitHub API v3 #8

Merged
merged 9 commits into from Jan 2, 2015

Conversation

Projects
None yet
3 participants
@garethrees
Collaborator

garethrees commented Jan 1, 2015

Fixes #6

Highlights:

  • Uses octokit to provide v3 compatibility
  • Improves repository listing (can now get private org repos if authenticated)

dush and others added some commits Mar 8, 2013

Create authenticated client if token option is set
If a token is passed as an option, create a client authenticated by the
token, otherwise just create an unauthenticated client.

An unauthenticated client can only access public repositories for the
given username.

Also renames incorrect :oauth_token option to :access_token
Paginate through user repositories
Initial move to Octokit in 1d42d21 didn’t paginate through results so a
limited set of repositories was being returned.
Improve handling of repository listings
Provides a wider range of backup capabilities, rather than only the
specified user’s public repositories.

1. Client is unauthenticated

   Backs up the specified user’s public repositories.

2. Client is authenticated and the login matches the username option

   The user specified by the username option is the authenticated user
   so both public and private repositories are backed up.

3. Client is authenticated but does not match the username option

   Backs up the specified user’s public repositories. Private
   repositories are accessed by using the same username as the login
   of an authenticated client (see above).

4. Client is unauthenticated and the username is an organisation

   Backs up the specified organisations’s public repositories.

5. Client is authenticated and the username is an organisation

   Backs up the specified organisations’s public repositories and the
   private repositories that the authenticated user has access to.
Remove obsolete login option
While octokit supports HTTP Basic auth (username/password),
github-backup never supported this. For now just remove support so that
only OAuth tokens are acceptable.
Preserve authentication through ~/.gitconfig
Copies and slightly improves #read_gitconfig from octopi. Only tries
to read the config if a token is not supplied on the command line.

[1] https://github.com/fcoury/octopi/blob/master/lib/octopi.rb

ddollar added a commit that referenced this pull request Jan 2, 2015

@ddollar ddollar merged commit 556efea into ddollar:master Jan 2, 2015

@ddollar

This comment has been minimized.

Show comment
Hide comment
@ddollar

ddollar Jan 2, 2015

Owner

Thank you!

Owner

ddollar commented Jan 2, 2015

Thank you!

@garethrees garethrees deleted the garethrees:api_v3 branch Jan 4, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment