Skip to content

Commit

Permalink
Merge pull request #1168 from pangratz/update_uploader
Browse files Browse the repository at this point in the history
Refactor upload_latest task to use github_downloads gem
  • Loading branch information
wagenet committed Jul 14, 2012
2 parents 3d8a3b3 + 6eee369 commit 2b213df
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 124 deletions.
3 changes: 1 addition & 2 deletions Gemfile
Expand Up @@ -8,8 +8,7 @@ gem "uglifier", :git => "https://github.com/lautis/uglifier.git"

group :development do
gem "rack"
gem "rest-client"
gem "github_api"
gem "github_downloads"
gem "ember-docs", :git => "https://github.com/emberjs/docs-generator.git"
gem "kicker"
end
24 changes: 15 additions & 9 deletions Gemfile.lock
Expand Up @@ -38,25 +38,32 @@ GEM
multi_json (~> 1.0)
faraday (0.8.1)
multipart-post (~> 1.1)
github_api (0.5.4)
faraday (~> 0.8.0)
github_api (0.6.1)
faraday (~> 0.8.1)
hashie (~> 1.2.0)
multi_json (~> 1.3)
nokogiri (~> 1.5.2)
oauth2 (~> 0.7)
oauth2
github_downloads (0.1.1)
github_api (~> 0.6.0)
rest-client (~> 1.6.7)
hashie (1.2.0)
httpauth (0.1)
json (1.7.3)
jwt (0.1.4)
json (>= 1.2.4)
kicker (2.5.0)
rb-fsevent
mime-types (1.18)
mime-types (1.19)
multi_json (1.3.6)
multipart-post (1.1.5)
nokogiri (1.5.3)
oauth2 (0.7.1)
nokogiri (1.5.5)
oauth2 (0.8.0)
faraday (~> 0.8)
httpauth (~> 0.1)
jwt (~> 0.1.4)
multi_json (~> 1.0)
rack (~> 1.4)
rack (~> 1.2)
rack (1.4.1)
rake (0.9.2.2)
rb-fsevent (0.9.1)
Expand All @@ -70,10 +77,9 @@ PLATFORMS
DEPENDENCIES
colored
ember-docs!
github_api
github_downloads
kicker
rack
rake-pipeline!
rake-pipeline-web-filters!
rest-client
uglifier!
27 changes: 2 additions & 25 deletions Rakefile
Expand Up @@ -8,32 +8,9 @@ def pipeline
end

def setup_uploader(root=Dir.pwd)
require './lib/github_uploader'

login = origin = nil

Dir.chdir(root) do
# get the github user name
login = `git config github.user`.chomp

# get repo from git config's origin url
origin = `git config remote.origin.url`.chomp # url to origin
# extract USERNAME/REPO_NAME
# sample urls: https://github.com/emberjs/ember.js.git
# git://github.com/emberjs/ember.js.git
# git@github.com:emberjs/ember.js.git
# git@github.com:emberjs/ember.js
end

repoUrl = origin.match(/github\.com[\/:]((.+?)\/(.+?))(\.git)?$/)
username = ENV['GH_USERNAME'] || repoUrl[2] # username part of origin url
repo = ENV['GH_REPO'] || repoUrl[3] # repository name part of origin url

token = ENV["GH_OAUTH_TOKEN"]

uploader = GithubUploader.new(login, username, repo, token)
require 'github_downloads'
uploader = GithubDownloads::Uploader.new
uploader.authorize

uploader
end

Expand Down
88 changes: 0 additions & 88 deletions lib/github_uploader.rb

This file was deleted.

0 comments on commit 2b213df

Please sign in to comment.