Yet another fancy watcher. (Rust)

Overview

funzzy Build Status Crate version

Yet another fancy watcher. (Inspired by antr / entr)

Configure execution of different commands using semantic yaml.

# .watch.yaml
# list here all the events and the commands that it should execute
# TIP: include '.watch.yaml' in your .git/info/exclude to ignore it.

- name: run my tests
  run: make test
  change: 'tests/**'
  ignore: 'tests/integration/**'

- name: fast compile sass
  run: compass compile src/static/some.scss
  change: ['src/static/**', 'src/assets/*']

- name: Starwars
  run: telnet towel.blinkenlights.nl
  change: '.watch.yaml'

- name: say hello
  run: say hello
  change: '.watch.yaml'
  run_on_init: true

Motivation

Create a lightweight watcher to run my tests everytime something in my project change. So I won't forget to keep my tests passing. Funzzy was made with Rust that is why it consumes almost nothing to run.

Installing

  • OSX:
brew tap cristianoliveira/tap
brew update
brew install funzzy
  • Linux:
curl -s https://raw.githubusercontent.com/cristianoliveira/funzzy/master/linux-install.sh | sh
  • With Cargo
cargo install funzzy

*Make sure you have $HOME/.cargo/bin in your PATH export $PATH:$HOME/.cargo/bin

From source

Make sure you have installed the follow dependecies:

  • Rust

Clone this repo and do:

make install

Running

Initializing with boilerplate:

funzzy init

Change the yaml as you want. Then run:

funzzy watch

Run with some arbitrary command and stdin

find . -R '**.rs' | funzzy 'cargo build'

Run some arbitrary command in an interval of seconds

funzzy run 'cargo build' 10

Playground

It does not work between vm and host machine

If you wanna try without installing it in your machine, try the playground vagrant.

cd funzzy
vagrant up

# Testing
vagrant ssh -c "cd /vagrant && funzzy watch"

# Another shell
vagrant ssh -c "touch /vagrant/.watch.yaml"

It will take some time to be prepared.

Tests

Running tests:

cargo test

or simple make tests

Code Style

We use clippy for lintting the funzzy's source code. Make sure you had validate it before commit.

Contributing

  • Fork it!
  • Create your feature branch: git checkout -b my-new-feature
  • Commit your changes: git commit -am 'Add some feature'
  • Push to the branch: git push origin my-new-feature
  • Submit a pull request

Pull Requests are really welcome! Others support also.

Pull Request should have unit tests

License

This project was made under MIT License.

Comments
  • bug: watcher triggers the run multiple times for a single change

    bug: watcher triggers the run multiple times for a single change

    - name: run my tests
      run: make test
      change: ['src/**', 'test/**']
    

    I save the file on src/index.js and for some reason it runs the tests 5 times...

    opened by marceloboeira 4
  • chore: Add help option into Makefile

    chore: Add help option into Makefile

    Add the option to execute:

    > make help
    build                          Execute all the tests and build funzzy binary
    help                           Lists the available commands. Add a comment with '##' to describe a command.
    install                        Install funzzy on your machine
    tests                          Execute all the tests
    
    opened by cristianoliveira 1
  • init command will produce incorrect yaml file

    init command will produce incorrect yaml file

    run "funzzy init" and then run "funzzy watch" will get some error:

    thread 'main' panicked at 'Unable to load configuration: ScanError { mark: Marker { index: 179, line: 8, col: 2 }, info: "while parsing a block mapping, did not find expected key" }', ../src/libcore\result.rs:799 rc/cli/init.rs

    it seems the init command produce incorrect .watch.yaml file: run:'ls -a' should be run: 'ls -a' .

    opened by laizy 1
  • fix: homebrew  install

    fix: homebrew install

    Error: SHA256 mismatch Expected: b34ee2d8339a54f7edaf122394a5074ad9c77b554629560322f5fc70c29a6b39 Actual: 6cfce5267b639fc9d2ef4cbbe299e6c304e0984f1e73f6977debdad6f92af343 Archive: /Library/Caches/Homebrew/funzzy-0.3.0.tar.gz

    opened by cristianoliveira 1
  • fix: better message when yaml file has bad format.

    fix: better message when yaml file has bad format.

    Today when yaml has bad format we get this error:

    thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: ScanError { mark: Marker { index: 222, line: 10, col: 4 }, info: "while parsing a flow sequence, expectd \',\' or \']\'" }', ../src/libcore/result.rs:688
    

    We need a better error message.

    opened by cristianoliveira 1
  • feat: work with stdin

    feat: work with stdin

    Provide a way to funzzy works with stdout then will be possible to run like entr runs:

    ls -d * | funzzy sh -c 'make && make test'
    

    It could create the yaml file also.

    opened by cristianoliveira 1
  • feature: Introduce run_on_init flag

    feature: Introduce run_on_init flag

    Run the rule's commands once before when flag with "run_on_init".

    e.g.:

    • name: run my test run: 'make tests' change: 'src/**' run_on_init: true

    This would run the make tests once on start, even if nothing changed, and then start the watcher.

    The flag is set to false by default, if the key is not present on the yaml or if values can't be assumed.

    opened by marceloboeira 0
  • Style: fix warnings

    Style: fix warnings

    Today we have a bunch of warning that shows on the compilation. Would be nice to fix them.

    warning: unused import: `std::process::*;`
     --> src/cmd.rs:3:5
      |
    3 | use std::process::*;
      |     ^^^^^^^^^^^^^^^^
      |
      = note: #[warn(unused_imports)] on by default
    
    warning: unused extern crate
     --> src/lib.rs:4:1
      |
    4 | extern crate rustc_serialize;
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: #[warn(unused_extern_crates)] on by default
    
    warning: unused extern crate
     --> src/lib.rs:5:1
      |
    5 | extern crate docopt;
      | ^^^^^^^^^^^^^^^^^^^^
    
    warning: unused extern crate
     --> src/cli/watch.rs:2:1
      |
    2 | extern crate glob;
      | ^^^^^^^^^^^^^^^^^^
    
    warning: unused extern crate
     --> src/yaml.rs:2:1
      |
    2 | extern crate glob;
      | ^^^^^^^^^^^^^^^^^^
    
    warning: unused import: `std::process::*;`
     --> src/cmd.rs:3:5
      |
    3 | use std::process::*;
      |     ^^^^^^^^^^^^^^^^
      |
      = note: #[warn(unused_imports)] on by default
    
    warning: unused extern crate
     --> src/cli/watch.rs:2:1
      |
    2 | extern crate glob;
      | ^^^^^^^^^^^^^^^^^^
      |
      = note: #[warn(unused_extern_crates)] on by default
    
    warning: unused extern crate
     --> src/yaml.rs:2:1
      |
    2 | extern crate glob;
      | ^^^^^^^^^^^^^^^^^^
    
        Finished dev [unoptimized + debuginfo] target(s) in 24.30 secs
    
    help wanted hacktoberfest 
    opened by cristianoliveira 0
  • feat: propose of new yaml format.

    feat: propose of new yaml format.

    Make more sense if run: be at same level of when: example:

    - name: run my tests
      run: make test
      when:
        change: ['lib/**', 'spec/**']
        ignore: 'tmp/**'
    
    opened by cristianoliveira 0
  • bug: no terminal feedback when more than one rule

    bug: no terminal feedback when more than one rule

    For instance, I have the follow rules:

    ## Funzzy events file
    # more details see: https://github.com/cristianoliveira/funzzy
    #
    # list here all the events and the commands that it should execute
    
    - name: Run linter
      run: 'yarn lint'
      change: 'src/**'
    
    - name: Trigger cypress
      run: 'touch ./cypress/integration/features/apm-validations.spec.js'
      change: 'src/**'
    

    And if I remove one of them it goes back to have a feedback

    bug 
    opened by cristianoliveira 0
  • fix: auto publish binaries with github action

    fix: auto publish binaries with github action

    This procedure used to be via travis.ci but the service has changed and no longer is supported. So the idea is to move it to github actions.

    We are going to need self-hosted https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners Here an example of how it's done https://github.com/skx/github-action-publish-binaries

    opened by cristianoliveira 0
  • feat: Add a parameter for system notification after a task is finished

    feat: Add a parameter for system notification after a task is finished

    It would be useful if we could have some sort of visual/sound notification after a task is completed. It's interesting for a long task where we usually lose focus on what is being done.

    opened by cristianoliveira 2
  • docs: provide some use case examples

    docs: provide some use case examples

    Would be nice to have some "real" examples. For example for a js/ruby/python/rust project. So we should create an examples folder with a bunch of them

    help wanted hacktoberfest 
    opened by cristianoliveira 0
  • docs: create a separeted docs

    docs: create a separeted docs

    Using some app that parse Markdown to html documentation like:

    • http://www.mkdocs.org/
    • https://github.com/vmg/redcarpet
    • https://github.com/johannhof/markdown.rs
    opened by cristianoliveira 0
Releases(v0.4.0)
Owner
Cristian Oliveira
I've contributed to important open source projects, nothing was merged tho. Author of @ClubVim and comedian on twitter.
Cristian Oliveira
minimalistic command launcher in rust

rrun Note: Apart from the occasional fix, this project is not actively developed anymore. rrun works fine and should run/compile for the time being on

null 105 Nov 18, 2022
A modern replacement for ps written in Rust

procs procs is a replacement for ps written in Rust. Documentation quick links Features Platform Installation Usage Configuration Features Output by t

null 3.6k Jan 5, 2023
A more intuitive version of du in rust

Dust du + rust = dust. Like du but more intuitive. Why Because I want an easy way to see where my disk is being used. Demo Install Cargo cargo install

andy.boot 5.5k Jan 8, 2023
Blazing 💥 fast terminal-ui for git written in rust 🦀

Blazing fast terminal client for git written in Rust Features Fast and intuitive keyboard only control Context based help (no need to memorize tons of

Stephan Dilly 11.8k Jan 5, 2023
A simple and fast download accelerator, written in Rust

zou A simple and fast download accelerator, written in Rust Zou is a Snatch fork by @k0pernicus. Snatch is a fast and interruptable download accelerat

Antonin Carette 173 Dec 4, 2022
Fuzzy Finder in rust!

Life is short, skim! Half of our life is spent on navigation: files, lines, commands… You need skim! It is a general fuzzy finder that saves you time.

Jinzhou Zhang 3.7k Jan 4, 2023
A bash-like Unix shell written in Rust

Cicada Unix Shell Cicada is a simple Unix shell written in Rust. Documents Install cicada Environment Variables Cicada Builtins Completion RC File His

Hugo Wang 921 Dec 28, 2022
Performs distributed command execution, written in Rust w/ Tokio

Concurr: Distributed and Concurrent Command Execution, in Rust This project is dual licensed under MIT and Apache 2.0. Originally inspired by the GNU

Michael Murphy 93 Dec 18, 2022
A library to listen to global hotkeys in Rust

Rust Hotkey A library to listen to global hotkeys in Rust How to use See the examples folder for how to use this library. OS Support This lib aims to

James Birtles 44 Dec 12, 2022
🔮 Futuristic take on hexdump, made in Rust.

hex (hx) Futuristic take on hexdump. hx accepts a file path as input and outputs a hexadecimal colorized view to stdout. $ hx tests/files/alphanumeric

Julian Sitkevich 387 Dec 27, 2022
Cross-platform Rust rewrite of the GNU coreutils

uutils coreutils uutils is an attempt at writing universal (as in cross-platform) CLI utilities in Rust. This repository is intended to aggregate GNU

null 13k Dec 30, 2022
A TUI system monitor written in Rust

NO LONGER MAINTAINED. For a similar program, check out https://github.com/ClementTsang/bottom. ytop Another TUI based system monitor, this time in Rus

Caleb Bassi 2.1k Jan 3, 2023
A rust layered configuration loader with zero-boilerplate configuration management.

salak A layered configuration loader with zero-boilerplate configuration management. About Features Placeholder Key Convension Cargo Features Default

Daniel YU 28 Sep 20, 2022
Untrusted IPC with maximum performance and minimum latency. On Rust, on Linux.

Untrusted IPC with maximum performance and minimum latency. On Rust, on Linux. When is this Rust crate useful? Performance or latency is crucial, and

null 72 Jan 3, 2023
An over-engineered rewrite of pipes.sh in Rust

pipes-rs An over-engineered rewrite of pipes.sh in Rust Installlation macOS Install using Homebrew or download manually from releases. $ brew install

Lucas 301 Dec 30, 2022
Trup-rewrite in rust! Finally!

Trup, but Rust! A Discord bot for the Unixporn community Now written in a good language! Dependencies Rust nightly sqlx-cli (if you need to change the

r/unixporn 106 Dec 22, 2022
A collection of small Rust programs for doing weird things

This is a repo of small programs, proof of concepts, or templates written in Rust that relate in some way to hacking and/or CTF. I think Rust is real

d3npa 22 Nov 9, 2022
🍂 A Rust-based simulated DOM (browser-independent replacement for web_sys)

DOM in Rust without a browser Hello and welcome. This library provides server-side or browserless simulation of a DOM. Example Usage use std::sync::Ar

Philip Peterson 45 Dec 13, 2022
Rust implementation to simply convert between coordinate systems

GeoMorph Simple conversion between different coordinate systems without external wrappers

Victor Lopes 10 Nov 8, 2022