jhbabon / git-template Goto Github PK
View Code? Open in Web Editor NEWGit template directory with some hooks.
License: MIT License
Git template directory with some hooks.
License: MIT License
The subprocess need to read the stdin because some git hooks, (like pre-push
) can receive info over that pipe.
Because there are more than one hook per type, there must be a way to pass the same content to each hook, with UNIX pipes or something similar.
Some background hooks could need another one, like running bundler
before running ctags
. Now each background hook runs separately, but would be nice to chain them.
E.g:
#!/usr/bin/env ruby
require_relative "hook"
# Put here the name of the scripts that will be executed
# when this hook is called.
scripts = {
# These scripts must be in the directory:
# hooks/post-checkout.d/
# "post-checkout" => %w[],
# You can execute other scripts in other directories,
# like `shared` or `utils`:
# hooks/shared.d/
# "shared" => %w[noop ctags],
# To execute a script in background pass the `:bg` along
# with the name of the script, as an array.
# Here we can execute the `ctags` script in background:
"shared" => [
[["bundler", "ctags"], :bg],
],
}
Hook.new(scripts).call
Also, a better API to register hooks could be nicer. So many arrays is confusing.
For example, this post-checkout
:
#!/usr/bin/env ruby
require_relative "hook"
# Put here the name of the scripts that will be executed
# when this hook is called.
scripts = {
# These scripts must be in the directory:
# hooks/post-checkout.d/
# "post-checkout" => %w[],
# You can execute other scripts in other directories,
# like `shared` or `utils`:
# hooks/shared.d/
# "shared" => %w[noop ctags],
# To execute a script in background pass the `:bg` along
# with the name of the script, as an array.
# Here we can execute the `ctags` script in background:
"shared" => [
["bundler", :bg],
["ctags", :bg],
],
}
Hook.new(scripts).call
Only executes ctags
shared hook.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.