Skip to content

Commit

Permalink
Merge pull request #10 from vladikoff/clone_url
Browse files Browse the repository at this point in the history
add clone_url support
  • Loading branch information
zeke committed Nov 3, 2015
2 parents fbd310b + b8cb2d6 commit 8bd5878
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ Here's what you'll get:
user: 'monkey',
repo: 'business',
branch: 'master',
tarball_url: 'https://api.github.com/repos/monkey/business/tarball/master',
clone_url: 'https://github.com/monkey/business',
https_url: 'https://github.com/monkey/business',
tarball_url: 'https://api.github.com/repos/monkey/business/tarball'
travis_url: 'https://travis-ci.org/monkey/business',
api_url: 'https://api.github.com/repos/monkey/business'
zip_url: 'https://github.com/monkey/business/archive/master.zip'
Expand All @@ -63,7 +64,9 @@ The shorthand form lets you specify a branch:
branch: 'nachos',
https_url: 'https://github.com/monkey/business/blob/nachos',
tarball_url: 'https://api.github.com/repos/monkey/business/tarball/nachos',
travis_url: 'https://travis-ci.org/monkey/business',
clone_url: 'https://github.com/monkey/business',
https_url: 'https://github.com/monkey/business/tree/nachos',
travis_url: 'https://travis-ci.org/monkey/business?branch=nachos',
api_url: 'https://api.github.com/repos/monkey/business'
zip_url: 'https://github.com/monkey/business/archive/nachos.zip'
}
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module.exports = function (repo_url) {
}

obj.tarball_url = util.format('https://api.github.com/repos/%s/%s/tarball/%s', obj.user, obj.repo, obj.branch)
obj.clone_url = util.format('https://github.com/%s/%s', obj.user, obj.repo)

if (obj.branch === 'master') {
obj.https_url = util.format('https://github.com/%s/%s', obj.user, obj.repo)
Expand Down
4 changes: 4 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ describe('github-url-to-object', function () {
assert.equal(obj.https_url, 'https://github.com/zeke/ord/blob/experiment')
})

it('applies to clone_url', function () {
assert.equal(obj.clone_url, 'https://github.com/zeke/ord')
})

it("doesn't apply to api_url", function () {
assert.equal(obj.api_url, 'https://api.github.com/repos/zeke/ord')
})
Expand Down

0 comments on commit 8bd5878

Please sign in to comment.