95 lines
3.9 KiB
Ruby
95 lines
3.9 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://files.pythonhosted.org/packages/7f/07/4835f8f4de5924b5f38b816c648bde284f0cec9a9ae65bd7e5b7f5867638/gitup-0.5.1.tar.gz"
|
|
sha256 "4f787079cd65d8f60c5842181204635e1b72d3533ae91f0c619624c6b20846dd"
|
|
license "MIT"
|
|
revision 5
|
|
head "https://github.com/earwig/git-repo-updater.git", branch: "develop"
|
|
|
|
bottle do
|
|
rebuild 1
|
|
sha256 cellar: :any_skip_relocation, arm64_ventura: "c1bea89a62730bf3c03d67653699ee75a4068c4db618b71b5ae971f1be69e7b6"
|
|
sha256 cellar: :any_skip_relocation, arm64_monterey: "84f6bdcc590d628a69a6df9d73daa7f4b03e727e7018435ae0eb6eeee0a9ecd2"
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "64b8c89c2f2eb10df5927b164fd3586b7887f9f8d354f179fc42d0f84a06bac9"
|
|
sha256 cellar: :any_skip_relocation, ventura: "a7ff18b8d4ec8889a0dcb6ade317e60db8d3c1dc6f91e9718b791c3170081749"
|
|
sha256 cellar: :any_skip_relocation, monterey: "cbfb28018815d98d4d7a526211850b06f0170ca1d010ff1015d1577dc150741d"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "c12f8494fa00c94bb840aacd2c6d416933f6180c65f8ab79fb82ed6aa2ef4da6"
|
|
sha256 cellar: :any_skip_relocation, catalina: "d8459f0f5084b7bf1185b46b772ab789ad6d56746e52c7d0d7f8bdae8abf93c3"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "7eabc1f0d74014226967563a8a1b63667df1403f2b47e1742a3e47bfa475b739"
|
|
end
|
|
|
|
depends_on "python@3.11"
|
|
|
|
resource "colorama" do
|
|
url "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz"
|
|
sha256 "08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"
|
|
end
|
|
|
|
resource "gitdb" do
|
|
url "https://files.pythonhosted.org/packages/fc/44/64e02ef96f20b347385f0e9c03098659cb5a1285d36c3d17c56e534d80cf/gitdb-4.0.9.tar.gz"
|
|
sha256 "bac2fd45c0a1c9cf619e63a90d62bdc63892ef92387424b855792a6cabe789aa"
|
|
end
|
|
|
|
resource "GitPython" do
|
|
url "https://files.pythonhosted.org/packages/22/ab/3dd8b8a24399cee9c903d5f7600d20e8703d48904020f46f7fa5ac5474e9/GitPython-3.1.29.tar.gz"
|
|
sha256 "cc36bfc4a3f913e66805a28e84703e419d9c264c1077e537b54f0e1af85dbefd"
|
|
end
|
|
|
|
resource "smmap" do
|
|
url "https://files.pythonhosted.org/packages/21/2d/39c6c57032f786f1965022563eec60623bb3e1409ade6ad834ff703724f3/smmap-5.0.0.tar.gz"
|
|
sha256 "c840e62059cd3be204b0c9c9f74be2c09d5648eddd4580d9314c3ecde0b30936"
|
|
end
|
|
|
|
def install
|
|
virtualenv_install_with_resources
|
|
end
|
|
|
|
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
|
|
|
|
test do
|
|
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 = Utils.git_head(testpath/"first")
|
|
refute_equal first_head, first_head_start
|
|
|
|
second_head = Utils.git_head(testpath/"second")
|
|
refute_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 = Utils.git_head(testpath/"third")
|
|
refute_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
|