Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store the version string in a single place #181

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/linux_and_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,10 @@ jobs:
################################################################
EOF

eval `grep ^VERSION Makefile | tr -d ' '`
sed "s/@VERSION@/$VERSION/" recordings/template.txt > recordings/expected.txt
diff -u recordings/{expected,actual}.txt
rm -f recordings/actual.txt
rm -f recordings/{expected,actual}.txt

- name: 'Clean'
env:
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
VERSION = 1.6.5
DESTDIR ?=
PREFIX ?= /usr/local
MANPREFIX ?= $(PREFIX)/man
CPPFLAGS += -DVERSION_STR='"$(VERSION)"'
CFLAGS += -Wall -Wextra
CFLAGS += `pkg-config --cflags ncursesw`
LDLIBS += `pkg-config --libs ncursesw` -lm
Expand All @@ -22,6 +24,6 @@ clean:

.c:
@pkg-config --version > /dev/null
$(CC) $(CFLAGS) $(LDFLAGS) $< $(LDLIBS) -o $@
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $< $(LDLIBS) -o $@

.PHONY: all clean install uninstall
7 changes: 4 additions & 3 deletions recordings/get_back_in_sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ fi

./record.sh

cp actual.txt expected.txt
eval `grep ^VERSION ../Makefile | tr -d ' '` # get the version number
sed "s/$VERSION/@VERSION@/" actual.txt > template.txt

git add expected.txt
git add template.txt

if git diff --cached --exit-code >/dev/null ; then
echo 'Already in sync, good.'
else
EDITOR=true git commit -m 'recordings: Sync expected.txt'
EDITOR=true git commit -m 'recordings: Sync template.txt'
fi
6 changes: 3 additions & 3 deletions recordings/expected.txt → recordings/template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
| │ |
| └─────────────────────────────────────────────────────────────────────────────────────> |
| X Thu Jan 1 00:00:00 1970 |
|   https://github.com/tenox7/ttyplot 1.6.5 |
|   https://github.com/tenox7/ttyplot @VERSION@ |
+------------------------------------------------------------------------------------------+

[90x20] Frame 2:
Expand All @@ -43,7 +43,7 @@
| │ XX |
| └─────────────────────────────────────────────────────────────────────────────────────> |
| X last=3.0 min=1.0 max=3.0 avg=2.0 Thu Jan 1 00:00:00 1970 |
|   last=4.0 min=2.0 max=4.0 avg=3.0 https://github.com/tenox7/ttyplot 1.6.5 |
|   last=4.0 min=2.0 max=4.0 avg=3.0 https://github.com/tenox7/ttyplot @VERSION@ |
+------------------------------------------------------------------------------------------+

[90x20] Frame 3:
Expand All @@ -67,6 +67,6 @@
| │ XX |
| └─────────────────────────────────────────────────────────────────────────────────────> |
| X last=3.0 min=1.0 max=3.0 avg=2.0 Thu Jan 1 00:00:00 1970 |
|   last=4.0 min=2.0 max=4.0 avg=3.0 https://github.com/tenox7/ttyplot 1.6.5 |
|   last=4.0 min=2.0 max=4.0 avg=3.0 https://github.com/tenox7/ttyplot @VERSION@ |
+------------------------------------------------------------------------------------------+

7 changes: 0 additions & 7 deletions ttyplot.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,6 @@
#include <err.h>
#endif

#define STR_(x) #x
#define STR(x) STR_(x)
#define VERSION_MAJOR 1
#define VERSION_MINOR 6
#define VERSION_PATCH 5
#define VERSION_STR STR(VERSION_MAJOR) "." STR(VERSION_MINOR) "." STR(VERSION_PATCH)

#define T_RARR '>'
#define T_UARR '^'
#ifdef NOACS
Expand Down