ppgit 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ 0.6.0
2
+ - use '+' in the pair name, instead of '_'
1
3
  0.5.0
2
4
  - print warning if a new version is available - closes gh-3
3
5
  - display info in green, error in red - http://bit.ly/aHb1pw - closes gh-2
data/README.markdown CHANGED
@@ -1,6 +1,8 @@
1
1
  [ppgit](http://rubygems.org/gems/ppgit)
2
2
  =======
3
3
 
4
+ ![Alt text](http://github.com/alainravet/ppgit/raw/master/doc/ppgit-img3.png)
5
+
4
6
  For Git-friendly Pair-Programming sessions.
5
7
  Sign your commits with your pair 2-part name and email : andy\_john / andy\_john@acme.com
6
8
  When you're done, restore your local git config in a snap.
@@ -25,6 +27,8 @@ remark : 'ppgit' is a synonym of 'git pp' => you can write
25
27
  Usage :
26
28
  -------
27
29
 
30
+ ![Alt text](http://github.com/alainravet/ppgit/raw/master/doc/ppgit-img1.png)
31
+
28
32
  #### 1 - When the pairing session starts, quickly set user.name and user.email to the pair values :
29
33
 
30
34
  $ ppgit john andy andy_john@mycompany.com
@@ -32,7 +36,7 @@ Usage :
32
36
  => this will update the .git/config of your project to
33
37
 
34
38
  [user]
35
- name = andy_john
39
+ name = andy+john
36
40
  email = andy_john@mycompany.com
37
41
  [user-before-ppgit]
38
42
  name = Your Name
@@ -43,7 +47,7 @@ Usage :
43
47
 
44
48
  $ ppgit clear
45
49
 
46
- => will restore your ~/.gitconfig to :
50
+ => will restore your .git/config to :
47
51
 
48
52
  [user]
49
53
  name = Your Name
@@ -81,8 +85,16 @@ This info is stored in ~/.gitconfig => it works for all your projects.
81
85
 
82
86
  $ gem install ppgit
83
87
 
84
- #### Report bugs to <http://github.com/alainravet/ppgit/>
85
88
 
89
+ #### Update :
90
+
91
+ You are warned when a new version is available :
92
+
93
+ ![Alt text](http://github.com/alainravet/ppgit/raw/master/doc/ppgit-img2.png)
94
+
95
+
96
+ #### Report bugs to <http://github.com/alainravet/ppgit/>
97
+ test
86
98
  --------------------------------------------------------------------------------
87
99
 
88
100
  == Note on Patches/Pull Requests
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.6.0
data/bin/git-pp CHANGED
@@ -11,11 +11,13 @@ if ARGV.empty?
11
11
  do_ppgit_show_usage_message()
12
12
 
13
13
  else
14
- LOCAL_CONFIG_FILE = in_test_mode ? config_file_part('--file' ) : nil
14
+ # LOCAL_CONFIG_FILE = in_test_mode ? config_file_part('--file' ) : nil
15
+ LOCAL_CONFIG_FILE = in_test_mode ? config_file_part('--file' ) : '--file .git/config'
15
16
  GLOBAL_CONFIG_FILE = in_test_mode ? config_file_part('--global_file') : '--global'
16
17
 
17
18
  if emailroot = argv_value_of('--email_root')
18
19
  do_ppgit_emailroot(emailroot)
20
+ do_ppgit_info() if ARGV.empty?
19
21
  end
20
22
 
21
23
  if ARGV == %w(info)
@@ -29,7 +31,7 @@ else
29
31
  do_ppgit_set_pair_as_a_user(user_1=ARGV[0], user_2=ARGV[1], pair_email=ARGV[2])
30
32
  do_ppgit_info()
31
33
 
32
- else
34
+ elsif 0 != ARGV.length
33
35
  puts yellow( "\nError - invalid command : ")
34
36
  puts yellow( ' ppgit ') + lred(ARGV.join(' '))
35
37
  puts "\n----------------------------\n\n"
data/bin/ppgit CHANGED
@@ -11,11 +11,13 @@ if ARGV.empty?
11
11
  do_ppgit_show_usage_message()
12
12
 
13
13
  else
14
- LOCAL_CONFIG_FILE = in_test_mode ? config_file_part('--file' ) : nil
14
+ # LOCAL_CONFIG_FILE = in_test_mode ? config_file_part('--file' ) : nil
15
+ LOCAL_CONFIG_FILE = in_test_mode ? config_file_part('--file' ) : '--file .git/config'
15
16
  GLOBAL_CONFIG_FILE = in_test_mode ? config_file_part('--global_file') : '--global'
16
17
 
17
18
  if emailroot = argv_value_of('--email_root')
18
19
  do_ppgit_emailroot(emailroot)
20
+ do_ppgit_info() if ARGV.empty?
19
21
  end
20
22
 
21
23
  if ARGV == %w(info)
@@ -29,7 +31,7 @@ else
29
31
  do_ppgit_set_pair_as_a_user(user_1=ARGV[0], user_2=ARGV[1], pair_email=ARGV[2])
30
32
  do_ppgit_info()
31
33
 
32
- else
34
+ elsif 0 != ARGV.length
33
35
  puts yellow( "\nError - invalid command : ")
34
36
  puts yellow( ' ppgit ') + lred(ARGV.join(' '))
35
37
  puts "\n----------------------------\n\n"
Binary file
Binary file
Binary file
@@ -27,11 +27,9 @@ def do_ppgit_set_pair_as_a_user(user_1, user_2, pair_email)
27
27
  backup_git_value :from => 'user.email', :to => 'user-before-ppgit.email'
28
28
 
29
29
  two_users = [user_1, user_2]
30
- pair_user = two_users.sort.join('_')
30
+ pair_email ||= make_email_from_email_root_and_user(two_users.sort.join('_'))
31
31
 
32
- pair_email ||= make_email_from_email_root_and_user(pair_user)
33
-
34
- set_local_git_value 'user.name', pair_user
32
+ set_local_git_value 'user.name', two_users.sort.join('+')
35
33
  if pair_email
36
34
  set_local_git_value 'user.email', pair_email
37
35
  end
@@ -57,15 +55,22 @@ end
57
55
 
58
56
 
59
57
  def do_ppgit_info
60
- name, email = get_local_git_value('user.name'), get_local_git_value('user.email')
61
- email_root = get_local_git_value('ppgit.emailroot')
58
+ ppgit_info(LOCAL_CONFIG_FILE )
59
+ ppgit_info(GLOBAL_CONFIG_FILE)
60
+ end
61
+
62
+ def ppgit_info(file)
63
+ name, email = get_value('user.name', file), get_value('user.email', file)
64
+ email_root = get_value('ppgit.emailroot', file)
62
65
  s = []
63
- s << " -------------------------------------------------------"
64
- if name.blank? && email.blank?
65
- s << ' [user] is empty (user.email and user.name are not set)'
66
- else
66
+ s << "-------------------------------------------------------"
67
+ s << "file = " + ((file == '--global') ? '~/.gitconfig' : file.gsub('--file ',''))
68
+ s << "-------------------------------------------------------"
69
+ unless name.blank? && email.blank?
70
+ # s << ' [user] is empty (user.email and user.name are not set)'
71
+ # else
67
72
  s << ' [user]'
68
- s << " name = #{name }" unless name .blank?
73
+ s << " name = #{name }" unless name.blank?
69
74
  s << " email = #{email}" unless email.blank?
70
75
  s << ' -------------------------------------------------------'
71
76
  end
@@ -74,14 +79,14 @@ def do_ppgit_info
74
79
  s << " emailroot = #{email_root}" unless email_root.blank?
75
80
  s << ' -------------------------------------------------------'
76
81
  end
77
- name, email = get_local_git_value('user-before-ppgit.name'), get_local_git_value('user-before-ppgit.email')
82
+ name, email = get_value('user-before-ppgit.name', file), get_value('user-before-ppgit.email', file)
78
83
  unless name.blank? && email.blank?
79
84
  s << ' [user-before-ppgit]'
80
- s << " name = #{name }" unless name .blank?
85
+ s << " name = #{name }" unless name.blank?
81
86
  s << " email = #{email}" unless email.blank?
82
87
  s << ' -------------------------------------------------------'
83
88
  end
84
89
  s << ' '
85
-
86
90
  puts green s.join("\n")
87
91
  end
92
+
data/lib/ppgit/usage.txt CHANGED
@@ -27,7 +27,7 @@ remark : 'ppgit' is a synonym of 'git pp' => you can write
27
27
  => will update ~/.gitconfig to
28
28
 
29
29
  [user]
30
- name = andy_john
30
+ name = andy+john
31
31
  email = andy_john@mycompany.com
32
32
 
33
33
 
data/ppgit.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ppgit}
8
- s.version = "0.5.0"
8
+ s.version = "0.6.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alain Ravet"]
12
- s.date = %q{2010-07-26}
12
+ s.date = %q{2010-10-07}
13
13
  s.description = %q{git users' pairs switcher}
14
14
  s.email = %q{alain.ravet+git@gmail.com}
15
15
  s.executables = ["git-pp", "ppgit"]
@@ -27,6 +27,9 @@ Gem::Specification.new do |s|
27
27
  "VERSION",
28
28
  "bin/git-pp",
29
29
  "bin/ppgit",
30
+ "doc/ppgit-img1.png",
31
+ "doc/ppgit-img2.png",
32
+ "doc/ppgit-img3.png",
30
33
  "lib/ppgit.rb",
31
34
  "lib/ppgit/commands.rb",
32
35
  "lib/ppgit/git_utils.rb",
@@ -34,7 +34,7 @@ describe "`ppgit clear`" do
34
34
  context 'when there is a user.name + email AND stored values in user-before-ppgit AND an emailroot' do
35
35
  before(:all) do
36
36
  @before_local = [ '[user]' ,
37
- ' name = andy_john' , # value to replace
37
+ ' name = andy+john' , # value to replace
38
38
  ' email = andy_john@test.com' , # ..
39
39
 
40
40
  '[user-before-ppgit]' , # section to erase
@@ -65,7 +65,7 @@ describe "`ppgit clear`" do
65
65
  context 'when both the backup user.name and email are the same as the global values' do
66
66
  before(:all) do
67
67
  @before_local = [ '[user]' , # section to erase
68
- ' name = andy_john' , #
68
+ ' name = andy+john' , #
69
69
  ' email = andy_john@test.com' , #
70
70
 
71
71
  '[user-before-ppgit]' , # section to erase
@@ -93,7 +93,7 @@ describe "`ppgit clear`" do
93
93
  context 'when only the backup user.name is the same as the global value' do
94
94
  before(:all) do
95
95
  @before_local = [ '[user]' , #
96
- ' name = andy_john' , # will disappear
96
+ ' name = andy+john' , # will disappear
97
97
  ' email = andy_john@test.com' , # will be restored
98
98
 
99
99
  '[user-before-ppgit]' , #
@@ -53,7 +53,7 @@ describe "medium: `ppgit john andy --email_root acme+*@gmail.com`" do
53
53
 
54
54
  it 'stores the user in local (.git/config)' do
55
55
  expected_local = [ '[user]' ,
56
- ' name = andy_john' ,
56
+ ' name = andy+john' ,
57
57
  ' email = acme+andy_john@gmail.com'
58
58
  ].join("\n")
59
59
  @actual_local.should == expected_local
@@ -77,7 +77,7 @@ describe "complex: `ppgit john andy andy_john@test.com --email_root acme+*@gmail
77
77
 
78
78
  it 'uses the explicit email address (3rd parameter)' do
79
79
  expected_local = [ '[user]' ,
80
- ' name = andy_john' ,
80
+ ' name = andy+john' ,
81
81
  ' email = andy_john@test.com'
82
82
  ].join("\n")
83
83
  @actual_local.should == expected_local
@@ -5,7 +5,7 @@ describe "`ppgit info`" do
5
5
  context "when ALL the [user] and the ppgit variables are stored in the 2 config files" do
6
6
  before(:all) do
7
7
  before_local = [ '[user]' ,
8
- ' name = andy_john' ,
8
+ ' name = andy+john' ,
9
9
  ' email = andy_john@test.com' ,
10
10
 
11
11
  '[user-before-ppgit]' ,
@@ -17,12 +17,10 @@ describe "`ppgit info`" do
17
17
  ignore, ignore, @output = execute_command_g( ppgit("info"), before_local, before_global)
18
18
  end
19
19
 
20
- it('should display the [user].* info' ) { @output.should match(/\[user\].+andy_john.+andy_john@test.com/mi) }
20
+ it('should display the [user].* info' ) { @output.should match(/\[user\].+andy\+john.+andy_john@test.com/mi) }
21
21
  it('should display the [user-before-ppgit].* info') { @output.should match(/\[user-before-ppgit\].+John User.+johnuser@gmail.be/mi) }
22
22
  it('should display the [ppgit].emailroot info' ) {
23
- pending 'till we can find a better way to fake the file system' do
24
- @output.should match(/\[ppgit\].+emailroot\s+=\s+acme\+\*@gmail.com/mi)
25
- end
23
+ @output.should match(/\[ppgit\].+emailroot\s+=\s+acme\+\*@gmail.com/mi)
26
24
  }
27
25
  end
28
26
 
@@ -34,7 +32,7 @@ describe "`ppgit info`" do
34
32
  ignore, ignore, @output = execute_command_g( ppgit("info"), before_local, before_global)
35
33
  end
36
34
 
37
- it('should display the empty [user] section' ) { @output.should match(/\[user\]/mi) }
35
+ it('should not display the empty [user] section' ) { @output.should_not match(/\[user\]/mi) }
38
36
 
39
37
  it('should NOT display the empty [user-before-ppgit] section') { @output.should_not match(/\[user-before-ppgit\]/mi) }
40
38
  it('should NOT display the [ppgit] info' ) { @output.should_not match(/\[ppgit\]/mi) }
data/spec/ppgit_spec.rb CHANGED
@@ -15,7 +15,7 @@ context "with empty git config files" do
15
15
  end
16
16
  it("combines the 2 names alphabetically and stores this user.name in .git/config" ) do
17
17
  expected_local = ['[user]' ,
18
- ' name = andy_john' ]
18
+ ' name = andy+john' ]
19
19
  @actual_local.should == expected_local.join("\n")
20
20
  end
21
21
  it("doesn't change --global (~/.gitconfig)") { @actual_global.should == @before_global.join("\n") }
@@ -29,7 +29,7 @@ context "with empty git config files" do
29
29
  end
30
30
  it "also stores the 3rd parameter as user.email in .git/config" do
31
31
  expected_local = ['[user]' ,
32
- ' name = andy_john' ,
32
+ ' name = andy+john' ,
33
33
  ' email = andy_john@test.com' ]
34
34
 
35
35
  @actual_local.should == expected_local.join("\n")
@@ -52,7 +52,7 @@ context 'when there is only a ppgit.emailroot' do
52
52
  end
53
53
  it( 'combines the users names and the emailroot to create and store user.email' ) do
54
54
  expected_local = ['[user]' ,
55
- ' name = andy_john' ,
55
+ ' name = andy+john' ,
56
56
  ' email = pp+andy_john@gmail.com' ]
57
57
  @actual_local.should == expected_local.join("\n")
58
58
  end
@@ -73,7 +73,7 @@ context 'when there is only a user.name' do
73
73
  cmd = ppgit('john andy' )
74
74
  @actual_local, @actual_global = execute_command_g( cmd, @before_local, @before_global)
75
75
  expected_local = ['[user]' ,
76
- ' name = andy_john' ,
76
+ ' name = andy+john' ,
77
77
  '[user-before-ppgit]' ,
78
78
  ' name = Alain Ravet' ]
79
79
  @actual_local.should == expected_local.join("\n")
@@ -83,7 +83,7 @@ context 'when there is only a user.name' do
83
83
  cmd = ppgit('john andy andy_john@test.com' )
84
84
  @actual_local, @actual_global = execute_command_g( cmd, @before_local, @before_global)
85
85
  expected_local = ['[user]' ,
86
- ' name = andy_john' ,
86
+ ' name = andy+john' ,
87
87
  ' email = andy_john@test.com' ,
88
88
  '[user-before-ppgit]' ,
89
89
  ' name = Alain Ravet' ]
@@ -104,7 +104,7 @@ context 'when there is a user.name and a user.email' do
104
104
  cmd = ppgit('john andy andy_john@test.com' )
105
105
  @actual_local, @actual_global = execute_command_g( cmd, @before_local, @before_global)
106
106
  expected_local = ['[user]' ,
107
- ' name = andy_john' ,
107
+ ' name = andy+john' ,
108
108
  ' email = andy_john@test.com',
109
109
  '[user-before-ppgit]' ,
110
110
  ' name = Alain Ravet' ,
@@ -117,7 +117,7 @@ end
117
117
  context 'when there is a user.name + email AND stored values in [user-before-ppgit]' do
118
118
  before(:all) do
119
119
  @before_local = ['[user]' ,
120
- ' name = andy_john' ,
120
+ ' name = andy+john' ,
121
121
  ' email = andy_john@test.com' ,
122
122
  '[user-before-ppgit]' ,
123
123
  ' name = Alain Ravet' ,
@@ -129,7 +129,7 @@ context 'when there is a user.name + email AND stored values in [user-before-ppg
129
129
 
130
130
  it '`ppgit artie zane artie_zane@test.com` does not overwrite the values stored in user-before-ppgit' do
131
131
  expected_local = ['[user]' ,
132
- ' name = artie_zane' ,
132
+ ' name = artie+zane' ,
133
133
  ' email = artie_zane@test.com',
134
134
  '[user-before-ppgit]' ,
135
135
  ' name = Alain Ravet' ,
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ppgit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 5
8
+ - 6
9
9
  - 0
10
- version: 0.5.0
10
+ version: 0.6.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alain Ravet
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-26 00:00:00 +02:00
18
+ date: 2010-10-07 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -54,6 +54,9 @@ files:
54
54
  - VERSION
55
55
  - bin/git-pp
56
56
  - bin/ppgit
57
+ - doc/ppgit-img1.png
58
+ - doc/ppgit-img2.png
59
+ - doc/ppgit-img3.png
57
60
  - lib/ppgit.rb
58
61
  - lib/ppgit/commands.rb
59
62
  - lib/ppgit/git_utils.rb