64 lines
2.1 KiB
Ruby
64 lines
2.1 KiB
Ruby
class DingtalkWorkspaceCli < Formula
|
|
desc "Automate DingTalk workspace tasks from the terminal"
|
|
homepage "https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli"
|
|
version "1.0.56"
|
|
license "Apache-2.0"
|
|
|
|
|
|
on_macos do
|
|
if Hardware::CPU.arm?
|
|
url "https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli/releases/download/v1.0.56/dws-darwin-arm64.tar.gz"
|
|
sha256 "5c6003fe484aa36cc00820a574186652467b9d075f19c159cf807e57590256ba"
|
|
else
|
|
url "https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli/releases/download/v1.0.56/dws-darwin-amd64.tar.gz"
|
|
sha256 "969b005a10682c2a1a828fa112165b5b0cd8ceeed8d22110ef7f39402cc36804"
|
|
end
|
|
end
|
|
|
|
on_linux do
|
|
if Hardware::CPU.arm?
|
|
url "https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli/releases/download/v1.0.56/dws-linux-arm64.tar.gz"
|
|
sha256 "530c5ea7ddc7de320d9c2471fbd33752a723d00c9665f49321c7580e8392c756"
|
|
else
|
|
url "https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli/releases/download/v1.0.56/dws-linux-amd64.tar.gz"
|
|
sha256 "675fa42727ac9a549c6710b82e1980cd0f795363d71d5116a4e69771b7c5470e"
|
|
end
|
|
end
|
|
|
|
resource "skills" do
|
|
url "https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli/releases/download/v1.0.56/dws-skills.zip"
|
|
sha256 "3d57794e4660a089209ce3962571d16ca0d46141e973c9993257a301cce0e097"
|
|
end
|
|
|
|
def install
|
|
root = Dir["dws-*"].find { |entry| File.directory?(entry) } || "."
|
|
binary = File.join(root, "dws")
|
|
raise "binary not found: #{binary}" unless File.exist?(binary)
|
|
|
|
bin.install binary => "dws"
|
|
|
|
%w[LICENSE NOTICE README.md CHANGELOG.md].each do |name|
|
|
source = File.join(root, name)
|
|
pkgshare.install source if File.exist?(source)
|
|
end
|
|
|
|
skill_dest = pkgshare/"skills/dws"
|
|
skill_dest.mkpath
|
|
resource("skills").stage do
|
|
cp_r(Dir["*"], skill_dest)
|
|
end
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
Agent Skills are bundled in #{pkgshare}/skills/dws.
|
|
Run `dws skill setup` to install them into your Agent directories.
|
|
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/dws version")
|
|
end
|
|
end
|