File tree 2 files changed +34
-7
lines changed
2 files changed +34
-7
lines changed Original file line number Diff line number Diff line change 1
- MACOS_TARGET = x86_64-apple-darwin
1
+ # Project Variables
2
+ BIN_NAME = redis-file-monitor
3
+ BUILD_DIR = target
4
+ TARGET_DIR = $(BUILD_DIR ) /release
2
5
3
- all : build-macos
6
+ # Build a release binary
7
+ build :
8
+ cargo build --release
4
9
5
- build-macos :
6
- cargo build --release --target $(MACOS_TARGET )
10
+ # Strip unneeded symbols to reduce size (Linux/macOS)
11
+ strip :
12
+ strip $(TARGET_DIR ) /$(BIN_NAME ) || echo " Skipping strip (unsupported on this OS)"
7
13
14
+ # Compress the binary using UPX (optional, requires UPX installed)
15
+ compress : build
16
+ upx --best --lzma $(TARGET_DIR ) /$(BIN_NAME ) || echo " UPX compression failed or not installed"
17
+
18
+ # Package the binary into a .tar.gz archive (Linux/macOS)
19
+ package : build strip
20
+ tar -czvf $(BIN_NAME ) .tar.gz -C $(TARGET_DIR ) $(BIN_NAME )
21
+
22
+ # Package the binary into a .zip archive (Windows)
23
+ package-win : build strip
24
+ zip -j $(BIN_NAME ) .zip $(TARGET_DIR ) /$(BIN_NAME ) .exe
25
+
26
+ # Clean up build artifacts
8
27
clean :
9
- cargo clean
28
+ cargo clean
29
+ rm -f $(BIN_NAME ) .tar.gz $(BIN_NAME ) .zip
30
+
31
+ # Run the program
32
+ run :
33
+ cargo run --release -- --watch-dir . --redis-cli redis-cli
34
+
35
+ # Test the project
36
+ test :
37
+ cargo test
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ use std::path::{Path, PathBuf};
6
6
use std:: process:: Command ;
7
7
use tokio:: runtime:: Runtime ;
8
8
use tracing:: { error, info, warn} ;
9
- use tracing_subscriber;
10
9
11
10
/// CLI Arguments
12
11
#[ derive( Parser , Debug ) ]
@@ -77,7 +76,7 @@ async fn watch_directory(dir: &Path, redis_cli: &str) -> Result<()> {
77
76
/// Processes file events
78
77
async fn process_events ( rx : & mut tokio:: sync:: mpsc:: Receiver < Event > , redis_cli : & str ) {
79
78
while let Some ( event) = rx. recv ( ) . await {
80
- if let Some ( path) = event. paths . get ( 0 ) {
79
+ if let Some ( path) = event. paths . first ( ) {
81
80
if let EventKind :: Modify ( notify:: event:: ModifyKind :: Data (
82
81
notify:: event:: DataChange :: Content ,
83
82
) ) = event. kind
You can’t perform that action at this time.
0 commit comments