generated from nogibjj/Rewriting-a-Python-Script-in-Rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (61 loc) · 1.94 KB
/
Makefile
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
# Display Rust command-line utility versions
rust-version:
@echo "Rust command-line utility versions:"
rustc --version # Rust compiler
cargo --version # Rust package manager
rustfmt --version # Rust code formatter
rustup --version # Rust toolchain manager
clippy-driver --version # Rust linter
# Format code using rustfmt
format:
cargo fmt --quiet
# Run clippy for linting
lint:
cargo clippy --quiet
# Run tests
test:
cargo test --quiet
# Build and run the project
run:
cargo run
# Build release version
release:
cargo build --release
# Install Rust toolchain if needed
install:
# Install if needed
# @echo "Updating rust toolchain"
# rustup update stable
# rustup default stable
# Run all formatting, linting, and testing tasks
all: format lint test run
# Custom tasks
# Extract data
extract:
cargo run extract
# Transform and Load data
transform_load:
cargo run transform_load
# Create a database entry
create:
cargo run query "INSERT INTO baskin_icecream (Flavour, Calories, Total_Fat_g, Trans_Fat_g, Carbohydrates_g, Sugars_g , Protein_g, Size) VALUES (Butterscotch',155,8.5,0.3,20,12,3.5,kids70g);"
# Read from the database
read:
cargo run query "SELECT * FROM baskin_icecream WHERE Flavour='Vanilla';"
# Update a database entry
update:
cargo run query "UPDATE baskin_icecream SET Flavour='Rainbow Sherbet',Calories=135,Total_Fat_g=2.0,Trans_Fat_g=0.1,Carbohydrates_g=22,Sugars_g=20,Protein_g=1.0,Size='kids70g' WHERE Flavour='Rainbow Sherbet';"
# Delete a database entry
delete:
cargo run query "DELETE FROM baskin_icecream WHERE Calories=160;"
# Generate and push changes to GitHub
generate_and_push:
@if [ -n "$$(git status --porcelain)" ]; then \
git config --local user.email "[email protected]"; \
git config --local user.name "GitHub Action"; \
git add .; \
git commit -m "Add query log"; \
git push; \
else \
echo "No changes to commit. Skipping commit and push."; \
fi