Skip to content

Commit

Permalink
dufs: add 0.31.0 bottle.
Browse files Browse the repository at this point in the history
  • Loading branch information
gromgit committed Jan 31, 2023
1 parent b9a6e1c commit ec1f101
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Formula/dufs.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
class Dufs < Formula
desc "Static file server"
homepage "https://github.com/sigoden/dufs"
url "https://github.com/sigoden/dufs/archive/refs/tags/v0.31.0.tar.gz"
sha256 "f5078fb245d0aeccbcfe966a0aa89fb2ee5af7a88016534ab66776971c0c3d2e"
license any_of: ["Apache-2.0", "MIT"]

bottle do
root_url "https://github.com/gromgit/homebrew-core-mojave/releases/download/dufs"
sha256 cellar: :any_skip_relocation, mojave: "fbe921871e3e28e49067c5ad570d0fed66fce2abc0dc67329c920ebd6827af9d"
end

depends_on "rust" => :build

def install
system "cargo", "install", *std_cargo_args

generate_completions_from_executable(bin/"dufs", "--completions")
end

test do
port = free_port
pid = fork do
exec "#{bin}/dufs", bin.to_s, "-b", "127.0.0.1", "--port", port.to_s
end

sleep 2

begin
read = (bin/"dufs").read
assert_equal read, shell_output("curl localhost:#{port}/dufs")
ensure
Process.kill("SIGINT", pid)
Process.wait(pid)
end
end
end

0 comments on commit ec1f101

Please sign in to comment.