Connect applications to schemes, filetypes, and more on macOS (more to come)
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

justfile formatting

+47 -50
+47 -50
justfile
··· 1 1 #!/usr/bin/env just 2 - 2 + 3 3 # --- Settings --- # 4 4 set shell := ["nu", "-c"] 5 5 set positional-arguments := true ··· 8 8 set dotenv-load := true 9 9 10 10 # --- Variables --- # 11 - project_root := justfile_directory() 11 + project_root := justfile_directory() 12 12 output_directory := project_root + "/dist" 13 13 build_directory := `cargo metadata --format-version 1 | jq -r .target_directory` 14 - 15 14 system := `rustc --version --verbose | grep '^host:' | awk '{print $2}'` 16 - main_package := "infat" 15 + main_package := "infat" 17 16 18 17 # ▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰ # 19 18 # Recipes # 20 19 # ▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰ # 21 - 20 + 22 21 [doc('List all available recipes')] 23 22 default: 24 23 @just --list ··· 34 33 [group('build')] 35 34 build target="aarch64-apple-darwin" package=(main_package): 36 35 @echo "🔨 Building workspace (debug)..." 37 - cargo build --workspace --bin '{{main_package}}' --target '{{target}}' 36 + cargo build --workspace --bin '{{ main_package }}' --target '{{ target }}' 38 37 39 38 [doc('Build workspace in release mode')] 40 39 [group('build')] 41 40 build-release target=(system) package=(main_package): 42 - @echo "🚀 Building workspace (release) for {{target}}…" 43 - cargo build --workspace --release --bin '{{main_package}}' --target '{{target}}' 41 + @echo "🚀 Building workspace (release) for {{ target }}…" 42 + cargo build --workspace --release --bin '{{ main_package }}' --target '{{ target }}' 44 43 45 44 # --- Packaging --- # 46 45 [doc('Package release binary with completions for distribution')] ··· 60 59 print "📦 Packaging release binary…" 61 60 62 61 63 - let target = '{{target}}' 64 - let prime = '{{main_package}}' 65 - let out = "{{output_directory}}" 66 - let artifact_dir = $'{{build_directory}}/($target)/release' 62 + let target = '{{ target }}' 63 + let prime = '{{ main_package }}' 64 + let out = "{{ output_directory }}" 65 + let artifact_dir = $'{{ build_directory }}/($target)/release' 67 66 68 67 try { 69 68 just build-release $target ··· 75 74 76 75 # Example: package-triplet 77 76 let qualified_name = $"($prime)-($target)" 78 - 77 + 79 78 let bin_path = $'($artifact_dir)/($prime)($ext)' # Where rust puts the binary artifact 80 79 let out_path = $'($out)/($qualified_name)($ext)' 81 80 ··· 92 91 for completion in $completions { 93 92 let src = $'($artifact_dir)/($completion)' 94 93 let dst = $'($out)/($completion)' 95 - 94 + 96 95 if ($src | path exists) { 97 96 try { 98 97 cp --force $src $dst # Using force here because default nu copy only works with existing files otherwise ··· 112 111 } catch { |e| 113 112 build_error $"Failed to copy binary ($bin_path)" $e 114 113 } 115 - 114 + 116 115 } catch { |e| 117 116 build_error "Packaging failed" $e 118 117 } ··· 131 130 exit 1 132 131 } 133 132 } 134 - 135 - let dir = '{{directory}}' 133 + 134 + let dir = '{{ directory }}' 136 135 print $"🔒 Generating checksums in '($dir)'…" 137 136 138 137 # Validate directory exists ··· 142 141 143 142 try { 144 143 cd $dir 145 - 144 + 146 145 # Remove existing checksum files 147 146 try { 148 147 glob '*.sum' | each { |file| rm $file } ··· 196 195 } 197 196 198 197 print $"✅ Checksums created in '($dir)'" 199 - 198 + 200 199 } catch {|e| 201 200 build_error $"Checksum generation failed" $e 202 201 } ··· 215 214 exit 1 216 215 } 217 216 } 218 - 217 + 219 218 print "🗜️ Compressing release packages..." 220 - 221 - let dir = '{{directory}}' 219 + 220 + let dir = '{{ directory }}' 222 221 if not ($dir | path exists) { 223 222 build_error $"Directory '($dir)' does not exist" 224 223 } ··· 226 225 try { 227 226 # Find all package directories 228 227 mut package_dirs = ls $dir | where type == dir | get name 229 - 228 + 230 229 if (($package_dirs | length) == 0) { 231 230 # Just one package found to compress 232 231 $package_dirs = ($package_dirs | append $dir) ··· 235 234 for pkg_dir in $package_dirs { 236 235 let pkg_name = ($pkg_dir | path basename) 237 236 print $"🎁 Compressing package: ($pkg_name)" 238 - 237 + 239 238 try { 240 239 let parent_dir = ($pkg_dir | path dirname) 241 240 let archive_name = $'($pkg_dir).tar.gz' 242 - 241 + 243 242 # Use tar command to create compressed archive 244 243 let result = (run-external 'tar' '-czf' $archive_name '-C' $parent_dir $pkg_name | complete) 245 - 244 + 246 245 if $result.exit_code != 0 { 247 246 build_error $"Failed to create archive for ($pkg_name): ($result.stderr)" 248 247 } 249 - 248 + 250 249 print $"✅ Successfully compressed ($pkg_name)" 251 - 250 + 252 251 } catch { |e| 253 252 build_error $"Compression failed for ($pkg_name)" $e 254 253 } 255 254 } 256 - 255 + 257 256 print "🎉 All packages compressed successfully!" 258 - 257 + 259 258 } catch { |e| 260 259 build_error $"Compression process failed" $e 261 260 } ··· 269 268 [doc('Run application in debug mode')] 270 269 [group('execution')] 271 270 run package=(main_package) +args="": 272 - @echo "▶️ Running {{package}} (debug)..." 273 - cargo run --bin '{{package}}' -- '$@' 271 + @echo "▶️ Running {{ package }} (debug)..." 272 + cargo run --bin '{{ package }}' -- '$@' 274 273 275 274 [doc('Run application in release mode')] 276 275 [group('execution')] 277 276 run-release package=(main_package) +args="": 278 - @echo "▶️ Running '{{package}}' (release)..." 279 - cargo run --bin '{{package}}' --release -- '$@' 277 + @echo "▶️ Running '{{ package }}' (release)..." 278 + cargo run --bin '{{ package }}' --release -- '$@' 280 279 281 280 # --- Testing --- # 282 281 [doc('Run all workspace tests')] 283 282 [group('testing')] 284 - test: 283 + test: 285 284 @echo "🧪 Running workspace tests..." 286 285 cargo test --workspace 287 286 288 287 [doc('Run workspace tests with additional arguments')] 289 288 [group('testing')] 290 - test-with +args: 289 + test-with +args: 291 290 @echo "🧪 Running workspace tests with args: '$@'" 292 291 cargo test --workspace -- '$@' 293 292 ··· 297 296 fmt: 298 297 @echo "💅 Formatting Rust code..." 299 298 cargo fmt 300 - 301 299 302 300 [doc('Check if Rust code is properly formatted')] 303 301 [group('quality')] 304 302 fmt-check: 305 303 @echo "💅 Checking Rust code formatting..." 306 304 cargo fmt 307 - 308 305 309 306 [doc('Lint code with Clippy in debug mode')] 310 307 [group('quality')] ··· 346 343 exit 1 347 344 } 348 345 } 349 - 350 - let tag_v = '{{raw_tag}}' 346 + 347 + let tag_v = '{{ raw_tag }}' 351 348 let tag = ($tag_v | str replace --regex '^v' '') # Remove prefix v 352 - let outfile = '{{outfile}}' 353 - let changelog_file = '{{changelog}}' 349 + let outfile = '{{ outfile }}' 350 + let changelog_file = '{{ changelog }}' 354 351 355 352 try { 356 353 # Verify changelog exists ··· 366 363 # Read and process changelog 367 364 let content = (open $changelog_file | lines) 368 365 let section_header = $"## [($tag)]" 369 - 366 + 370 367 # Find the start of the target section 371 368 let start_idx = ($content | enumerate | where item == $section_header | get index | first) 372 - 369 + 373 370 if ($start_idx | is-empty) { 374 371 build_error $"Could not find section header ($section_header) in ($changelog_file)" 375 372 } ··· 377 374 # Find the end of the target section (next ## [ header) 378 375 let remaining_lines = ($content | skip ($start_idx + 1)) 379 376 let next_section_idx = ($remaining_lines | enumerate | where item =~ '^## \[' | get index | first) 380 - 377 + 381 378 let section_lines = if ($next_section_idx | is-empty) { 382 379 $remaining_lines 383 380 } else { ··· 414 411 # --- Installation --- # 415 412 [doc('Build and install binary to system')] 416 413 [group('installation')] 417 - install package=(main_package): build-release 418 - @echo "💾 Installing {{main_package}} binary..." 419 - cargo install --bin '{{package}}' 414 + install package=(main_package): build-release 415 + @echo "💾 Installing {{ main_package }} binary..." 416 + cargo install --bin '{{ package }}' 420 417 421 418 [doc('Force install binary')] 422 419 [group('installation')] 423 420 install-force package=(main_package): build-release 424 - @echo "💾 Force installing {{main_package}} binary..." 425 - cargo install --bin '{{package}}' --force 421 + @echo "💾 Force installing {{ main_package }} binary..." 422 + cargo install --bin '{{ package }}' --force 426 423 427 424 # --- Aliases --- # 428 425 alias b := build