From 675991eb611af0a970dce6945f5b882c4343875f Mon Sep 17 00:00:00 2001
From: Mike McQuaid <mike@mikemcquaid.com>
Date: Wed, 18 Feb 2015 12:56:10 +0000
Subject: [PATCH] pull: publish bottles on Bintray.

---
 Library/Homebrew/cmd/pull.rb | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/Library/Homebrew/cmd/pull.rb b/Library/Homebrew/cmd/pull.rb
index ac43bdad64..25abd91871 100644
--- a/Library/Homebrew/cmd/pull.rb
+++ b/Library/Homebrew/cmd/pull.rb
@@ -153,9 +153,25 @@ module Homebrew
         safe_system "git", "merge", "--ff-only", "--no-edit", bottle_branch
         safe_system "git", "branch", "-D", bottle_branch
 
-        # TODO: publish on bintray
-        # safe_system "curl", "-u#{user}:#{key}", "-X", "POST",
-        #   "https://api.bintray.com/content/homebrew/#{repo}/#{formula}/#{version}"
+        # Publish bottles on Bintray
+        bintray_user = ENV["BINTRAY_USER"]
+        bintray_key = ENV["BINTRAY_KEY"]
+        bintray_repo = if tap_name
+          tap_name.sub("/", "-") + "-bottles"
+        else
+          "bottles"
+        end
+
+        # Skip taps for now until we're using Bintray for Homebrew/homebrew
+        if bintray_user && bintray_key && !tap_name
+          changed_formulae.each do |f|
+            ohai "Publishing on Bintray:"
+            safe_system "curl", "--silent", "--fail",
+              "-u#{bintray_user}:#{bintray_key}", "-X", "POST",
+              "https://api.bintray.com/content/homebrew/#{bintray_repo}/#{f.name}/#{f.version}/publish"
+            puts
+          end
+        end
       end
 
       ohai 'Patch changed:'
-- 
GitLab