0.01
No commit activity in last 3 years
No release in over 3 years
A set of rake tasks that install git pre-commit hooks to run your tests. If your build fails, the commit will not proceed. Git-precommit will call `rake precommit` to run your tests. Be sure to define this task.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 0.9.0
~> 0.2.2
~> 2.0.0
>= 0

Runtime

>= 0
 Project Readme

Git Pre-Commit¶ ↑

Rake-Commit is a great tool for helping make sure our check-ins don’t break the build. However, in Git we don’t need all that stuff. Running our tests before check-in is easy with a Git pre-commit hook.

This Rails plug-in ensures that such a hook is installed on the developer’s repository. If no such hook is installed, one will be installed that calls ‘rake precommit`

Installation¶ ↑

As a Rails Plugin¶ ↑

This plugin can be installed as a gem via config.gem or the gem bundler. Require the library as ‘git_precommit’.

To install as a non-gem plugin use one of the following commands from the root of your Rails project:

script/plugin install git://github.com/tobytripp/git-pre-commit
git clone git://github.com/tobytripp/git-pre-commit.git vendor/plugins/git_pre_commit
git submodule add git://github.com/tobytripp/git-pre-commit.git vendor/plugins/git_pre_commit

One installed, add the following to your project’s Rakefile:

require 'git-precommit/tasks'

Note: the above require will define the git hook tasks only in the ‘development’ and ‘test’ rails environments.

In a Stand-Alone Ruby Program¶ ↑

Add the following code to your project’s Rakefile:

require "git_precommit"
GitPrecommit::PrecommitTasks.new

task :default => ".git/hooks/pre-commit"
task :precommit => :default

CruiseControl.rb Integration¶ ↑

git-precommit can be configured to automatically push to your remote repository on successful checkin by installing the post-commit hook:

rake git:postcommit

However, if you’re running a continuous integration build, you shouldn’t push onto a broken build (unless you’re pushing the fix).

To check the status of a cruisecontrol.rb build before pushing, install the cruisestatus gem and record the url of your build server in a file called CRUISE_URL:

sudo gem install cruisestatus
echo http://my.cruiseserver.rb >> CRUISE_URL

Once you’ve done that, if your build has failed, you’ll be prompted before your changes will be pushed.