homebrew-core/Formula/dungeon.rb

44 lines
1.5 KiB
Ruby

class Dungeon < Formula
desc "The classic text adventure"
homepage "https://github.com/GOFAI/dungeon"
url "https://github.com/GOFAI/dungeon/archive/4.1.tar.gz"
sha256 "b88c49ef60e908e8611257fbb5a6a41860e1058760df2dfcb7eb141eb34e198b"
revision 1
bottle do
cellar :any
sha256 "86edc8b6eeb85a1353d82543859f1e9ac70f8f602dd6cb7d7607741f8a23d74b" => :catalina
sha256 "7f797732836ef54d4ae987eeecdc12a195eb9f00dd6f145728a2ab9ce819f520" => :mojave
sha256 "9ebda679eabb0f65ba172887d2f271c897abd4faeb2b8f0863b024bea4112865" => :high_sierra
end
depends_on "gcc" # for gfortran
def install
chdir "src" do
# look for game files where homebrew installed them, not pwd
inreplace "game.f" do |s|
s.gsub! "FILE='dindx',STATUS='OLD',", "FILE='#{opt_pkgshare}/dindx',"
s.gsub! "1\tFORM='FORMATTED',ACCESS='SEQUENTIAL',ERR=1900)", "1\tSTATUS='OLD',FORM='FORMATTED',
\t2\tACCESS='SEQUENTIAL',ERR=1900)"
s.gsub! "FILE='dtext',STATUS='OLD',", "FILE='#{opt_pkgshare}/dtext',"
s.gsub! "1\tFORM='UNFORMATTED',ACCESS='DIRECT',", "1\tSTATUS='OLD',FORM='UNFORMATTED',ACCESS='DIRECT',"
end
system "make"
bin.install "dungeon"
end
pkgshare.install "dindx"
pkgshare.install "dtext"
man.install "dungeon.txt"
man.install "hints.txt"
end
test do
require "open3"
Open3.popen3("#{bin}/dungeon") do |stdin, stdout, _|
stdin.close
assert_match " Welcome to Dungeon.\t\t\t", stdout.read
end
end
end