ehrenmurdick-git-pair 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,10 +41,9 @@ from the global configuration along with the developer abbreviations.
41
41
 
42
42
  ## About this version
43
43
 
44
- This was forked from http://github.com/chrisk/git-pair. Many thanks to
45
- Chris Kampmeier for the original version. Our version added the --reset
46
- option, modified how email addresses are handled, and refactored much of
47
- the code.
44
+ This was forked from http://github.com/edgecase/git-pair. Many thanks to
45
+ Chris Kampmeier for the original version. This version added the --show
46
+ option.
48
47
 
49
48
  ## License
50
49
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ehrenmurdick-git-pair}
8
- s.version = "0.3.0"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Chris Kampmeier", "Adam McCrea", "Jon Distad", "Ehren Murdick"]
12
- s.date = %q{2010-09-27}
12
+ s.date = %q{2010-10-18}
13
13
  s.default_executable = %q{git-pair}
14
14
  s.description = %q{A git porcelain for pair programming. Changes git-config's user.name and user.email settings so you can commit as more than one author.}
15
15
  s.email = %q{ehren.murdick@gmail.com}
@@ -40,6 +40,11 @@ module GitPair
40
40
  exit
41
41
  end
42
42
 
43
+ opts.on '--avatar', "Create a composite avatar using the gravatars of the two authors" do
44
+ Config.avatar Author.find_all(args[1..-1])
45
+ exit
46
+ end
47
+
43
48
  opts.separator ' '
44
49
  opts.separator highlight('Switching authors:')
45
50
  opts.separator ' git pair aa [bb] Where AA and BB are any abbreviation of an'
@@ -6,6 +6,33 @@ module GitPair
6
6
  `git config --global --get-all git-pair.authors`.split("\n")
7
7
  end
8
8
 
9
+ def avatar(authors)
10
+ require 'digest/md5'
11
+ require 'rmagick'
12
+ require 'open-uri'
13
+
14
+ imgs = []
15
+
16
+ authors.each do |auth|
17
+ hash = Digest::MD5.hexdigest(auth.email)
18
+ image_src = "http://www.gravatar.com/avatar/#{hash}"
19
+
20
+ imgs << Magick::Image.from_blob(open(image_src).read).first
21
+ end
22
+
23
+ imgs.first.crop!(0, 0, imgs.first.columns / 2, imgs.first.rows)
24
+
25
+ midline = Magick::Image.new(4, imgs.last.columns, Magick::HatchFill.new('#800','#800'))
26
+
27
+ imgs.last.composite!(imgs.first, Magick::WestGravity, Magick::AtopCompositeOp)
28
+ imgs.last.composite!(midline, Magick::CenterGravity, Magick::AtopCompositeOp)
29
+
30
+
31
+ filename = authors.map { |a| initials(a.name) }.join("+")
32
+
33
+ imgs.last.write("#{filename}.jpg")
34
+ end
35
+
9
36
  def add_author(author)
10
37
  unless Author.exists?(author)
11
38
  `git config --global --add git-pair.authors "#{author.name} <#{author.email}>"`
@@ -40,9 +67,13 @@ module GitPair
40
67
  `git config --get user.email`.strip
41
68
  end
42
69
 
70
+ def initials(name)
71
+ name.split.map { |word| word[0].chr }.join.downcase
72
+ end
73
+
43
74
  def current_initials
44
75
  current_author.split('+').map do |auth|
45
- auth.split.map { |word| word[0].chr }.join.downcase
76
+ initials(auth)
46
77
  end.join('+')
47
78
  end
48
79
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ehrenmurdick-git-pair
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 0.3.0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Kampmeier
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-09-27 00:00:00 -07:00
21
+ date: 2010-10-18 00:00:00 -07:00
22
22
  default_executable: git-pair
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency