Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Navid Yaghoobi <[email protected]>
  • Loading branch information
navidys committed Jun 30, 2024
1 parent 803b1e4 commit 4fa6fb8
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ A clear and concise description of what the problem is.
A clear and concise description of what you want to happen.

**Additional context**
Add any other context or screenshots about the feature request here.
Add any other context or screenshots about the feature request here.
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
stale-pr-label: 'stale-pr'
days-before-stale: 30
days-before-close: 365
remove-stale-when-updated: true
remove-stale-when-updated: true
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ repos:
- id: mixed-line-ending
- id: check-byte-order-marker
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-merge-conflict
2 changes: 1 addition & 1 deletion FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ Supported Features
* `/sys/devices/system/`
*`clocksource/clocksource<X>`
* `available_clocksource`
* `current_clocksource`
* `current_clocksource`
47 changes: 42 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,61 @@ CRATE_VERSION ?= $(shell grep ^version Cargo.toml | awk '{print $$3}')
# Set path to cargo executable
CARGO ?= cargo

PKG_MANAGER ?= $(shell command -v dnf yum|head -n1)
PRE_COMMIT = $(shell command -v bin/venv/bin/pre-commit ~/.local/bin/pre-commit pre-commit | head -n1)

#=================================================
# Testing and validation
#=================================================

.PHONY: validate
validate: $(CARGO_TARGET_DIR) ## Validate code
$(CARGO) fmt --all -- --check
$(CARGO) clippy -p procsys@$(CRATE_VERSION) -- -D warnings

.PHONY: clean
clean: ## Cleanup
rm -rf target

.PHONY: test
test: $(CARGO_TARGET_DIR) ## Run unit tests
$(CARGO) test

.PHONY: pre-commit
pre-commit: ## Run pre-commit
ifeq ($(PRE_COMMIT),)
@echo "FATAL: pre-commit was not found, make .install.pre-commit to installing it." >&2
@exit 2
endif
$(PRE_COMMIT) run -a

.PHONY: codespell
codespell: ## Run codespell
@echo "running codespell"
@codespell -S ./target,./targets -L crate


.PHONY: clean
clean: ## Cleanup
rm -rf target

#=================================================
# Required tools installation tartgets
#=================================================

.PHONY: install.tools
install.tools: .install.pre-commit .install.codespell ## Install needed tools

.PHONY: .install.pre-commit
.install.pre-commit:
if [ -z "$(PRE_COMMIT)" ]; then \
python3 -m pip install --user pre-commit; \
fi

.PHONY: .install.codespell
.install.codespell:
sudo ${PKG_MANAGER} -y install codespell

#=================================================
# Help menu
#=================================================

_HLP_TGTS_RX = '^[[:print:]]+:.*?\#\# .*$$'
_HLP_TGTS_CMD = grep -E $(_HLP_TGTS_RX) $(MAKEFILE_LIST)
_HLP_TGTS_LEN = $(shell $(_HLP_TGTS_CMD) | cut -d : -f 1 | wc -L)
Expand All @@ -32,4 +69,4 @@ help: ## Print listing of key targets with their descriptions
@printf $(_HLPFMT) "--------------" "--------------------"
@$(_HLP_TGTS_CMD) | sort | \
awk 'BEGIN {FS = ":(.*)?## "}; \
{printf $(_HLPFMT), $$1, $$2}'
{printf $(_HLPFMT), $$1, $$2}'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ Licensed under the [MIT License](https://github.com/navidys/procsys/blob/main/LI
[img_doc]: https://img.shields.io/badge/rust-documentation-blue.svg

[crates]: https://crates.io/crates/procsys
[doc]: https://docs.rs/procsys/
[doc]: https://docs.rs/procsys/

0 comments on commit 4fa6fb8

Please sign in to comment.