homebrew-core/Formula/yadm.rb

39 lines
1.4 KiB
Ruby

class Yadm < Formula
desc "Yet Another Dotfiles Manager"
homepage "https://yadm.io/"
url "https://github.com/TheLocehiliosan/yadm/archive/3.2.2.tar.gz"
sha256 "c5fb508748995ce4c08a21d8bcda686ad680116ccf00a5318bbccf147f4c33ad"
license "GPL-3.0-or-later"
head "https://github.com/TheLocehiliosan/yadm.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, all: "fae6c470a2f67ecdcbfb2b973d78d74563759d4f39988f1be71c4641345b88ef"
end
def install
system "make", "install", "PREFIX=#{prefix}"
bash_completion.install "completion/bash/yadm"
fish_completion.install "completion/fish/yadm.fish"
zsh_completion.install "completion/zsh/_yadm"
end
test do
system bin/"yadm", "init"
assert_predicate testpath/".local/share/yadm/repo.git/config", :exist?, "Failed to init repository."
assert_match testpath.to_s, shell_output("#{bin}/yadm gitconfig core.worktree")
# disable auto-alt
system bin/"yadm", "config", "yadm.auto-alt", "false"
assert_match "false", shell_output("#{bin}/yadm config yadm.auto-alt")
(testpath/"testfile").write "test"
system bin/"yadm", "add", "#{testpath}/testfile"
system bin/"yadm", "gitconfig", "user.email", "test@test.org"
system bin/"yadm", "gitconfig", "user.name", "Test User"
system bin/"yadm", "commit", "-m", "test commit"
assert_match "test commit", shell_output("#{bin}/yadm log --pretty=oneline 2>&1")
end
end