ppgit 0.7.1 → 0.7.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/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ 0.7.2
2
+ - fixed that `ppgit clear` would not clear when there were no local (in .git/config)
3
+ values for user.name/user.email prior to `ppgit name1 name2`
4
+ 0.7.1
5
+ - only indicate how to avoid new version warnings if there is a new version !!
1
6
  0.7.0
2
7
  - added a --names_separator option, if you don't like the default '+'
3
8
  * `ppgit ara nva` ==> user.name = 'ara+nva'
data/README.markdown CHANGED
@@ -10,13 +10,15 @@ When you're done, restore your local git config in a snap.
10
10
  Quick Usage :
11
11
  -------------
12
12
 
13
- $ ppgit john andy andy_john@acme.com
13
+ $ ppgit john andy
14
14
  $ ppgit clear
15
-
16
15
  $ ppgit info
17
16
 
18
- $ ppgit --email_root *@acme.com
19
- $ ppgit john andy
17
+ $ ppgit john andy andy_john@acme.com
18
+
19
+ $ ppgit ara nva --email_root base+*@acme.com # ==> user.email = base+ara_nva@acme.com
20
+ $ ppgit ara nva --names_separator _and_ # ==> user.name = ara_and_nva (default = '+')
21
+
20
22
 
21
23
  remark : 'ppgit' is a synonym of 'git pp' => you can write
22
24
 
@@ -53,25 +55,30 @@ Usage :
53
55
  name = Your Name
54
56
  email = your_email@address.com
55
57
 
56
- #### 3 - If your team pairs share a common email pattern (ex: ann_bob@acme.com, cid_dan@acme.com), you can specify it once and for all :
57
58
 
58
- $ ppgit --email_root *@acme.com
59
+ #### 3 - TIP : create unique email addresses for each pair based on a common address pattern
60
+ $ ppgit --email_root base+*@acme.com
59
61
 
60
- => you can now use the short syntax :
62
+ => you can use the short syntax :
61
63
 
62
64
  $ ppgit bob al
63
65
  $ ppgit dan cid
64
66
 
65
67
  are now equivalent to :
66
68
 
67
- $ ppgit bob al al_bob@acme.com
68
- $ ppgit dan cid cid_dan@acme.com
69
+ $ ppgit bob al base+al_bob@acme.com
70
+ $ ppgit dan cid base+cid_dan@acme.com
69
71
 
70
72
  This info is stored in ~/.gitconfig => it works for all your projects.
71
73
 
72
74
 
73
- #### Tip : use 1 gmail address + n aliases, so you can choose 1 unique gravatar for each pair :
75
+ #### Tip : use 1 gmail address + n aliases, so you can choose 1 unique gravatar for each pair (see 1st illustration above) :
76
+
77
+ # 1: create the gmail address :
78
+ # mycompany@gmail.com
74
79
 
80
+ # 2: use it as a base for your PP pairs :
81
+ #
75
82
  $ ppgit --email_root mycompany+*@gmail.com
76
83
 
77
84
  => you'll get
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.1
1
+ 0.7.2
data/doc/ppgit-img2.png CHANGED
Binary file
@@ -1,5 +1,10 @@
1
1
  def get_local_git_value( key) get_value(key, LOCAL_CONFIG_FILE ) end
2
2
  def get_global_git_value(key) get_value(key, GLOBAL_CONFIG_FILE) end
3
+ def get_local_or_global_git_value( key)
4
+ val = get_value(key, LOCAL_CONFIG_FILE )
5
+ val = get_value(key, GLOBAL_CONFIG_FILE) if val.blank?
6
+ val
7
+ end
3
8
 
4
9
  def set_local_git_value( key, value) set_value(key, value, LOCAL_CONFIG_FILE ) end
5
10
  def set_global_git_value(key, value) set_value(key, value, GLOBAL_CONFIG_FILE) end
@@ -42,10 +42,11 @@ def backup_git_value(options)
42
42
  source, target = options[:from], options[:to]
43
43
 
44
44
  target_already_occupied = !get_local_git_value(target).blank?
45
- nothing_to_backup = get_local_git_value(source).blank?
45
+ backupee = get_local_or_global_git_value(source)
46
+ nothing_to_backup = backupee.blank?
46
47
 
47
48
  return if target_already_occupied || nothing_to_backup
48
- set_local_git_value(target, get_local_git_value(source))
49
+ set_local_git_value(target, backupee)
49
50
  end
50
51
 
51
52
  def restore_git_value(options)
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.7.1"
8
+ s.version = "0.7.2"
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-10-10}
12
+ s.date = %q{2010-10-14}
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"]
data/spec/ppgit_spec.rb CHANGED
@@ -150,3 +150,26 @@ context 'when there is a user.name + email AND stored values in [user-before-ppg
150
150
  end
151
151
 
152
152
  end
153
+
154
+ context 'when there is only global user.name and user.email' do
155
+ before(:all) do
156
+ @before_local = []
157
+ @before_global = ['[user]' ,
158
+ ' name = Alain Ravet' ,
159
+ ' email = alainravet@gmail.com' ]
160
+ end
161
+
162
+ it '`ppgit john andy andy_john@test.com` stores the 2 existing values in [user-before-ppgit]' do
163
+ cmd = ppgit('john andy andy_john@test.com' )
164
+ @actual_local, @actual_global = execute_command_g( cmd, @before_local, @before_global)
165
+ expected_local = [
166
+ '[user-before-ppgit]' ,
167
+ ' name = Alain Ravet' ,
168
+ ' email = alainravet@gmail.com',
169
+ '[user]' ,
170
+ ' name = andy+john' ,
171
+ ' email = andy_john@test.com',
172
+ ]
173
+ @actual_local.should == expected_local.join("\n")
174
+ end
175
+ end
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: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 1
10
- version: 0.7.1
9
+ - 2
10
+ version: 0.7.2
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-10-10 00:00:00 +02:00
18
+ date: 2010-10-14 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency