90 lines
3.2 KiB
Ruby
90 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.1",
|
|
revision: "b502b2eaa46a6a10d9db228209f984bb235444a7"
|
|
license "MIT"
|
|
revision 2
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "61b9abe9e481e9fa3a86074756d065f48f92cf71420e6855e95ad1ecdc92cecb" => :catalina
|
|
sha256 "2e1fb0d6519682a80737b73136fd6cf1c81928d993e88e835cb053725ff40bf2" => :mojave
|
|
sha256 "63c2169d68aed5aca9a91bba014cdb96238b61316267691dd7c63ef566b89fc8" => :high_sierra
|
|
end
|
|
|
|
depends_on "python@3.8"
|
|
|
|
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
|