Skip to content

Commit 493a07b

Browse files
in0rdrnandahkrishna
andcommitted
diary 0.15 (new formula)
diary: consistency with other livecheck blocks diary: fix brew style, tap syntax diary: assert shell stderr output diary: improve tests diary: update deps and livecheck Co-authored-by: Nanda H Krishna <[email protected]> Signed-off-by: Rui Chen <[email protected]>
1 parent e901abd commit 493a07b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Formula/d/diary.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
class Diary < Formula
2+
desc "Text-based journaling program"
3+
homepage "https://diary.p0c.ch"
4+
url "https://code.in0rdr.ch/diary/archive/diary-v0.15.tar.gz"
5+
sha256 "51103df0ddb33a1e86bb85e435ba7b7a5ba464ce49234961ca3e3325cd123d4c"
6+
license "MIT"
7+
8+
livecheck do
9+
url "https://code.in0rdr.ch/diary/archive/"
10+
regex(/href=.*?diary[._-]v?(\d+(?:\.\d+)+)\.t/i)
11+
end
12+
13+
depends_on "pkgconf" => :build
14+
15+
uses_from_macos "curl"
16+
uses_from_macos "libxml2"
17+
uses_from_macos "ncurses"
18+
19+
def install
20+
system "make"
21+
system "make", "CC=#{ENV.cc}", "PREFIX=#{prefix}", "install"
22+
end
23+
24+
test do
25+
# Test version output matches the packaged version
26+
assert_match version.to_s, shell_output("#{bin}/diary -v")
27+
28+
# There is only one configuration setting which is required to start the
29+
# application, the diary directory.
30+
#
31+
# Test DIARY_DIR environment variable
32+
assert_match "The directory 'na' does not exist", shell_output("DIARY_DIR=na #{bin}/diary 2>&1", 2)
33+
# Test diary dir option
34+
assert_match "The directory 'na' does not exist", shell_output("#{bin}/diary -d na 2>&1", 2)
35+
# Test missing diary dir option
36+
assert_match "The diary directory must be provided as (non-option) arg, " \
37+
"`--dir` arg,\nor in the DIARY_DIR environment variable, " \
38+
"see `diary --help` or DIARY(1)\n", shell_output("#{bin}/diary 2>&1", 1)
39+
end
40+
end

0 commit comments

Comments
 (0)