91 lines
3.6 KiB
Ruby
91 lines
3.6 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 4
|
|
head "https://github.com/earwig/git-repo-updater.git"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "756252ddabb0074e82777e094dc48b873f9d92654b1af72a3818a0d5e1dfca33"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "5ea818d777b458b351c6dba3fced8dfe0b2872855041f2f4dce01751e4ead21c"
|
|
sha256 cellar: :any_skip_relocation, catalina: "741ddc9b31fff9cab313a9bd9da4ef42d94946887b730db62a1ca437bd67b485"
|
|
sha256 cellar: :any_skip_relocation, mojave: "30d5bfe2d496259630b86658d0269cdb8ae6039e8edc77f9651d21a74c6f2b3e"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "ffd9d75739ea219cf727d12c46dc0f4dacab636f75378ed22c883c514ad29e49"
|
|
end
|
|
|
|
depends_on "python@3.9"
|
|
|
|
resource "colorama" do
|
|
url "https://files.pythonhosted.org/packages/1f/bb/5d3246097ab77fa083a61bd8d3d527b7ae063c7d8e8671b1cf8c4ec10cbe/colorama-0.4.4.tar.gz"
|
|
sha256 "5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"
|
|
end
|
|
|
|
resource "gitdb" do
|
|
url "https://files.pythonhosted.org/packages/d1/05/eaf2ac564344030d8b3ce870b116d7bb559020163e80d9aa4a3d75f3e820/gitdb-4.0.5.tar.gz"
|
|
sha256 "c9e1f2d0db7ddb9a704c2a0217be31214e91a4fe1dea1efad19ae42ba0c285c9"
|
|
end
|
|
|
|
resource "GitPython" do
|
|
url "https://files.pythonhosted.org/packages/ec/4d/e6553122c85ec7c4c3e702142cc0f5ed02e5cf1b4d7ecea86a07e45725a0/GitPython-3.1.12.tar.gz"
|
|
sha256 "42dbefd8d9e2576c496ed0059f3103dcef7125b9ce16f9d5f9c834aed44a1dac"
|
|
end
|
|
|
|
resource "smmap" do
|
|
url "https://files.pythonhosted.org/packages/75/fb/2f594e5364f9c986b2c89eb662fc6067292cb3df2b88ae31c939b9138bb9/smmap-3.0.4.tar.gz"
|
|
sha256 "9c98bbd1f9786d22f14b3d4126894d56befb835ec90cef151af566c7e19b5d24"
|
|
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 = 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
|