Skip to content

Commit

Permalink
diary 0.15 (new formula)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
in0rdr and nandahkrishna committed Jan 21, 2025
1 parent e901abd commit 493a07b
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Formula/d/diary.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
class Diary < Formula
desc "Text-based journaling program"
homepage "https://diary.p0c.ch"
url "https://code.in0rdr.ch/diary/archive/diary-v0.15.tar.gz"
sha256 "51103df0ddb33a1e86bb85e435ba7b7a5ba464ce49234961ca3e3325cd123d4c"
license "MIT"

livecheck do
url "https://code.in0rdr.ch/diary/archive/"
regex(/href=.*?diary[._-]v?(\d+(?:\.\d+)+)\.t/i)
end

depends_on "pkgconf" => :build

uses_from_macos "curl"
uses_from_macos "libxml2"
uses_from_macos "ncurses"

def install
system "make"
system "make", "CC=#{ENV.cc}", "PREFIX=#{prefix}", "install"
end

test do
# Test version output matches the packaged version
assert_match version.to_s, shell_output("#{bin}/diary -v")

# There is only one configuration setting which is required to start the
# application, the diary directory.
#
# Test DIARY_DIR environment variable
assert_match "The directory 'na' does not exist", shell_output("DIARY_DIR=na #{bin}/diary 2>&1", 2)
# Test diary dir option
assert_match "The directory 'na' does not exist", shell_output("#{bin}/diary -d na 2>&1", 2)
# Test missing diary dir option
assert_match "The diary directory must be provided as (non-option) arg, " \
"`--dir` arg,\nor in the DIARY_DIR environment variable, " \
"see `diary --help` or DIARY(1)\n", shell_output("#{bin}/diary 2>&1", 1)
end
end

0 comments on commit 493a07b

Please sign in to comment.