41 lines
1.1 KiB
Ruby
41 lines
1.1 KiB
Ruby
cask "dwarf-fortress" do
|
|
version "0.47.05"
|
|
sha256 "bc79a92adb96497d59546378e8c9ab2ef67ca22abfbd9763616de9c2e00e5f24"
|
|
|
|
url "https://www.bay12games.com/dwarves/df_#{version.minor}_#{version.patch}_osx.tar.bz2"
|
|
name "Dwarf Fortress"
|
|
desc "Single-player fantasy game"
|
|
homepage "https://www.bay12games.com/dwarves/"
|
|
|
|
livecheck do
|
|
url "https://www.bay12games.com/dwarves/older_versions.html"
|
|
strategy :page_match do |page|
|
|
match = page.match(/href="df[._-]v?(\d+(?:_\d+)+)[._-]osx\.t/i)
|
|
next if match.blank?
|
|
|
|
"0.#{match[1].tr("_", ".")}"
|
|
end
|
|
end
|
|
|
|
# shim script (https://github.com/Homebrew/homebrew-cask/issues/18809)
|
|
shimscript = "#{staged_path}/df_osx/df.wrapper.sh"
|
|
binary shimscript, target: "dwarf-fortress"
|
|
|
|
preflight do
|
|
File.write shimscript, <<~EOS
|
|
#!/bin/sh
|
|
exec '#{staged_path}/df_osx/df' "$@"
|
|
EOS
|
|
end
|
|
|
|
uninstall_preflight do
|
|
if Dir.exist?("#{staged_path}/df_osx/data/save")
|
|
FileUtils.cp_r("#{staged_path}/df_osx/data/save", "/tmp/dwarf-fortress-save/")
|
|
end
|
|
end
|
|
|
|
caveats <<~EOS
|
|
During uninstall, your save data will be copied to /tmp/dwarf-fortress-save
|
|
EOS
|
|
end
|