All Projects → swellaby → rusty-hook

swellaby / rusty-hook

Licence: MIT License
git hook manager, geared toward Rust projects

Programming Languages

rust
11053 projects
shell
77523 projects
powershell
5483 projects

Projects that are alternatives of or similar to rusty-hook

useAudioPlayer
Custom React hook & context for controlling browser audio
Stars: ✭ 176 (+89.25%)
Mutual labels:  hooks, hook
use-smooth-scroll
React hook which gives a smooth scrolling function.
Stars: ✭ 41 (-55.91%)
Mutual labels:  hooks, hook
Fre
👻 Tiny Footprint Concurrent UI library for Fiber.
Stars: ✭ 3,195 (+3335.48%)
Mutual labels:  hooks, hook
React Use Wizard
🧙 A React wizard (stepper) builder without the hassle, powered by hooks.
Stars: ✭ 162 (+74.19%)
Mutual labels:  hooks, hook
react-use-observer
Performant react hooks for WebApi Observers, useResizeObserver, useInteractionObserver, useMutationObserver
Stars: ✭ 19 (-79.57%)
Mutual labels:  hooks, hook
React Nprogress
⌛️ A React primitive for building slim progress bars.
Stars: ✭ 173 (+86.02%)
Mutual labels:  hooks, hook
crypto-watchdog
Crypto Watchdog is an open-source developer friendly project, periodically queries crypto market and notifies potential pumps & recently added tokens/coins via web-hooks.
Stars: ✭ 22 (-76.34%)
Mutual labels:  hooks, hook
Git Good Commit
Git hook to help you write good commit messages, with no external dependencies.
Stars: ✭ 128 (+37.63%)
Mutual labels:  hooks, git-hooks
use-scroll-direction
A simple, performant, and cross-browser hook for detecting scroll direction in your next react app.
Stars: ✭ 24 (-74.19%)
Mutual labels:  hooks, hook
react-use-hoverintent
React hook for hoverIntent
Stars: ✭ 16 (-82.8%)
Mutual labels:  hooks, hook
Pinst
🍺 dev only postinstall hooks (package.json)
Stars: ✭ 162 (+74.19%)
Mutual labels:  hooks, hook
transition-hook
☄️ An extremely light-weight react transition animation hook which is simpler and easier to use than react-transition-group
Stars: ✭ 250 (+168.82%)
Mutual labels:  hooks, hook
React Intersection Observer
React implementation of the Intersection Observer API to tell you when an element enters or leaves the viewport.
Stars: ✭ 2,689 (+2791.4%)
Mutual labels:  hooks, hook
Useworker
⚛️ useWorker() - A React Hook for Blocking-Free Background Tasks
Stars: ✭ 2,233 (+2301.08%)
Mutual labels:  hooks, hook
React Universal Hooks
🎉 React Universal Hooks : just use****** everywhere (Functional or Class Component). Support React DevTools!
Stars: ✭ 148 (+59.14%)
Mutual labels:  hooks, hook
react-ui-hooks
🧩Simple repository of React hooks for building UI components
Stars: ✭ 20 (-78.49%)
Mutual labels:  hooks, hook
Swifthook
A library to hook methods in Swift and Objective-C.
Stars: ✭ 93 (+0%)
Mutual labels:  hooks, hook
Hooks
Async middleware for JavaScript and TypeScript
Stars: ✭ 117 (+25.81%)
Mutual labels:  hooks, hook
use-double-tap
React hook for handling double tap on mobile devices
Stars: ✭ 18 (-80.65%)
Mutual labels:  hooks, hook
husky-elixir
🐶 Git hooks made easy
Stars: ✭ 47 (-49.46%)
Mutual labels:  hooks, git-hooks

rusty-hook

Git hook utility for Rust codebases that lets you run any script for any git hook.

Functional, but still in Beta!

Version Badge Downloads Badge License Badge

Linux CI Badge Mac CI Badge Windows CI Badge Test Results Badge Coverage Badge

Quick Start

Pre-requisites: Make sure you have Rust installed and that Cargo's bin directory is on your PATH. https://www.rust-lang.org/tools/install

  1. Add rusty-hook as a dev dependency in your Cargo.toml file
  2. Run cargo test (to build your dev dependencies, including rusty-hook)
  3. Update the generated .rusty-hook.toml file with the commands you want to run
  4. Run git commit (or equivalent to trigger your git hook)!
    • You may also want to have your hook script fail (for example add a failing test if your commit hook is cargo test) to see the hooks be enforced.
    • note the very first (and only) time you do this will take an extra ~30 seconds or so to finalize the setup

Setup

Just add rusty-hook as a dev dependency in your Cargo.toml file:

[dev-dependencies]
rusty-hook = "^0.11.2"

Initialize

When you add rusty-hook as a dev-dependency in your project, it will automatically configure the git hooks once it is built (for example the first time you run cargo test).

This will ensure that all of the client side git hooks are setup and available, and it will create a rusty-hook configuration file if one does not already exist.

The git hook script will ensure that the rusty-hook cli is available, so the very first time a git hook is triggered on your machine you will see a message indicating that the rusty-hook setup is being finalized which may take ~30 seconds or so:

Finalizing rusty-hook configuration...
This may take a few seconds...

(Optional) Install

You can also install the rusty-hook cli with cargo:

cargo install rusty-hook

You can optionally manually initialize any git directory by running the init command in any git directory to set it up:

rusty-hook init

Configure

You define your desired git hook configuration in the rusty-hook configuration file (a TOML file named .rusty-hook.toml or rusty-hook.toml).

Here's an example rusty-hook configuration that leverages multiple git hooks, including the pre-commit and the pre-push hooks:

[hooks]
pre-commit = "cargo test"
pre-push = ["cargo check", "cargo fmt -- --check"]
post-commit = "echo yay"

[logging]
verbose = true

Hooks

Under the [hooks] table, you can add an entry for any and every git hook you want to run by adding a key using the name of the git hook, and then specify the command/script you want to run for that hook. Multiple commands in a form of a toml array or via command chaining using && are also allowed (Only for versions 0.12 and up). Whenever that git hook is triggered, rusty-hook will run your specified command!

Using git arguments

In git hook commands, any instance of %rh! will be replaced by the arguments that git passes to this hook.

[hooks]
pre-push = "echo %rh!"

Logging

Under the [logging] table, you can control whether to log the output of running your specified hook commands. By default rusty-hook will log the results of your hook script, but you can disable this behavior by setting the verbose key to false:

[logging]
verbose = false

Alternatives

There's a few other git hook utilities available on crates.io, but none of them quite suited our needs so we made rusty-hook!

Contributions

All contributions are welcome and appreciated! Check out our Contributing Guidelines for more information about opening issues, developing, and more.

Changelog

See CHANGELOG.md

Removing rusty-hook

We'll be sad to see you go, but here's what to do if you'd like to remove rusty-hook from your project.

  1. Remove the rusty-hook dev dependency from the Cargo.toml file in your project.
  2. Remove the .rusty-hook.toml configuration file from your project.
  3. Remove the git hook scripts that were placed in the git hooks directory in your local project workspace (this is typically in the .git/hooks/ directory). Note that if you were using rusty-hook version 0.9.1 or newer and you skip this step, then the git hooks will still be invoked as part of your git workflow and you will see the following warning message on git commit:
rusty-hook git hooks are configured, but no config file was found
In order to use rusty-hook, your project must have a config file
See https://github.com/swellaby/rusty-hook#configure for more information about configuring rusty-hook

If you were trying to remove rusty-hook, then you should also delete the git hook files to remove this warning
See https://github.com/swellaby/rusty-hook#removing-rusty-hook for more information about removing rusty-hook from your project

Please also consider opening an issue to report any bugs/problems you experienced, missing features, etc. so that we can work on improving rusty-hook!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].