Permalink
Browse files

Move scripts needed by mysql release into shared release repo

  • Loading branch information...
1 parent 410014c commit d280ff2e8c89118e9b046bbb291b8ba18eadc749 David Stevenson and Jeff Schnitzer committed Sep 27, 2013
Showing with 7 additions and 111 deletions.
  1. +3 −0 .gitmodules
  2. +0 −89 check_travis.rb
  3. +1 −0 check_travis.rb
  4. +0 −1 commit_with_shortlog
  5. +1 −0 commit_with_shortlog
  6. +1 −0 shared
  7. +0 −21 staged_shortlog
  8. +1 −0 staged_shortlog
View
@@ -88,3 +88,6 @@
[submodule "src/gorouter/src/code.google.com/p/gogoprotobuf"]
path = src/gorouter/src/code.google.com/p/gogoprotobuf
url = https://code.google.com/p/gogoprotobuf/
+[submodule "shared"]
+ path = shared
+ url = https://github.com/cloudfoundry/shared-release-packages.git
View
@@ -1,89 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'net/http'
-require 'json'
-require 'optparse'
-
-class String
- COLORS = { yellow: "\e[0;33m", green: "\e[0;32m", red: "\e[0;31m", blue: "\e[0;34m", reset: "\e[0m" }.freeze
-
- def self.color=(color); @color = color; end
- def self.color?; !!@color; end
-
- def color(color)
- String.color? ? "#{COLORS[color]}#{self}#{COLORS[:reset]}" : self
- end
-end
-
-class TravisBuild
- TRAVIS_URL = "https://api.travis-ci.org/repos/%s/builds".freeze
-
- def initialize(shas, color = true)
- @shas = shas
- remote = `git remote -v`.match(/github.com[\/:]([^\s]+?).git/)
- @repo = remote && remote[1]
- String.color = color
- end
-
- def log_with_travis_status
- output = [travis? ? "https://travis-ci.org/#{@repo}".color(:yellow) : "No Travis".color(:blue)]
-
- `git log #{@shas} --oneline`.split("\n").each do |commit|
- sha, message = commit.split(" ", 2)
- output << "\n#{sha.color(:yellow)} #{message}#{travis_status(sha) if travis?}"
- end
-
- puts output.join
- end
-
- def log_sorted_by_author_with_travis_status
- output = ["Bump #{@repo}:\n".color(:blue)]
-
- commits_by_author = Hash.new("")
- `git log #{@shas} --pretty=format:'%h %an: %s'`.split("\n").each do |commit|
- sha, message = commit.split(" ", 2)
- author, message = message.split(":", 2)
- commits_by_author[author] += "\n #{message}#{travis_status(sha) if travis?}"
- end
-
- commits_by_author.each { |author, commit| output << " #{author.color(:yellow)}:#{commit}\n" }
- puts output.join
- end
-
- private
-
- def travis_json
- @travis_json ||= begin
- uri = URI(TRAVIS_URL % @repo)
- http = Net::HTTP.new(uri.host, uri.port)
- http.use_ssl = true
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
- JSON.parse(http.request(Net::HTTP::Get.new(uri.path)).body)
- end
- end
-
- def travis?
- @travis ||= @repo && travis_json && travis_json.any?
- end
-
- def travis_status(sha)
- build = travis_json.find { |build| build["commit"].start_with?(sha) }
-
- message = case build && build["result"]
- when 0; "Travis Success: #{build_url(build)}".color(:green)
- when 1; "Travis Failed: #{build_url(build)}".color(:red)
- else; "Travis #{build ? "#{build["state"]}: #{build_url(build)}" : "Unknown"}".color(:blue)
- end
-
- " ( #{message} )"
- end
-
- def build_url(build)
- "https://travis-ci.org/#{@repo}/builds/#{build["id"]}"
- end
-end
-
-if __FILE__ == $PROGRAM_NAME
- travis = TravisBuild.new(ARGV[0], true)
- travis.log_with_travis_status
-end
View
@@ -1 +0,0 @@
-git commit -m "`./staged_shortlog`"
Submodule shared added at 4c85af
View
@@ -1,21 +0,0 @@
-#!/usr/bin/env ruby
-require_relative 'check_travis.rb'
-
-diffs = `git diff --cached`.split('diff --git').select { |log| log =~ /Subproject/ }
-
-locations = {}
-diffs.each do |diff|
- /a\/(?<loc>.+?)\sb.*index\s(?<shas>\S+)/m.match diff do |matches|
- locations[matches[:loc]] = matches[:shas]
- end
-end
-
-puts "Bump #{locations.keys.join(", ")}"
-puts # Second line of git commit message should always be empty
-
-locations.each do |location, shas|
- Dir.chdir(location) do
- travis = TravisBuild.new(shas, ARGV[0] == "-c")
- travis.log_sorted_by_author_with_travis_status
- end
-end
View

0 comments on commit d280ff2

Please sign in to comment.