Skip to content

Commit 7afa49f

Browse files
committed
webdav 5.8.0 (new formula)
1 parent c4a0a05 commit 7afa49f

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Formula/w/webdav.rb

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
class Webdav < Formula
2+
desc "Simple and standalone WebDAV server"
3+
homepage "https://github.com/hacdias/webdav"
4+
url "https://github.com/hacdias/webdav/archive/refs/tags/v5.8.0.tar.gz"
5+
sha256 "fc9e5272c821f5a4ca98321195469a87a9ba8a8c696c0f4d3008407ee8150039"
6+
license "MIT"
7+
head "https://github.com/hacdias/webdav.git", branch: "main"
8+
9+
depends_on "go" => :build
10+
11+
def install
12+
ldflags = "-s -w -X github.com/hacdias/webdav/v5/cmd.version=#{version}"
13+
system "go", "build", *std_go_args(ldflags:)
14+
15+
generate_completions_from_executable(bin/"webdav", "completion")
16+
end
17+
18+
test do
19+
port = free_port
20+
(testpath/"config.yaml").write <<~YAML
21+
address: 127.0.0.1
22+
port: #{port}
23+
directory: #{testpath}
24+
YAML
25+
26+
(testpath/"hello").write "World!"
27+
28+
begin
29+
pid = spawn bin/"webdav", "--config", testpath/"config.yaml"
30+
sleep 2
31+
32+
assert_match "World!", shell_output("curl -s http://127.0.0.1:#{port}/hello")
33+
assert_match version.to_s, shell_output("#{bin}/webdav version")
34+
ensure
35+
Process.kill("SIGINT", pid)
36+
Process.wait(pid)
37+
end
38+
end
39+
end

0 commit comments

Comments
 (0)