pair-salad 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +29 -0
  2. data/Rakefile +2 -0
  3. data/bin/pair-salad +79 -0
  4. metadata +65 -0
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Pair::Salad
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'pair-salad'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install pair-salad
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/bin/pair-salad ADDED
@@ -0,0 +1,79 @@
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
+ # Author: Rod Hilton and Adam Esterline (http://www.rallydev.com)
10
+ #
11
+ # http://www.rallydev.com/engblog/2009/09/10/improved-pair-programming-git/
12
+
13
+ #######################################################################
14
+ ## Configuration
15
+
16
+ EMAIL_PREFIX = "engineers"
17
+ EMAIL_SUFFIX = "@streamsend.com"
18
+ AUTHORS = {}
19
+
20
+ @pair_initials = ARGV.sort
21
+
22
+ ## End of configuration
23
+ #######################################################################
24
+
25
+ unless File.exists?(".git")
26
+ puts "This doesn't look like a git repository."
27
+ exit 1
28
+ end
29
+
30
+ unless File.exists?(".authors")
31
+ puts "You do not have an .authors file in the repository."
32
+ puts "Repository needs a file named .authors in the following format:"
33
+ puts " ck Clark Kent"
34
+ puts " bw Bruce Wayne"
35
+ puts " pp Peter Parker"
36
+ exit 1
37
+ end
38
+
39
+ # Read the local .authors file, parsing to get the AUTHORS map
40
+ File.open('.authors').each_line do |line|
41
+ initials, name = line.match(/^(\w+)\s+(.*)$/).captures
42
+ if(AUTHORS.has_key?(initials))
43
+ puts "Duplicate initials for #{initials}"
44
+ exit 1
45
+ end
46
+ AUTHORS[initials] = name
47
+ end
48
+
49
+ authors = @pair_initials.map do |initials|
50
+ if AUTHORS[initials.downcase]
51
+ AUTHORS[initials.downcase]
52
+ else
53
+ puts "Couldn't find author name for initials: #{initials}"
54
+ exit 1
55
+ end
56
+ end
57
+
58
+ if authors.any?
59
+ if authors.size == 1
60
+ authors = authors.first
61
+ elsif authors.size == 2
62
+ authors = authors.join(" and ")
63
+ else
64
+ authors = authors[0..-2].join(", ") + " and " + authors.last
65
+ end
66
+
67
+ email="#{EMAIL_PREFIX}+#{@pair_initials.join("+")}#{EMAIL_SUFFIX}"
68
+
69
+ `git config user.name '#{authors}'`
70
+ `git config user.email '#{email}'`
71
+
72
+ puts "user.name = #{authors}"
73
+ puts "user.email = #{email}"
74
+ else
75
+ `git config --unset user.name`
76
+ `git config --unset user.email`
77
+
78
+ puts "Unset user.name and user.email"
79
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pair-salad
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Scott Albertson
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2012-04-06 00:00:00 -07:00
18
+ default_executable: pair-salad
19
+ dependencies: []
20
+
21
+ description: Git utility used when pair programming.
22
+ email:
23
+ - salbertson@streamsend.com
24
+ executables:
25
+ - pair-salad
26
+ extensions: []
27
+
28
+ extra_rdoc_files: []
29
+
30
+ files:
31
+ - Rakefile
32
+ - README.md
33
+ - bin/pair-salad
34
+ has_rdoc: true
35
+ homepage: ""
36
+ licenses: []
37
+
38
+ post_install_message:
39
+ rdoc_options: []
40
+
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ segments:
48
+ - 0
49
+ version: "0"
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 0
56
+ version: "0"
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.3.6
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Git utility used when pair programming.
64
+ test_files: []
65
+