-
-
Save yfix/53ad3445124c80758e6109cf17a0090c to your computer and use it in GitHub Desktop.
Revisions
-
GianlucaGuarini revised this gist
Jan 15, 2015 . 1 changed file with 19 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" check_run() { echo "$changed_files" | grep -E --quiet "$1" && eval "$2" } # `npm install` and `npm prune` if the `package.json` file gets changed @@ -20,5 +20,21 @@ check_run bower.json "bower install && bower prune" # to update all the php dependencies check_run composer "sudo composer install" # for the sass files we need a bit more if [ -f "config.rb" ] then # `compass compile` to compile all the scss files when they get changed check_run ".scss|.sass" "compass compile" # check whether there is a gruntfile in the root of the project elif [[ -n $(find . -maxdepth 1 -iname "gruntfile.js" -o -iname "gruntfile.coffee") ]] then # try to compile just using grunt sass check_run ".scss|.sass" "grunt sass" # check whether there is a gulpfile in the root of the project elif [[ -n $(find . -maxdepth 1 -iname "gulpfile.js" -iname "gulpfile.coffee") ]] then # try to compile just using grunt sass check_run ".scss|.sass" "gulp sass" fi -
GianlucaGuarini revised this gist
Feb 5, 2014 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,8 +18,7 @@ check_run bower.json "bower install && bower prune" # `composer install` if the `composer.json` file gets changed # to update all the php dependencies check_run composer "sudo composer install" # `compass compile` to compil all the scss files when they get changed check_run .scss "compass compile" -
GianlucaGuarini revised this gist
Feb 5, 2014 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,8 @@ check_run bower.json "bower install && bower prune" # `composer install` if the `composer.json` file gets changed # to update all the php dependencies check_run composer.json "sudo composer install" check_run composer.lock "sudo composer update" # `compass compile` to compil all the scss files when they get changed check_run .scss "compass compile" -
GianlucaGuarini revised this gist
Jan 16, 2014 . 1 changed file with 5 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,14 @@ How to create a global git commit hook by [Matt Venables](https://coderwall.com/p/jp7d5q) 1 Enable git templates (This tells git to copy everything in ~/.git-templates to your per-project .git/ directory when you run git init): ``git config --global init.templatedir '~/.git-templates'`` 2 Create a directory to hold the global hooks: ``mkdir -p ~/.git-templates/hooks`` 3 Write your hooks in ~/.git-templates/hooks. For example, here's a post-commit hook (located in ~/.git-templates/hooks/post-commit): ``` @@ -19,16 +18,15 @@ How to create a global git commit hook by [Matt Venables](https://coderwall.com/ git log -1 --format=format:%h | pbcopy # Add other post-commit hooks ``` 4 Make sure the hook is executable. ``chmod a+x ~/.git-templates/hooks/post-commit`` 5 Re-initialize git in each existing repo you'd like to use this in: ``git init`` -
GianlucaGuarini revised this gist
Dec 17, 2013 . 1 changed file with 0 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,28 +2,6 @@ # MIT © Sindre Sorhus - sindresorhus.com # forked by Gianluca Guarini changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" check_run() { -
GianlucaGuarini revised this gist
Dec 17, 2013 . 1 changed file with 25 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -19,4 +19,28 @@ check_run package.json "npm install && npm prune" check_run bower.json "bower install && bower prune" # `composer install` if the `composer.json` file gets changed # to update all the php dependencies check_run composer.json "composer install" #/usr/bin/env bash # MIT © Sindre Sorhus - sindresorhus.com # forked by Gianluca Guarini changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" check_run() { echo "$changed_files" | grep --quiet "$1" && eval "$2" } # `npm install` and `npm prune` if the `package.json` file gets changed # to update all the nodejs ( grunt ) dependencies deleting the unused packages (not listed into the `package.json` file) check_run package.json "npm install && npm prune" # `bower install` and `bower prune` if the `bower.json` file gets changed # to install all the frontend dependencies removing the unused packages ( not listed into the `bower.json` file ) check_run bower.json "bower install && bower prune" # `composer install` if the `composer.json` file gets changed # to update all the php dependencies check_run composer.json "composer install" # `compass compile` to compil all the scss files when they get changed check_run .scss "compass compile" -
GianlucaGuarini revised this gist
Dec 17, 2013 . 2 changed files with 46 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,22 @@ #/usr/bin/env bash # MIT © Sindre Sorhus - sindresorhus.com # forked by Gianluca Guarini # git hook to run a command after `git pull` if a specified file was changed # Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" check_run() { echo "$changed_files" | grep --quiet "$1" && eval "$2" } # `npm install` and `npm prune` if the `package.json` file gets changed # to update all the nodejs ( grunt ) dependencies deleting the unused packages (not listed into the `package.json` file) check_run package.json "npm install && npm prune" # `bower install` and `bower prune` if the `bower.json` file gets changed # to install all the frontend dependencies removing the unused packages ( not listed into the `bower.json` file ) check_run bower.json "bower install && bower prune" # `composer install` if the `composer.json` file gets changed # to update all the php dependencies check_run composer.json "composer install" This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ How to create a global git commit hook by [Matt Venables](https://coderwall.com/p/jp7d5q) 1. Enable git templates (This tells git to copy everything in ~/.git-templates to your per-project .git/ directory when you run git init): ``git config --global init.templatedir '~/.git-templates'`` 2. Create a directory to hold the global hooks: ``mkdir -p ~/.git-templates/hooks`` 3. Write your hooks in ~/.git-templates/hooks. For example, here's a post-commit hook (located in ~/.git-templates/hooks/post-commit): ``` #!/bin/sh # Copy last commit hash to clipboard on commit git log -1 --format=format:%h | pbcopy # Add other post-commit hooks ``` 4. Make sure the hook is executable. ``chmod a+x ~/.git-templates/hooks/post-commit`` 5. Re-initialize git in each existing repo you'd like to use this in: ``git init`` NOTE if you already have a hook defined in your local git repo, this will not overwrite it. -
sindresorhus created this gist
Dec 16, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ #/usr/bin/env bash # MIT © Sindre Sorhus - sindresorhus.com # git hook to run a command after `git pull` if a specified file was changed # Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" check_run() { echo "$changed_files" | grep --quiet "$1" && eval "$2" } # Example usage # In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed. check_run package.json "npm install" check_run bower.json "bower install"