homebrew-core/Formula/gitup.rb
2018-08-31 04:22:50 +01:00

88 lines
3.2 KiB
Ruby

class Gitup < Formula
include Language::Python::Virtualenv
desc "Update multiple git repositories at once"
homepage "https://github.com/earwig/git-repo-updater"
url "https://github.com/earwig/git-repo-updater.git",
:tag => "v0.5",
:revision => "ba5eec698999c36cb3d603ae46baa6f076b7b695"
bottle do
cellar :any_skip_relocation
sha256 "80a1da9109342ec500c6cdb89c7a90b79048a80438d20368169cfc03b2f57776" => :mojave
sha256 "013423ddf1b0b48b22cf16fcc60b35f3e06e73615f24dc226fa004669d09e392" => :high_sierra
sha256 "2b3a5f5cdc84e26488f87e2fdc390612bc79c016fb5ce2915eddc8c49dc71473" => :sierra
sha256 "3099d2c8e9b7adb5150b23d08f95832808e8d175186f25109459f106c3d31564" => :el_capitan
end
depends_on "python"
resource "colorama" do
url "https://files.pythonhosted.org/packages/e6/76/257b53926889e2835355d74fec73d82662100135293e17d382e2b74d1669/colorama-0.3.9.tar.gz"
sha256 "48eb22f4f8461b1df5734a074b57042430fb06e1d61bd1e11b078c0fe6d7a1f1"
end
resource "gitdb2" do
url "https://files.pythonhosted.org/packages/b9/36/4bdb753087a9232899ac482ee2d5da25f50b63998d661aa4e8170acd95b5/gitdb2-2.0.4.tar.gz"
sha256 "bb4c85b8a58531c51373c89f92163b92f30f81369605a67cd52d1fc21246c044"
end
resource "GitPython" do
url "https://files.pythonhosted.org/packages/4d/e8/98e06d3bc954e3c5b34e2a579ddf26255e762d21eb24fede458eff654c51/GitPython-2.1.11.tar.gz"
sha256 "8237dc5bfd6f1366abeee5624111b9d6879393d84745a507de0fda86043b65a8"
end
resource "smmap2" do
url "https://files.pythonhosted.org/packages/ad/e9/0fb974b182ff41d28ad267d0b4201b35159619eb610ea9a2e036817cb0b8/smmap2-2.0.4.tar.gz"
sha256 "dc216005e529d57007ace27048eb336dcecb7fc413cfb3b2f402bb25972b69c6"
end
def install
virtualenv_install_with_resources
end
test do
def prepare_repo(uri, local_head)
system "git", "init"
system "git", "remote", "add", "origin", uri
system "git", "fetch", "origin"
system "git", "checkout", local_head
system "git", "reset", "--hard"
system "git", "checkout", "-b", "master"
system "git", "branch", "--set-upstream-to=origin/master", "master"
end
first_head_start = "f47ab45abdbc77e518776e5dc44f515721c523ae"
mkdir "first" do
prepare_repo("https://github.com/pr0d1r2/homebrew-contrib.git", first_head_start)
end
second_head_start = "f863d5ca9e39e524e8c222428e14625a5053ed2b"
mkdir "second" do
prepare_repo("https://github.com/pr0d1r2/homebrew-cask-games.git", second_head_start)
end
system bin/"gitup", "first", "second"
first_head = `cd first ; git rev-parse HEAD`.split.first
assert_not_equal first_head, first_head_start
second_head = `cd second ; git rev-parse HEAD`.split.first
assert_not_equal second_head, second_head_start
third_head_start = "f47ab45abdbc77e518776e5dc44f515721c523ae"
mkdir "third" do
prepare_repo("https://github.com/pr0d1r2/homebrew-contrib.git", third_head_start)
end
system bin/"gitup", "--add", "third"
system bin/"gitup"
third_head = `cd third ; git rev-parse HEAD`.split.first
assert_not_equal third_head, third_head_start
assert_match %r{#{Dir.pwd}/third}, `#{bin}/gitup --list`.strip
system bin/"gitup", "--delete", "#{Dir.pwd}/third"
end
end