git-precommit 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.1
1
+ 1.2.0
data/bin/setpairs ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Configures the git author to a list of developers when pair programming
4
+ #
5
+ # Usage: pair lm bh (Sets the author to 'Luke Melia and Bryan Helmkamp')
6
+ # pair (Unsets the author so the git global config takes effect)
7
+ #
8
+ # Author: Bryan Helmkamp (http://brynary.com)
9
+
10
+ # http://www.brynary.com/2008/9/1/setting-the-git-commit-author-to-pair-programmers-names
11
+
12
+ #######################################################################
13
+ ## Configuration
14
+
15
+ # Do not use a valid github account email here.
16
+ PAIR_EMAIL = "developers@weplay.com"
17
+
18
+ AUTHORS = {
19
+ "bh" => "Bryan Helmkamp",
20
+ "lm" => "Luke Melia"
21
+ # ...
22
+ }
23
+
24
+ ## End of configuration
25
+ #######################################################################
26
+
27
+ unless File.exists?(".git")
28
+ puts "This doesn't look like a git repository."
29
+ exit 1
30
+ end
31
+
32
+ authors = ARGV.map do |initials|
33
+ if AUTHORS[initials.downcase]
34
+ AUTHORS[initials.downcase]
35
+ else
36
+ puts "Couldn't find author name for initials: #{initials}"
37
+ exit 1
38
+ end
39
+ end
40
+
41
+ if authors.any?
42
+ if authors.size == 1
43
+ authors = authors.first
44
+ elsif authors.size == 2
45
+ authors = authors.join(" and ")
46
+ else
47
+ authors = authors[0..-2].join(", ") + " and " + authors.last
48
+ end
49
+
50
+ `git config user.name '#{authors}'`
51
+ `git config user.email '#{PAIR_EMAIL}'`
52
+
53
+ puts "user.name = #{authors}"
54
+ puts "user.email = #{PAIR_EMAIL}"
55
+ else
56
+ `git config --unset user.name`
57
+ `git config --unset user.email`
58
+
59
+ puts "Unset user.name and user.email"
60
+ end
@@ -1,16 +1,22 @@
1
1
  #!/usr/bin/env sh
2
2
  cmd=`which cruisestatus`
3
3
 
4
+ do_push() {
5
+ git pull --rebase
6
+ git push
7
+ }
8
+
4
9
  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
10
+ if $cmd `cat CRUISE_URL`; then
11
+ do_push
12
+ elif [ -n "$BUILD_FIX" ] || git log -1 --oneline | grep -i 'build.*fix'; then
13
+ echo "Pushing build fix"
14
+ do_push
9
15
  else
10
- echo "aborted due to build failures"
11
- exit 1
16
+ echo "Push aborted due to build failures."
17
+ echo "To push a build fix, include 'BUILD FIX' in your commit comment"
18
+ echo "or set the environment variable: BUILD_FIX"
12
19
  fi
13
20
  else
14
- git pull --rebase
15
- git push
21
+ do_push
16
22
  fi
@@ -5,15 +5,17 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{git-precommit}
8
- s.version = "1.1.1"
8
+ s.version = "1.2.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-24}
12
+ s.date = %q{2010-02-11}
13
+ s.default_executable = %q{setpairs}
13
14
  s.description = %q{ A set of rake tasks that install git pre-commit hooks to call your build.
14
15
  If your build fails, the commit will not proceed.
15
16
  }
16
17
  s.email = %q{toby.tripp+git@gmail.com}
18
+ s.executables = ["setpairs"]
17
19
  s.extra_rdoc_files = [
18
20
  "README.rdoc"
19
21
  ]
@@ -22,6 +24,7 @@ Gem::Specification.new do |s|
22
24
  "README.rdoc",
23
25
  "Rakefile",
24
26
  "VERSION",
27
+ "bin/setpairs",
25
28
  "git-hooks/post-commit",
26
29
  "git-hooks/pre-commit",
27
30
  "git-precommit.gemspec",
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.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby Tripp
@@ -9,14 +9,14 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-24 00:00:00 -06:00
13
- default_executable:
12
+ date: 2010-02-11 00:00:00 -06:00
13
+ default_executable: setpairs
14
14
  dependencies: []
15
15
 
16
16
  description: " A set of rake tasks that install git pre-commit hooks to call your build.\n If your build fails, the commit will not proceed.\n"
17
17
  email: toby.tripp+git@gmail.com
18
- executables: []
19
-
18
+ executables:
19
+ - setpairs
20
20
  extensions: []
21
21
 
22
22
  extra_rdoc_files:
@@ -26,6 +26,7 @@ files:
26
26
  - README.rdoc
27
27
  - Rakefile
28
28
  - VERSION
29
+ - bin/setpairs
29
30
  - git-hooks/post-commit
30
31
  - git-hooks/pre-commit
31
32
  - git-precommit.gemspec