This repository has been archived by the owner on Aug 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #203 from ascariandrea/create-release
Release API.
- Loading branch information
Showing
14 changed files
with
308 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ npm-debug.log | |
*.swp | ||
docs | ||
.DS_Store | ||
|
||
test/config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# | ||
# release.coffee: Github release class | ||
# | ||
# Copyright © 2013 Josh Priestley. All rights reserved | ||
# | ||
|
||
# Initiate class | ||
class Release | ||
|
||
constructor: (@repo, @number, @client) -> | ||
|
||
# Get a single release | ||
# '/repos/pksunkara/hub/releases/37' GET | ||
info: (cb) -> | ||
@client.get "/repos/#{@repo}/releases/#{@number}", (err, s, b, h) -> | ||
return cb(err) if err | ||
if s isnt 200 then cb(new Error("Release info error")) else cb null, b, h | ||
|
||
# Attach a file to a release | ||
# '/repos/pksunkara/hub/releases/37/assets?name=archive.zip' POST | ||
uploadAssets: (file, optionsOrCb, cb) -> | ||
if !cb? and typeof optionsOrCb is 'function' | ||
cb = optionsOrCb | ||
optionsOrCb = {} | ||
|
||
options = | ||
query: | ||
name: optionsOrCb.name || 'archive.zip' | ||
body: file | ||
headers: | ||
'Content-Type': optionsOrCb.contentType || 'application/zip' | ||
|
||
uploadHost = optionsOrCb.uploadHost || 'uploads.github.com' | ||
|
||
@client.post "https://#{uploadHost}/repos/#{@repo}/releases/#{@number}/assets", null, options, (err, s, b, h) -> | ||
return cb(err) if err | ||
if s isnt 201 then cb(new Error("Release assets error")) else cb null, b, h | ||
|
||
# Export module | ||
module.exports = Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"repo": "username/Spoon-Knife", | ||
"auth": { | ||
"username": "username", | ||
"password": "******" | ||
} | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.