git-precommit 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +44 -5
- data/VERSION +1 -1
- data/git-hooks/post-commit +14 -2
- data/git-precommit.gemspec +4 -4
- data/lib/git-precommit/precommit_tasks.rb +10 -6
- data/{tasks/git.rake → lib/git-precommit/tasks.rb} +0 -1
- data/lib/git_precommit.rb +2 -0
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Git Pre-Commit
|
2
2
|
|
3
|
-
Rake
|
3
|
+
Rake-Commit[http://github.com/pgr0ss/rake_commit_tasks] is a great tool for
|
4
4
|
helping make sure our check-ins don't break the build. However, in Git we
|
5
5
|
don't need all that stuff. Running our tests before check-in is easy with a
|
6
6
|
Git pre-commit hook.
|
@@ -11,12 +11,51 @@ will be installed that calls `<tt>rake precommit</tt>`
|
|
11
11
|
|
12
12
|
== Installation
|
13
13
|
|
14
|
-
|
14
|
+
=== As a Rails Plugin
|
15
|
+
|
16
|
+
This plugin can be installed as a gem via config.gem or the gem bundler.
|
17
|
+
Require the library as 'git_precommit'.
|
15
18
|
|
16
|
-
|
19
|
+
To install as a non-gem plugin use one of the following commands from the root
|
20
|
+
of your Rails project:
|
17
21
|
|
22
|
+
script/plugin install git://github.com/tobytripp/git-pre-commit
|
18
23
|
git clone git://github.com/tobytripp/git-pre-commit.git vendor/plugins/git_pre_commit
|
24
|
+
git submodule add git://github.com/tobytripp/git-pre-commit.git vendor/plugins/git_pre_commit
|
19
25
|
|
20
|
-
|
26
|
+
One installed, add the following to your project's Rakefile:
|
21
27
|
|
22
|
-
|
28
|
+
require 'git-precommit/tasks'
|
29
|
+
|
30
|
+
Note: the above require will define the git hook tasks only in the
|
31
|
+
'development' and 'test' rails environments.
|
32
|
+
|
33
|
+
=== In a Stand-Alone Ruby Program
|
34
|
+
|
35
|
+
Add the following code to your project's Rakefile:
|
36
|
+
|
37
|
+
require "git_precommit"
|
38
|
+
GitPrecommit::PrecommitTasks.new
|
39
|
+
|
40
|
+
task :default => ".git/hooks/pre-commit"
|
41
|
+
task :precommit => :default
|
42
|
+
|
43
|
+
== CruiseControl.rb Integration
|
44
|
+
|
45
|
+
git-precommit can be configured to automatically push to your remote
|
46
|
+
repository on successful checkin by installing the post-commit hook:
|
47
|
+
rake .git/hooks/post-commit
|
48
|
+
However, if you're running a continuous
|
49
|
+
integration build, you shouldn't push onto a broken build (unless you're
|
50
|
+
pushing the fix).
|
51
|
+
|
52
|
+
To check the status of a
|
53
|
+
cruisecontrol.rb[http://cruisecontrolrb.thoughtworks.com/] build before
|
54
|
+
pushing, install the cruisestatus[http://github.com/tobytripp/cruisestatus]
|
55
|
+
gem and record the url of your build server in a file called CRUISE_URL:
|
56
|
+
|
57
|
+
sudo gem install cruisestatus
|
58
|
+
echo http://my.cruiseserver.rb >> CRUISE_URL
|
59
|
+
|
60
|
+
Once you've done that, if your build has failed, you'll be prompted before
|
61
|
+
your changes will be pushed.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/git-hooks/post-commit
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
#!/usr/bin/env sh
|
2
|
+
cmd=`which cruisestatus`
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
if [ -x "$cmd" ] && [ -f CRUISE_URL ]; then
|
5
|
+
if $cmd -p `cat CRUISE_URL`; then
|
6
|
+
echo "pulling"
|
7
|
+
git pull --rebase
|
8
|
+
git push
|
9
|
+
else
|
10
|
+
echo "aborted due to build failures"
|
11
|
+
exit 1
|
12
|
+
fi
|
13
|
+
else
|
14
|
+
git pull --rebase
|
15
|
+
git push
|
16
|
+
fi
|
data/git-precommit.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{git-precommit}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Toby Tripp"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-24}
|
13
13
|
s.description = %q{ A set of rake tasks that install git pre-commit hooks to call your build.
|
14
14
|
If your build fails, the commit will not proceed.
|
15
15
|
}
|
@@ -26,8 +26,8 @@ Gem::Specification.new do |s|
|
|
26
26
|
"git-hooks/pre-commit",
|
27
27
|
"git-precommit.gemspec",
|
28
28
|
"lib/git-precommit/precommit_tasks.rb",
|
29
|
-
"lib/
|
30
|
-
"
|
29
|
+
"lib/git-precommit/tasks.rb",
|
30
|
+
"lib/git_precommit.rb"
|
31
31
|
]
|
32
32
|
s.homepage = %q{http://github.com/tobytripp/git-pre-commit}
|
33
33
|
s.rdoc_options = ["--charset=UTF-8"]
|
@@ -3,23 +3,27 @@ require "rake/tasklib"
|
|
3
3
|
|
4
4
|
module GitPrecommit
|
5
5
|
class PrecommitTasks < ::Rake::TaskLib
|
6
|
-
TEMPLATE_PATH =
|
7
|
-
|
6
|
+
TEMPLATE_PATH =
|
7
|
+
File.expand_path File.join( File.dirname(__FILE__), '..', '..', 'git-hooks' )
|
8
|
+
attr_accessor :template_path
|
9
|
+
|
8
10
|
def initialize()
|
9
11
|
yield self if block_given?
|
12
|
+
@template_path ||= TEMPLATE_PATH
|
13
|
+
|
10
14
|
define
|
11
15
|
end
|
12
16
|
|
13
17
|
def define()
|
14
|
-
desc "Install the pre-commit hook"
|
15
|
-
file ".git/hooks/pre-commit" => "#{
|
18
|
+
desc "Install the git pre-commit hook"
|
19
|
+
file ".git/hooks/pre-commit" => "#{template_path}/pre-commit" do |t|
|
16
20
|
warn "Git pre-commit hook missing, setting up…"
|
17
21
|
copy t.prerequisites.first, t.name
|
18
22
|
chmod 0755, t.name
|
19
23
|
end
|
20
24
|
|
21
|
-
desc "Install the post-commit hook"
|
22
|
-
file ".git/hooks/post-commit" => "#{
|
25
|
+
desc "Install the git post-commit hook"
|
26
|
+
file ".git/hooks/post-commit" => "#{template_path}/post-commit" do |t|
|
23
27
|
copy t.prerequisites.first, t.name
|
24
28
|
chmod 0755, t.name
|
25
29
|
end
|
data/lib/git_precommit.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-precommit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toby Tripp
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-24 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -30,8 +30,8 @@ files:
|
|
30
30
|
- git-hooks/pre-commit
|
31
31
|
- git-precommit.gemspec
|
32
32
|
- lib/git-precommit/precommit_tasks.rb
|
33
|
+
- lib/git-precommit/tasks.rb
|
33
34
|
- lib/git_precommit.rb
|
34
|
-
- tasks/git.rake
|
35
35
|
has_rdoc: true
|
36
36
|
homepage: http://github.com/tobytripp/git-pre-commit
|
37
37
|
licenses: []
|