Skip to content

Commit

Permalink
[feat]! Relative_dir support added
Browse files Browse the repository at this point in the history
Signed-off-by: Shinyzenith <aakashsensharma@gmail.com>
  • Loading branch information
Shinyzenith committed Oct 2, 2022
1 parent b1a91c3 commit d7bc6a7
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 66 deletions.
20 changes: 4 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Sniff
name: CI

on: [push]

Expand All @@ -13,24 +13,12 @@ jobs:
contents: write

steps:
- uses: actions/checkout@v2

- name: Version tag.
run: echo "VERSION=$(grep -E '^version' ./Cargo.toml| sed 's/version = \"\(.*\)\"/\1/g')">>$GITHUB_ENV
- name: Checkout
uses: actions/checkout@v2

- name: Compile Binary.
- name: Build
run: cargo build --release --verbose

- name: Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{ env.VERSION }}
prerelease: true
title: "Sniff ${{ env.VERSION }}"
files: |
target/release/sniff
rustfmt:
runs-on: ubuntu-latest

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/target
*.gz
*.out
23 changes: 11 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[package]
name = "sniff"
version = "0.1.0"
version = "1.0.0"
authors = [
"Shinyzenith <aakashsensharma@gmail.com>",
]
edition = "2021"

[build-dependencies]
Expand All @@ -11,7 +14,6 @@ env_logger = "0.9.0"
libc = "0.2.124"
log = "0.4.16"
notify = "4.0.17"
regex = "1.5.5"
serde_json = "1.0.79"
serde = {version="1.0.137", features=["derive"]}

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ clean:

install:
@find ./docs -type f -iname "*.1.gz" -exec cp {} $(MAN1_DIR) \;
@find ./docs -type f -iname "*.5.gz" -exec cp {} $(MAN7_DIR) \;
@find ./docs -type f -iname "*.5.gz" -exec cp {} $(MAN5_DIR) \;
@mkdir -p $(TARGET_DIR)
@cp $(SOURCE_DIR)/$(BINARY) $(TARGET_DIR)
@chmod +x $(TARGET_DIR)/$(BINARY)
Expand Down
36 changes: 30 additions & 6 deletions docs/sniff.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,44 @@ Sniff uses the JSON file format. Configuration files should always be named *sni
# SYNTAX


All JSON keys apart from the following are treated as regular expressions to
check for file changes:
All JSON keys apart from the following are treated as patterns to check for file changes:
- _sniff_ignore_dir_ (Make sniff ignore directories.)
- _sniff_ignore_file_ (Make sniff ignore files.)
- _sniff_cooldown_ (State the cooldown between consecutive build commands.)

Each pattern check can either be an object or an array.
- If the pattern check if an array then the commands in it are executed.
- If the pattern check is an object then the following keys are searched for:
- "commands": The array of commands to execute.
- "relative_dir": The directory relative to which the commands should be executed.

# EXAMPLE

```
{
".*.rs": ["cargo build --release"],
".*.zig": ["zig test .", "zig build"],
"sniff_ignore_dir": ["target"],
"sniff_ignore_file": ["test.rs"],
"zig": [
"make"
],
"c": {
"commands": [
"make"
],
"relative_dir": "./nextctl"
},
"rs": {
"commands": [
"cargo clippy",
"cargo build --release"
],
"relative_dir": "./nextctl-rs"
},
"sniff_ignore_dir": [
"zig-out",
"zig-cache",
".git",
"target"
],
"sniff_ignore_file": [],
"sniff_cooldown": 650
}
```
Expand Down
10 changes: 8 additions & 2 deletions sniff.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
".*.rs": ["cargo clippy", "cargo build --release"],
"sniff_ignore_dir": ["target"],
"rs": [
"cargo clippy",
"cargo build --release"
],
"sniff_ignore_dir": [
"target",
".git"
],
"sniff_ignore_file": [],
"sniff_cooldown": 650
}
Loading

0 comments on commit d7bc6a7

Please sign in to comment.