Skip to content

Commit 3d30df4

Browse files
committed
small cargo improvements
1 parent 48d7030 commit 3d30df4

4 files changed

Lines changed: 27 additions & 37 deletions

File tree

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ version = "0.2.2"
1010
edition = "2021"
1111
rust-version = "1.86"
1212
license = "Apache-2.0"
13-
authors = ["Ilija Ljubicic"]
13+
authors = ["Ilija Ljubicic <iliya.ljubicic@gmail.com>"]
1414
description = "An agile Model-Based Systems Engineering (MBSE) framework designed to integrate with Git workflows"
15+
repository = "https://github.com/ilijaljubicic/ReqFlow"
16+
homepage = "https://github.com/ilijaljubicic/ReqFlow"
17+
documentation = "https://github.com/ilijaljubicic/ReqFlow#readme"
1518

1619
[workspace.dependencies]
1720
clap = { version = "4.4", features = ["derive"] }

Makefile

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,17 @@
1-
# Set default version increment (major, minor, or patch)
2-
VERSION_INCREMENT ?= patch
1+
CARGO_TOML := Cargo.toml
32

4-
CARGO_TOML = Cargo.toml
3+
# Extract version from Cargo.toml
4+
define get_version
5+
$(shell grep -m1 '^version' $(CARGO_TOML) | sed 's/.*"\(.*\)".*/\1/')
6+
endef
57

6-
VERSION_FILE = version.tmp
8+
.PHONY: create_tag
79

8-
bump_version:
9-
@echo "Bumping version in Cargo.toml"
10-
# Bump version using cargo-release or manually (patch, minor, or major)
11-
cargo release $(VERSION_INCREMENT) --no-publish --no-verify
12-
13-
# Get the new version from the Cargo.toml
14-
NEW_VERSION=$(shell grep -oP 'version\s*=\s*"\K[0-9\.]+' $(CARGO_TOML))
15-
16-
# Display new version
17-
@echo "New version: $(NEW_VERSION)"
18-
19-
# Create a Git tag based on the bumped version
20-
create_tag: bump_version
21-
@echo "Creating Git tag for version $(NEW_VERSION)"
22-
git tag -a v$(NEW_VERSION) -m "Release version v$(NEW_VERSION)"
23-
git push origin v$(NEW_VERSION)
24-
25-
# Default target to bump the version and create a tag for patch
26-
release_patch: bump_patch create_tag
27-
@echo "Release created with version $(NEW_VERSION) and tag v$(NEW_VERSION)"
28-
29-
# Default target to bump the version and create a tag for minor
30-
release_minor: bump_minor create_tag
31-
@echo "Release created with version $(NEW_VERSION) and tag v$(NEW_VERSION)"
32-
33-
# Default target to bump the version and create a tag for major
34-
release_major: bump_major create_tag
35-
@echo "Release created with version $(NEW_VERSION) and tag v$(NEW_VERSION)"
10+
create_tag:
11+
@echo "Creating tag..."
12+
$(eval VERSION := $(call get_version))
13+
@echo "New version: $(VERSION)"
14+
git tag -a v$(VERSION) -m "Release version v$(VERSION)"
15+
git push origin v$(VERSION)
3616

3717

cli/Cargo.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
[package]
2-
name = "reqflow-cli"
2+
name = "cli"
33
version.workspace = true
44
edition.workspace = true
55
description.workspace = true
66
license.workspace = true
7+
authors.workspace = true
8+
repository.workspace = true
9+
homepage.workspace = true
10+
documentation.workspace = true
711

812
[[bin]]
913
name = "reqflow"
1014
path = "src/main.rs"
1115

1216
[dependencies]
13-
reqflow = { workspace = true }
17+
reqflow = { workspace = true, version.workspace = true }
1418

1519
# CLI
1620
clap = { workspace = true }
@@ -33,4 +37,4 @@ globset = { workspace = true }
3337
[dev-dependencies]
3438
assert_fs = { workspace = true }
3539
predicates = { workspace = true }
36-
tempfile = { workspace = true }
40+
tempfile = { workspace = true }

core/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ version.workspace = true
44
edition.workspace = true
55
description.workspace = true
66
license.workspace = true
7+
repository.workspace = true
8+
homepage.workspace = true
9+
documentation.workspace = true
710

811
[dependencies]
912
# Parsing and content manipulation
@@ -41,4 +44,4 @@ termcolor = { workspace = true }
4144
[dev-dependencies]
4245
assert_fs = { workspace = true }
4346
predicates = { workspace = true }
44-
tempfile = { workspace = true }
47+
tempfile = { workspace = true }

0 commit comments

Comments
 (0)