runarium 0.1.0

Generate animated videos from GPS running/cycling data with real-time statistics
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# Runarium - Command Reference

Quick reference for all commands related to developing and using Runarium.

## ๐Ÿ“ฆ For Library Users

### Installation
```bash
# Add to existing project
cargo add runarium

# Or manually add to Cargo.toml
echo 'runarium = "0.1.0"' >> Cargo.toml
```

### Running Examples
```bash
# Generate video
cargo run --example video_config --release

# Generate static image
cargo run --example image_config --release
```

### Building Your Project
```bash
# Development build (slow, with debug info)
cargo build

# Release build (fast, optimized)
cargo build --release

# Run your code
cargo run --release
```

## ๐Ÿ› ๏ธ For Library Developers

### Development
```bash
# Check code compiles
cargo check

# Run tests
cargo test

# Run with warnings
cargo clippy

# Format code
cargo fmt

# Build documentation
cargo doc --open

# Clean build artifacts
cargo clean
```

### Examples Development
```bash
# Run specific example
cargo run --example video_config

# List all examples
ls examples/

# Build all examples
cargo build --examples
```

### Testing Before Publish
```bash
# Dry run publish
cargo publish --dry-run

# List files that will be published
cargo package --list

# Build the package
cargo package

# Test package locally
cd target/package/runarium-0.1.0
cargo build
```

### Publishing
```bash
# Login to crates.io (once)
cargo login <your-api-token>

# Publish to crates.io
cargo publish

# Yank a version if needed
cargo yank --vers 0.1.0

# Un-yank
cargo yank --vers 0.1.0 --undo
```

### Version Management
```bash
# Update version in Cargo.toml, then:
git add Cargo.toml
git commit -m "Bump version to 0.1.1"
git tag -a v0.1.1 -m "Release v0.1.1"
git push origin main
git push origin v0.1.1
cargo publish
```

## ๐Ÿ”ง Environment Setup

### macOS - Initial Setup
```bash
# Install dependencies
brew install opencv llvm

# Configure environment (add to ~/.zshrc)
cat >> ~/.zshrc << 'EOF'
export LIBCLANG_PATH="/opt/homebrew/opt/llvm/lib"
export SDKROOT="$(xcrun --show-sdk-path)"
export CPATH="$SDKROOT/usr/include"
export CPLUS_INCLUDE_PATH="$SDKROOT/usr/include/c++/v1:$SDKROOT/usr/include"
EOF

# Reload configuration
source ~/.zshrc
```

### Linux - Initial Setup
```bash
# Install dependencies
sudo apt-get update
sudo apt-get install libopencv-dev clang libclang-dev

# Configure environment (add to ~/.bashrc)
echo 'export LIBCLANG_PATH=/usr/lib/llvm-14/lib' >> ~/.bashrc
source ~/.bashrc
```

### Verify Setup
```bash
# Check OpenCV
pkg-config --modversion opencv4

# Check LLVM
llvm-config --version

# Check environment
echo $LIBCLANG_PATH
echo $SDKROOT
```

## ๐Ÿ“Š File Management

### Required Project Structure
```bash
# Create directories
mkdir -p source outputs

# Expected files
# source/example.fit    - Your GPS data
# source/map.png   - Background map
# outputs/         - Generated files (auto-created)
```

### File Operations
```bash
# List source files
ls -lh source/

# Check FIT file
file source/example.fit

# View map image info
file source/map.png

# Check outputs
ls -lh outputs/

# Play generated video (macOS)
open outputs/car.mp4

# Play generated video (Linux)
xdg-open outputs/car.mp4
```

## ๐Ÿงช Testing Commands

### Unit Tests
```bash
# Run all tests
cargo test

# Run specific test
cargo test test_name

# Run with output
cargo test -- --nocapture

# Run tests in release mode
cargo test --release
```

### Integration Tests
```bash
# Run examples as integration tests
cargo run --example generate_video
cargo run --example generate_image
cargo run --example custom_scaling
```

### Performance Testing
```bash
# Time execution
time cargo run --release

# With detailed metrics
cargo run --release 2>&1 | grep "execution"

# Memory usage (macOS)
/usr/bin/time -l cargo run --release

# Memory usage (Linux)
/usr/bin/time -v cargo run --release
```

## ๐Ÿ› Debugging

### Show Debug Output
```bash
# Set log level
RUST_LOG=debug cargo run

# Verbose build
cargo build -vv

# Show build script output
cargo clean && cargo build -vv 2>&1 | grep -A 20 "opencv"
```

### Common Fixes
```bash
# Fix formatting issues
cargo fmt

# Fix clippy warnings
cargo clippy --fix

# Update dependencies
cargo update

# Clean and rebuild
cargo clean && cargo build --release
```

## ๐Ÿ“ Documentation

### Generate Docs
```bash
# Build and open docs
cargo doc --open

# Build docs without dependencies
cargo doc --no-deps

# Build docs for all features
cargo doc --all-features
```

### README Examples
```bash
# Test README code examples
cargo readme > README_test.md
diff README.md README_test.md
```

## ๐Ÿ” Search and Inspect

### Dependency Info
```bash
# List dependencies
cargo tree

# Check for updates
cargo outdated

# Audit for security issues
cargo audit
```

### Code Statistics
```bash
# Count lines of code
find src -name "*.rs" | xargs wc -l

# Find TODO comments
grep -r "TODO" src/

# Find FIXME comments
grep -r "FIXME" src/
```

## ๐Ÿš€ Performance Optimization

### Profiling
```bash
# Build with profiling
cargo build --release

# Run with profiling (requires instruments on macOS)
instruments -t "Time Profiler" target/release/runarium

# Benchmark (if divan is configured)
cargo bench
```

### Build Optimization
```bash
# Parallel build
cargo build --release -j 8

# LTO (Link Time Optimization)
cargo rustc --release -- -C lto

# Target CPU
cargo rustc --release -- -C target-cpu=native
```

## ๐ŸŒ Git Operations

### Repository Management
```bash
# Clone repository
git clone https://github.com/JFKongphop/runarium.git
cd runarium

# Create feature branch
git checkout -b feature/new-feature

# Commit changes
git add .
git commit -m "Add new feature"

# Push to remote
git push origin feature/new-feature
```

### Release Process
```bash
# Create release
git checkout main
git pull
# Update version in Cargo.toml
git add Cargo.toml
git commit -m "Bump version to 0.2.0"
git tag -a v0.2.0 -m "Release version 0.2.0"
git push origin main
git push origin v0.2.0
```

## ๐Ÿ’พ Backup and Restore

### Backup Project
```bash
# Backup (excluding build artifacts)
tar -czf runarium-backup.tar.gz \
  --exclude='target' \
  --exclude='outputs' \
  runarium/
```

### Restore Project
```bash
# Restore from backup
tar -xzf runarium-backup.tar.gz
cd runarium
cargo build --release
```

## ๐ŸŽฏ Quick Actions

```bash
# New user getting started
brew install opencv llvm
cargo new my-project && cd my-project
cargo add runarium
cargo run --release

# Developer making changes
cargo check && cargo clippy && cargo test
git commit -am "Your changes"
git push

# Publishing new version
# 1. Update Cargo.toml version
# 2. Update CHANGELOG.md
cargo publish --dry-run
cargo publish
git tag -a v0.x.x -m "Release v0.x.x"
git push origin main --tags
```

## ๐Ÿ“ž Getting Help

```bash
# Cargo help
cargo --help
cargo build --help
cargo publish --help

# Check versions
cargo --version
rustc --version
opencv_version  # if installed

# Community
echo "Visit https://github.com/JFKongphop/runarium/issues"
```