Skip to content
Merged
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
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ dev:
build:
cargo build --release

# Install the release build with its icon and launcher entry under ~/.local
# Install the release build with its icon, launcher entry and hourly backup timer under ~/.local
install-local: build
install -Dm755 target/release/chelete $(HOME)/.local/bin/chelete
install -Dm644 assets/icons/[email protected] $(HOME)/.local/share/icons/hicolor/256x256/apps/chelete.png
install -Dm644 assets/chelete.desktop $(HOME)/.local/share/applications/chelete.desktop
install -Dm755 scripts/chelete-backup $(HOME)/.local/bin/chelete-backup
install -Dm644 assets/systemd/chelete-backup.service $(HOME)/.config/systemd/user/chelete-backup.service
install -Dm644 assets/systemd/chelete-backup.timer $(HOME)/.config/systemd/user/chelete-backup.timer
-systemctl --user daemon-reload
-systemctl --user enable --now chelete-backup.timer
-gtk-update-icon-cache -q $(HOME)/.local/share/icons/hicolor
-update-desktop-database $(HOME)/.local/share/applications

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ The UI tests run the real screens headlessly with simulated keystrokes, so they
make build # cargo build --release
```

## Backups

`make install-local` also installs a systemd user timer that dumps the database to `~/Documents/chelete/backup.json` every hour (needs `sqlite3` and `jq`). Check it with `systemctl --user list-timers chelete-backup`.

## Usage

```bash
Expand Down
16 changes: 6 additions & 10 deletions assets/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icons/128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icons/32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icons/icon.icns
Binary file not shown.
Binary file modified assets/icons/icon.ico
Binary file not shown.
6 changes: 6 additions & 0 deletions assets/systemd/chelete-backup.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Unit]
Description=Back up Chelete to ~/Documents/chelete/backup.json

[Service]
Type=oneshot
ExecStart=%h/.local/bin/chelete-backup
9 changes: 9 additions & 0 deletions assets/systemd/chelete-backup.timer
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Unit]
Description=Back up Chelete every hour

[Timer]
OnCalendar=hourly
Persistent=true

[Install]
WantedBy=timers.target
14 changes: 14 additions & 0 deletions scripts/chelete-backup
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# Dump the Chelete database to ~/Documents/chelete/backup.json.
set -euo pipefail
db="$HOME/.local/share/com.chelete.app/chelete.db"
out="$HOME/Documents/chelete/backup.json"
mkdir -p "$(dirname "$out")"
tmp="$out.tmp"
dump() { sqlite3 -readonly -json "$db" "SELECT * FROM $1" | jq -c '. // []' ; }
jq -n --argjson accounts "$(dump accounts)" \
--argjson categories "$(dump categories)" \
--argjson transactions "$(dump transactions)" \
--argjson subscriptions "$(dump subscriptions)" \
'{accounts: $accounts, categories: $categories, transactions: $transactions, subscriptions: $subscriptions}' > "$tmp"
mv "$tmp" "$out"
6 changes: 3 additions & 3 deletions src/ui/widgets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ pub fn submit_on_enter<V: 'static>(

pub const ELEMENT_NUMBER: &str = "17";
pub const ELEMENT_SYMBOL: &str = "Ch";
pub const ELEMENT_NAME: &str = "Chlorine";
pub const ELEMENT_NAME: &str = "Chelete";
pub const ELEMENT_MASS: &str = "35.45";

/// How much of the element tile to draw.
Expand Down Expand Up @@ -465,10 +465,10 @@ mod logo_tests {
use super::*;

#[test]
fn the_tile_reads_17_ch_chlorine() {
fn the_tile_reads_17_ch_chelete() {
assert_eq!(ELEMENT_NUMBER, "17");
assert_eq!(ELEMENT_SYMBOL, "Ch");
assert_eq!(ELEMENT_NAME, "Chlorine");
assert_eq!(ELEMENT_NAME, "Chelete");
assert_eq!(ELEMENT_MASS, "35.45");
}
}
Loading