Skip to content

Commit

Permalink
Update to latest github_api release
Browse files Browse the repository at this point in the history
  • Loading branch information
pangratz committed Jun 9, 2012
1 parent 25b38af commit 4571fae
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -9,7 +9,7 @@ gem "uglifier", :git => "https://github.com/lautis/uglifier.git"
group :development do
gem "rack"
gem "rest-client"
gem "github_api", "0.4.11"
gem "github_api"
gem "ember-docs", :git => "https://github.com/emberjs/docs-generator.git"
gem "kicker"
end
20 changes: 10 additions & 10 deletions Gemfile.lock
Expand Up @@ -33,30 +33,30 @@ GIT
GEM
remote: http://rubygems.org/
specs:
addressable (2.2.8)
colored (1.2)
execjs (1.4.0)
multi_json (~> 1.0)
faraday (0.7.6)
addressable (~> 2.2)
faraday (0.8.1)
multipart-post (~> 1.1)
rack (~> 1.1)
github_api (0.4.11)
faraday (~> 0.7.6)
github_api (0.5.4)
faraday (~> 0.8.0)
hashie (~> 1.2.0)
multi_json (~> 1.3)
nokogiri (~> 1.5.2)
oauth2 (~> 0.5.2)
oauth2 (~> 0.7)
hashie (1.2.0)
httpauth (0.1)
kicker (2.5.0)
rb-fsevent
mime-types (1.18)
multi_json (1.3.6)
multipart-post (1.1.5)
nokogiri (1.5.3)
oauth2 (0.5.2)
faraday (~> 0.7)
oauth2 (0.7.1)
faraday (~> 0.8)
httpauth (~> 0.1)
multi_json (~> 1.0)
rack (~> 1.4)
rack (1.4.1)
rake (0.9.2.2)
rb-fsevent (0.9.1)
Expand All @@ -70,7 +70,7 @@ PLATFORMS
DEPENDENCIES
colored
ember-docs!
github_api (= 0.4.11)
github_api
kicker
rack
rake-pipeline!
Expand Down
8 changes: 4 additions & 4 deletions lib/github_uploader.rb
Expand Up @@ -64,21 +64,21 @@ def upload_file(filename, description, file)
gh = Github.new :user => @username, :repo => @repo, :oauth_token => @token

# remvove previous download with the same name
gh.repos.downloads do |download|
gh.repos.downloads.list @username, @repo do |download|
if filename == download.name
gh.repos.delete_download @username, @repo, download.id
gh.repos.downloads.delete @username, @repo, download.id
break
end
end

# step 1
hash = gh.repos.create_download @username, @repo,
hash = gh.repos.downloads.create @username, @repo,
"name" => filename,
"size" => File.size(file),
"description" => description

# step 2
gh.repos.upload hash, file
gh.repos.downloads.upload hash, file

return true
end
Expand Down

0 comments on commit 4571fae

Please sign in to comment.