ey_pairing 0.0.1 → 0.4.2
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.
- data/bin/ey-pair +1 -2
- data/bin/ey-pairing +3 -0
- data/lib/ey_pairing/author.rb +51 -0
- data/lib/ey_pairing/cli.rb +55 -0
- data/lib/ey_pairing/version.rb +5 -0
- data/lib/ey_pairing.rb +9 -0
- metadata +49 -60
- data/LICENSE +0 -20
- data/README.rdoc +0 -7
- data/lib/pairing/cli.rb +0 -27
- data/lib/pairing/commands/base.rb +0 -5
- data/lib/pairing/commands/pre_commit.rb +0 -80
- data/lib/pairing/commands/repo_setup.rb +0 -11
- data/lib/pairing.rb +0 -11
data/bin/ey-pair
CHANGED
data/bin/ey-pairing
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
module EY
|
3
|
+
module Pairing
|
4
|
+
|
5
|
+
class Author < Struct.new(:name, :email, :init)
|
6
|
+
def self.all
|
7
|
+
(@all || []).sort_by { |author| author.init }
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.register(author)
|
11
|
+
@all ||= []
|
12
|
+
@all << author
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize(*args)
|
16
|
+
super
|
17
|
+
self.init ||= name && name.scan(/(?:^|\s)(\w)/).flatten.join.downcase
|
18
|
+
self.class.register self
|
19
|
+
end
|
20
|
+
|
21
|
+
new("David Calavera", 'dcalavera@engineyard.com')
|
22
|
+
new("Andy Delcambre", 'adelcambre@engineyard.com')
|
23
|
+
new("Larry Diehl", 'ldiehl@engineyard.com')
|
24
|
+
new("Martin Emde", 'memde@engineyard.com')
|
25
|
+
new("Jason Hansen", 'jhansen@engineyard.com')
|
26
|
+
new("Andrew Collins", 'acollins@engineyard.com')
|
27
|
+
new("Jacob Burkhart", 'jburkhart@engineyard.com')
|
28
|
+
new("Thorben Schröder",'tschroder@engineyard.com', 'tom')
|
29
|
+
new("Josh Lane", 'jlane@engineyard.com', "lanej")
|
30
|
+
new("Gordon Malm", 'gmalm@engineyard.com')
|
31
|
+
new("Kirk Haines", 'khaines@engineyard.com')
|
32
|
+
new("Robin Powell", 'rpowell@engineyard.com')
|
33
|
+
new("Wayne E. Seguin", 'wayneeseguin@gmail.com')
|
34
|
+
new("Amy Woodward", 'awoodward@engineyard.com')
|
35
|
+
new("Shai Rosenfeld", 'srosenfeld@engineyard.com')
|
36
|
+
new("Wilson Bilkovich",'wbilkovich@engineyard.com', 'wilson')
|
37
|
+
new("Michael Brodhead",'mbrodhead@engineyard.com', 'mkb')
|
38
|
+
new("James Rucker", 'jrucker@engineyard.com')
|
39
|
+
new("Jim Lindley", 'jlindley@engineyard.com')
|
40
|
+
new('Dr Nic Williams', 'nwilliams@engineyard.com', 'drnic')
|
41
|
+
new('Mutwin Kraus', 'mkraus@engineyard.com', 'mutle')
|
42
|
+
new('JD Huntington', 'jdhuntington@engineyard.com', 'jd')
|
43
|
+
new('Adam Holt', 'aholt@engineyard.com', 'ah')
|
44
|
+
new('Ines Sombra', 'isombra@engineyard.com', 'ines')
|
45
|
+
new('Chad Eubanks', 'ceubanks@engineyard.com', 'chad')
|
46
|
+
new('Hiro Asari', 'hasari@engineyard.com', 'ha')
|
47
|
+
new('Jessica Allen', 'jallen@engineyard.com')
|
48
|
+
new('Thom Mahoney', 'tmahoney@engineyard.com')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module EY
|
2
|
+
module Pairing
|
3
|
+
class CLI
|
4
|
+
def self.run(argv)
|
5
|
+
new.run(argv)
|
6
|
+
end
|
7
|
+
|
8
|
+
def run(argv)
|
9
|
+
puts "Welcome to ey-pairing v#{EY::Pairing::VERSION}"
|
10
|
+
|
11
|
+
authors = [choose_user, choose_pair]
|
12
|
+
names = authors.compact.map{|u| u.name }.join(" & ")
|
13
|
+
email = authors.first.email
|
14
|
+
|
15
|
+
`git config --remove-section user > /dev/null 2>&1` # remove project specific author
|
16
|
+
`git config --global --replace-all user.name "#{names}"`
|
17
|
+
`git config --global --replace-all user.email "#{email}"`
|
18
|
+
|
19
|
+
puts %|~/.gitconfig author written: "#{names} <#{email}>"|
|
20
|
+
end
|
21
|
+
|
22
|
+
def choose_pair
|
23
|
+
choose_user("Pairing?") do |menu|
|
24
|
+
menu.choice("np - Not Pairing") {nil}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def choose_user(prompt="Which user?")
|
29
|
+
highline.choose do |menu|
|
30
|
+
menu.prompt = prompt
|
31
|
+
menu.index = :none
|
32
|
+
menu.select_by = :name
|
33
|
+
EY::Pairing::Author.all.each do |user|
|
34
|
+
menu.choice("#{user.init} (#{user.name})") {user}
|
35
|
+
end
|
36
|
+
yield menu if block_given?
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def highline
|
41
|
+
@highline ||= begin
|
42
|
+
load_highline
|
43
|
+
rescue LoadError
|
44
|
+
require 'rubygems'
|
45
|
+
load_highline
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def load_highline
|
50
|
+
require 'highline'
|
51
|
+
HighLine.new(File.open('/dev/tty'))
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/ey_pairing.rb
ADDED
metadata
CHANGED
@@ -1,80 +1,69 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey_pairing
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
version: 0.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.2
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
12
|
-
-
|
7
|
+
authors:
|
8
|
+
- Engine Yard
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
date: 2011-11-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: highline
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
21
22
|
type: :runtime
|
22
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
segments:
|
27
|
-
- 0
|
28
|
-
version: "0"
|
29
|
-
name: rake
|
30
23
|
prerelease: false
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: pairing is caring
|
31
|
+
email:
|
32
|
+
- gems@engineyard.com
|
33
|
+
executables:
|
35
34
|
- ey-pair
|
35
|
+
- ey-pairing
|
36
36
|
extensions: []
|
37
|
-
|
38
37
|
extra_rdoc_files: []
|
39
|
-
|
40
|
-
|
38
|
+
files:
|
39
|
+
- lib/ey_pairing/author.rb
|
40
|
+
- lib/ey_pairing/cli.rb
|
41
|
+
- lib/ey_pairing/version.rb
|
42
|
+
- lib/ey_pairing.rb
|
41
43
|
- bin/ey-pair
|
42
|
-
-
|
43
|
-
|
44
|
-
- lib/pairing/commands/pre_commit.rb
|
45
|
-
- lib/pairing/commands/repo_setup.rb
|
46
|
-
- lib/pairing.rb
|
47
|
-
- LICENSE
|
48
|
-
- README.rdoc
|
49
|
-
has_rdoc: true
|
50
|
-
homepage: http://engineyard.com
|
44
|
+
- bin/ey-pairing
|
45
|
+
homepage: http://github.com/engineyard/ey_pairing
|
51
46
|
licenses: []
|
52
|
-
|
53
47
|
post_install_message:
|
54
48
|
rdoc_options: []
|
55
|
-
|
56
|
-
require_paths:
|
49
|
+
require_paths:
|
57
50
|
- lib
|
58
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
|
70
|
-
- 0
|
71
|
-
version: "0"
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
72
63
|
requirements: []
|
73
|
-
|
74
64
|
rubyforge_project:
|
75
|
-
rubygems_version: 1.
|
65
|
+
rubygems_version: 1.8.21
|
76
66
|
signing_key:
|
77
67
|
specification_version: 3
|
78
|
-
summary:
|
68
|
+
summary: change global git author settings for pairing
|
79
69
|
test_files: []
|
80
|
-
|
data/LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2010 Engine Yard, Inc
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
DELETED
data/lib/pairing/cli.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
class Pairing::Cli
|
2
|
-
def run(argv)
|
3
|
-
name, *remainder = argv
|
4
|
-
|
5
|
-
case name
|
6
|
-
when 'repo-setup'
|
7
|
-
Pairing::Commands::RepoSetup.run(remainder)
|
8
|
-
when 'pre-commit'
|
9
|
-
Pairing::Commands::PreCommit.run(remainder)
|
10
|
-
else
|
11
|
-
usage
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def usage
|
16
|
-
puts <<-TEXT
|
17
|
-
usage: ey-pair COMMAND
|
18
|
-
|
19
|
-
repo-setup Sets up a git repo for use in pairing.
|
20
|
-
TEXT
|
21
|
-
return 1
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.run(argv)
|
25
|
-
new.run(argv)
|
26
|
-
end
|
27
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
class Pairing::Commands::PreCommit < Pairing::Commands::Base
|
4
|
-
AUTHORS = [
|
5
|
-
{:name => "Andre Arko", :email => 'aarko@engineyard.com'},
|
6
|
-
{:name => "Wesley Beary", :email => 'wbeary@engineyard.com'},
|
7
|
-
{:name => "Jon Crosby", :email => 'jcrosby@engineyard.com'},
|
8
|
-
{:name => "Andy Delcambre", :email => 'adelcambre@engineyard.com'},
|
9
|
-
{:name => "Larry Diehl", :email => 'ldiehl@engineyard.com'},
|
10
|
-
{:name => "Corey Donohoe", :email => 'cdonohoe@engineyard.com'},
|
11
|
-
{:name => "Jared Grippe", :email => 'jgrippe@engineyard.com'},
|
12
|
-
{:name => "Samuel Merritt", :email => 'smerritt@engineyard.com'},
|
13
|
-
{:name => "Martin Emde", :email => 'memde@engineyard.com'},
|
14
|
-
{:name => "Ben Burkert", :email => 'ben@benburkert.com'},
|
15
|
-
{:name => "Simon Rozet", :email => 'srozet@engineyard.com'},
|
16
|
-
{:name => "Tim Carey-Smith", :email => 'tcareysmith@engineyard.com'},
|
17
|
-
]
|
18
|
-
|
19
|
-
AUTHORS.each do |person|
|
20
|
-
person[:init] = person[:name].scan(/(?:^|\s)(\w)/).flatten.join.downcase
|
21
|
-
end
|
22
|
-
|
23
|
-
PAIR_FILE = '.git/ey-pair'
|
24
|
-
|
25
|
-
def run(argv)
|
26
|
-
trap(:INT) { return 1 }
|
27
|
-
|
28
|
-
if user_set_today?
|
29
|
-
existing_user = `git config user.name`.chomp
|
30
|
-
existing_email = `git config user.email`.chomp
|
31
|
-
return if highline.agree("Continue using #{existing_user} <#{existing_email}>?")
|
32
|
-
end
|
33
|
-
|
34
|
-
chosen_user = highline.choose do |menu|
|
35
|
-
menu.prompt = "Which user"
|
36
|
-
menu.index = :none
|
37
|
-
menu.select_by = :name
|
38
|
-
AUTHORS.each do |user|
|
39
|
-
menu.choice("#{user[:init]} (#{user[:name]})") {user}
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
pair = highline.choose do |menu|
|
44
|
-
menu.prompt = "Who are you pairing with?"
|
45
|
-
menu.index = :none
|
46
|
-
menu.select_by = :name
|
47
|
-
(AUTHORS + [{:init => "np", :name => "Not Pairing"}]).each do |user|
|
48
|
-
menu.choice("#{user[:init]} (#{user[:name]})") {user}
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
authors = [chosen_user, pair]
|
53
|
-
names = authors.map{|u| u[:name] }.join(" & ")
|
54
|
-
email = chosen_user[:email]
|
55
|
-
|
56
|
-
`git config --replace-all user.name "#{names}"`
|
57
|
-
`git config --replace-all user.email "#{email}"`
|
58
|
-
FileUtils.touch(PAIR_FILE)
|
59
|
-
|
60
|
-
return 0
|
61
|
-
end
|
62
|
-
|
63
|
-
def user_set_today?
|
64
|
-
now = Time.now
|
65
|
-
File.exist?(PAIR_FILE) && (File.mtime(PAIR_FILE) >= Time.mktime(now.year, now.month, now.mday))
|
66
|
-
end
|
67
|
-
|
68
|
-
def highline
|
69
|
-
retried = false
|
70
|
-
@highline ||= begin
|
71
|
-
require 'highline'
|
72
|
-
HighLine.new(File.open('/dev/tty'))
|
73
|
-
rescue LoadError
|
74
|
-
raise if retried
|
75
|
-
require 'rubygems'
|
76
|
-
retried = true
|
77
|
-
retry
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
class Pairing::Commands::RepoSetup < Pairing::Commands::Base
|
2
|
-
PRE_COMMIT_FILE = '.git/hooks/pre-commit'
|
3
|
-
|
4
|
-
def run(argv)
|
5
|
-
File.open(PRE_COMMIT_FILE, 'w') do |f|
|
6
|
-
f << %{#!/bin/bash\nexec ey-pair pre-commit}
|
7
|
-
end
|
8
|
-
File.chmod(0700, PRE_COMMIT_FILE)
|
9
|
-
puts "Wrote pre-commit hook to collect pair info"
|
10
|
-
end
|
11
|
-
end
|