homebrew-fuse/Formula/rclone-mac.rb

59 lines
2.2 KiB
Ruby
Raw Normal View History

2021-05-02 22:09:42 +08:00
require_relative "../require/macfuse"
class RcloneMac < Formula
desc "Rsync for cloud storage (with macOS FUSE mount support)"
homepage "https://rclone.org/"
2022-10-27 20:22:57 +08:00
url "https://github.com/rclone/rclone/archive/v1.60.0.tar.gz"
sha256 "357ee8bb1c1589d9640f1eb87ffeb9dbe8bc7ea6f33f90f56df142515a32f4f2"
2021-05-02 22:09:42 +08:00
license "MIT"
head "https://github.com/rclone/rclone.git"
2021-10-04 23:19:33 +08:00
bottle do
2022-10-27 20:22:57 +08:00
root_url "https://github.com/gromgit/homebrew-fuse/releases/download/rclone-mac-1.60.0"
sha256 cellar: :any_skip_relocation, arm64_monterey: "5a0b4e4d87f6c492bce0f75783c88e94f390fe62399bdd85384d86592b3d506d"
2021-10-04 23:19:33 +08:00
end
2021-05-02 22:09:42 +08:00
depends_on "go" => :build
depends_on MacfuseRequirement
depends_on :macos
def install
setup_fuse
2021-05-02 22:09:42 +08:00
system "go", "build",
"-ldflags", "-s -X github.com/rclone/rclone/fs.Version=v#{version}",
"-tags", "cmount", *std_go_args
(libexec/"rclone").install_symlink bin/name.to_s => "rclone"
2021-05-02 22:09:42 +08:00
man1.install "rclone.1" => "#{name}.1"
system bin/name.to_s, "genautocomplete", "bash", "rclone.bash"
2021-05-02 22:09:42 +08:00
system bin/name.to_s, "genautocomplete", "bash", "#{name}.bash"
system bin/name.to_s, "genautocomplete", "zsh", "_rclone"
2021-05-02 22:09:42 +08:00
system bin/name.to_s, "genautocomplete", "zsh", "_#{name}"
inreplace "#{name}.bash" do |s|
s.gsub! "commands=(\"rclone\")", "commands=(\"#{name}\")"
2021-05-03 15:08:39 +08:00
s.gsub!(/(-F __start_rclone) rclone$/, "\\1 #{name}")
2021-05-02 22:09:42 +08:00
end
bash_completion.install "rclone.bash" => "rclone"
2021-05-02 22:09:42 +08:00
bash_completion.install "#{name}.bash" => name.to_s
zsh_completion.install "_rclone"
2021-05-02 22:09:42 +08:00
zsh_completion.install "_#{name}"
end
def caveats
<<~EOS
The rclone binary has been installed as `#{name}`,
to avoid conflict with the core `rclone` formula.
If you need to use it as `rclone`, add the "rclone" directory
to your PATH like:
PATH="#{opt_libexec}/rclone:$PATH"
EOS
end
2021-05-02 22:09:42 +08:00
test do
(testpath/"file1.txt").write "Test!"
system bin/name.to_s, "copy", testpath/"file1.txt", testpath/"dist"
assert_match File.read(testpath/"file1.txt"), File.read(testpath/"dist/file1.txt")
system opt_libexec/"rclone/rclone", "copy", testpath/"file1.txt", testpath/"dast"
assert_match File.read(testpath/"file1.txt"), File.read(testpath/"dast/file1.txt")
2021-05-02 22:09:42 +08:00
end
end