diff options
| author | Mike McQuaid | 2015-02-19 10:56:47 +0000 | 
|---|---|---|
| committer | Mike McQuaid | 2015-02-19 11:06:21 +0000 | 
| commit | 1acdeb3bb72ac1e67b5c83f3dd55389f24b84e9c (patch) | |
| tree | e065eb118205e2a32d18e7eed6f33be554bab080 /Library/Homebrew/cmd | |
| parent | e303a97aa710e781c9ccb0b5b7c7675f26862be3 (diff) | |
| download | brew-1acdeb3bb72ac1e67b5c83f3dd55389f24b84e9c.tar.bz2 | |
test-bot: support taps and use Bintray class.
Also: use curl method where sensible.
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/test-bot.rb | 35 | 
1 files changed, 13 insertions, 22 deletions
diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb index 4812eb60e..8f394f24c 100644 --- a/Library/Homebrew/cmd/test-bot.rb +++ b/Library/Homebrew/cmd/test-bot.rb @@ -668,8 +668,7 @@ module Homebrew        bintray_user = ENV["BINTRAY_USER"]        bintray_key = ENV["BINTRAY_KEY"] -      # Skip taps for now until we're using Bintray for Homebrew/homebrew -      if !tap && (!bintray_user || !bintray_key) +      if !bintray_user || !bintray_key          raise "Missing BINTRAY_USER or BINTRAY_KEY variables!"        end @@ -703,10 +702,10 @@ module Homebrew          safe_system "brew", "pull", "--clean", pull_pr        end +      # Check for existing bottles as we don't want them to be autopublished +      # on Bintray until manually `brew pull`ed.        existing_bottles = {}        Dir.glob("*.bottle*.tar.gz") do |filename| -        # Skip taps for now until we're using Bintray for Homebrew/homebrew -        next if tap          formula_name = bottle_filename_formula_name filename          formula = Formulary.factory formula_name          existing_bottles[formula_name] = !!formula.bottle @@ -723,38 +722,30 @@ module Homebrew        safe_system "git", "push", "--force", remote, "master:master", ":refs/tags/#{tag}"        # Bintray upload (will take over soon) -      repo = if tap -        tap.sub("/", "-") + "-bottles" -      else -        "bottles" -      end - +      bintray_repo = Bintray.repository(tap_name) +      bintray_repo_url = "https://api.bintray.com/packages/homebrew/#{bintray_repo}"        formula_packaged = {}        Dir.glob("*.bottle*.tar.gz") do |filename| -        # Skip taps for now until we're using Bintray for Homebrew/homebrew -        next if tap -        version = BottleVersion.parse(filename).to_s +        version = Bintray.version(f.bottle.url)          formula = bottle_filename_formula_name filename          existing_bottle = existing_bottles[formula]          unless formula_packaged[formula] -          repo_url = "https://api.bintray.com/packages/homebrew/#{repo}" -          package_url = "#{repo_url}/#{formula}" +          package_url = "#{bintray_repo_url}/#{formula}"            unless system "curl", "--silent", "--fail", "--output", "/dev/null", package_url -            safe_system "curl", "--silent", "--fail", -              "-u#{bintray_user}:#{bintray_key}", -              "-H", "Content-Type: application/json", -              "-d", "{\"name\":\"#{formula}\"}", repo_url +            curl "--silent", "--fail", "-u#{bintray_user}:#{bintray_key}", +                 "-H", "Content-Type: application/json", +                 "-d", "{\"name\":\"#{formula}\"}", bintray_repo_url              puts            end            formula_packaged[formula] = true          end -        content_url = "https://api.bintray.com/content/homebrew/#{repo}/#{formula}/#{version}/#{filename}" +        content_url = "https://api.bintray.com/content/homebrew/#{bintray_repo}/#{formula}/#{version}/#{filename}"          content_url += "?publish=1&override=1" if existing_bottle -        safe_system "curl", "--silent", "--fail", -          "-u#{bintray_user}:#{bintray_key}", "-T", filename, content_url +        curl "--silent", "--fail", "-u#{bintray_user}:#{bintray_key}", +             "-T", filename, content_url          puts        end  | 
