Skip to content

kuadrosx/garfio

Repository files navigation

garfio

Gem to help write git-hooks focused in automate deployment tasks and committing-workflow hooks

Usage

gem install garfio

Automate deployment

Paste the following code to your post-receive hook(.git/hooks/post-receive)

#!/usr/bin/ruby
require 'garfio'

hook = Garfio::Hook.new
# select the path where deployed code will live
# this is mandatory for bare repositories
hook.working_dir = '~/backend'
# select your stable branch
hook.working_branch = 'master'
hook.exec do
  run_if('Gemfile') do
    run 'bundle install'
  end

  run_if('bower.json') do
    run 'bower install'
  end

  run_if('app/assets/**/*') do
    run 'rake assets:precompile'
  end
end

Check code

Paste the following code to your pre-commit hook(.git/hooks/pre-commit)

#!/usr/bin/ruby
require 'garfio'

print "post-receive\n"

hook = Garfio::Hook.new
hook.exec do
  lint('ruby -c', '*.rb')
  lint('jshint', '*.js')
  lint('haml --check , '*.haml')
  lint('sass --check , '*.scss')
end

Contributing to garfio

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2015 Jorge Cuadrado. See LICENSE.txt for further details.

About

Gem to help writing git-hooks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages