git-pairing 0.3.6 → 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.
Files changed (5) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +22 -24
  3. data/bin/git-pair +10 -1
  4. data/lib/helper.rb +28 -0
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTk2ZjEwOTFhOTYyZmZiNWY1ODZlZjFmYzFlNTk3ZDZmNjQxMzdiMg==
4
+ OTA4NDk4YzcxZDI5NzBjMTAxMmNhYmRhMGVlYzc0NTZlNDZkMWUxYw==
5
5
  data.tar.gz: !binary |-
6
- NjE1ZDUwNDYzMTAyOGZjNTQ3ODc3MDcwZGUyYzk4YzRkNmQ4ZWMxOA==
6
+ OWQ1Mjc3OGM4YTg0NWNlMzI3OWVlYjQ3NWJhNDVhYTlkYjE2ZDcyNA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZGMwMzc0M2I2ZTlmNDY2NGM1NzYxNThjMWRlZmNlNTQ3YTdjZjJiMmU1YmM3
10
- YWUyZjNlMTk4NWRmNjg5Y2Y2OWRjYjNhMDFkOWFjMWViY2Q4MjZmODcyMTll
11
- NGVlZjhjMTJjNTVhODU3ODJhNWJlMGI2NTY1NTk0Y2JjNjA3Y2I=
9
+ ZDVlMzhhOTliMGFmNTIxM2FlYjlkMTUwMTkyNThhMzFmNjg1YjZjNDRmNmQ2
10
+ NmQ2ODk3NTViMzIwNDA1ZTgxY2RhMDk0NGQ1YmQ4OTEyZDFhOWYxMWYwNWZk
11
+ YWQ3NmUyOWI2MzYxMWNkZWIxMjgyNzQ1ZTNhODBjY2IyNGU1N2I=
12
12
  data.tar.gz: !binary |-
13
- ODJhNjJiNmQ5ZTAzMTg3OWQ3ZmZmMTk0ZjlmZjJiZjRiNWQwZjMyN2YwMmVk
14
- YTcxNjc2OTMyMjVlOGE3YzEzMTA2OTZjMjdmNmIzODE1OGVmZDJhMDYzYTBk
15
- YjM3NTY3MjU3MmYyMzk2ZTNmZDNkOTgzMTIzZDgwZGFlYTMxMWQ=
13
+ NWE0M2VmMjliNmVhZjZlYThiYWI5ZmNhY2YyMGYwNTMyOTRlNzU1ZDM5OTNh
14
+ OWFmYjBmZTc4OWFjOTBjZjcxZDI2YTkwMjkwMzdiZDQxYWE0ZDJmNGM5MjMx
15
+ YzZjN2Y1ODEzODZkNTliMjNiYjdkMzM4NTNkNDk0ZTc1NWVlYzQ=
data/README.md CHANGED
@@ -1,17 +1,17 @@
1
1
  # INTRO
2
2
 
3
- Share code authorship when pairing and using git/github.
4
- Works well with [promptula](https://rubygems.org/gems/promptula) to show which git pair is currently
5
- configured in a git repo.
3
+ Share code authorship when pairing and using git/github. Display a
4
+ customized bash prompt to show branch, pairing authors, and colorized
5
+ git status.
6
6
 
7
7
  # Features
8
8
 
9
9
  * adds new commands to git, `git pair`, `git whoami`, and `git solo`
10
10
  * changes the git config `[user] name` to list multiple commit authors, and remembers partners per repository
11
11
  * maintains a list of pairing partners, so that you can specify multiple commit authors by their initials
12
- * prompts to configure new partners as needed
13
- * reverts back to original global settings
14
- * complements [promptula](http://github.com/wballard/promptula)
12
+ * prompts the user to configure new partners as needed
13
+ * reverts back to original global settings with `git solo` if no user is provided
14
+ * can display a bash prompt with useful git information
15
15
 
16
16
  See help for more details and available options on the commands
17
17
 
@@ -34,24 +34,6 @@ terminal/console of choice
34
34
 
35
35
  # Customizing
36
36
 
37
- ### Tweaking Promptula Command Prompt
38
-
39
- When promptula is installed along side git-pairing, it will display the
40
- pairing partners configured in a repo on the command line. Installing
41
- promptula `promptula --install` adds a line to your
42
- .bash_profile/.bashrc `export PROMPT_COMMAND='echo -ne $(promptula)'`.
43
- This allows users to keep whatever prompt they have already in place,
44
- but augments it with additional info when you are in a git repo. By
45
- default, the promptula info is at the beginning of your prompt.
46
-
47
- I prefer to have the path to my cwd in my prompt with promptula info at
48
- the end. To do that, I simply replaced the export command created by
49
- promptula in the .bash_profile/.bashrc with
50
-
51
- ```
52
- export PS1="\$(pwd) \$(promoptula) "
53
- ```
54
-
55
37
  ### Configuration
56
38
 
57
39
  The first time that `git pair` is executed, it will create a config file
@@ -64,6 +46,22 @@ addresses, and partner initials
64
46
  into the git config. Feel free to update these as well if the defaults
65
47
  do not suit your fancy.
66
48
 
49
+ ### Git-Pairing Command Prompt
50
+
51
+ git-pairing can display the pairing partners configured for a project on the
52
+ command line along with other useful information when in a git repo.
53
+
54
+ Executing `git pair --prompt` adds this feature.
55
+ * shell script is copied to your home directory
56
+ * adds a line to your .bash_profile/.bashrc to source a shell script and
57
+ set your PS1 to the __git_pairing_prompt() function
58
+ * `source ~/.git-pairing-prompt.sh`
59
+ * `export PS1="\[$(__git_pairing_prompt)\] "`
60
+ * shell script and bash_profile have default behavior that can easily be
61
+ customized by simply editing these default entries
62
+
63
+ This allows users to keep track of important info when you are in a git repo.
64
+
67
65
  # Known Issues
68
66
 
69
67
  * May make githubs graphs and stats inaccurate since it relies on the commiter's
data/bin/git-pair CHANGED
@@ -21,6 +21,7 @@ Usage:
21
21
  git pair <user-initials-1> <user-initials-2> [<user-initials-3> ...]
22
22
  git pair [-a | --add] <user-initials-1> [<user-initials-2> ...]
23
23
  git pair [-d | --delete] <user-initials-1> [<user-initials-2> ...]
24
+ git pair [-p | --prompt]
24
25
  git pair [-s | --show]
25
26
  git pair -h
26
27
 
@@ -29,6 +30,7 @@ Options are mutually exclusive:
29
30
  EOS
30
31
  opt :add, "Configures new pairing partners without modifying the existing git config", :type=>:strings
31
32
  opt :delete, "Delete pairing partners from the ~/.pairs config without modifying the existing git config", :type=>:strings
33
+ opt :prompt, "Override the PS1 to display a useful git-centric bash prompt"
32
34
  opt :show, "Display the current ~/.pairs config"
33
35
  end
34
36
 
@@ -37,7 +39,12 @@ path_to_conf = File.join(File.expand_path(ENV['HOME']),'.pairs')
37
39
  pairs_conf = GitPairs::Helper.init(path_to_conf)
38
40
 
39
41
 
40
- too_many = (opts[:show_given] && opts[:add_given]) || (opts[:show_given] && opts[:delete_given]) || (opts[:add_given] && opts[:delete_given])
42
+ too_many = opts[:show_given] && opts[:add_given]
43
+ too_many = too_many || opts[:delete_given] && opts[:show_given]
44
+ too_many = too_many || opts[:add_given] && opts[:delete_given]
45
+ too_many = too_many || opts[:show_given] && opts[:prompt_given]
46
+ too_many = too_many || opts[:delete_given] && opts[:prompt_given]
47
+ too_many = too_many || opts[:add_given] && opts[:prompt_given]
41
48
  Trollop::die "Options are mutually exclusive - please enter only one" if too_many
42
49
 
43
50
  if opts[:show_given]
@@ -58,6 +65,8 @@ elsif opts[:delete_given]
58
65
  puts ""
59
66
  pp pairs_conf
60
67
  puts ""
68
+ elsif opts[:prompt_given]
69
+ GitPairs::Helper.pair
61
70
  else
62
71
  GitPairs::Commands.set(pairs_conf, path_to_conf, ARGV.uniq)
63
72
  GitPairs::Helper.whoami
data/lib/helper.rb CHANGED
@@ -111,6 +111,34 @@ module GitPairs
111
111
  end
112
112
  end
113
113
 
114
+ def self.pair
115
+ self.git_installed?
116
+ install_with = <<jam
117
+ source ~/.git-pairing-prompt.sh
118
+ export PS1="\\[\\$(__git_pairing_prompt)\\] "
119
+ jam
120
+ confirmed = agree("Configure git-pairing bash prompt? ")
121
+ if confirmed
122
+ # copy shell script to user's home dir
123
+ home = File.expand_path('~')
124
+ `curl -o #{home}/.git-pairing-prompt.sh https://raw.github.com/glg/git-pairing/master/shell/.git-pairing-prompt.sh`
125
+ # configure prompt
126
+ [ "#{home}/.bash_profile", "#{home}/.bashrc" ].each do |profile|
127
+ if File.exists? profile
128
+ open(profile, 'a') do |f|
129
+ f.puts install_with
130
+ end
131
+ end
132
+ end
133
+ puts ""
134
+ puts Paint["Please re-source your bash_profile or bashrc", :yellow]
135
+ puts Paint["(i.e., source ~/.bash_profile", :yellow]
136
+ puts ""
137
+ puts Paint["Feel free to edit ~/.git-pairing-prompt.sh to suit your prompt preferences", :yellow]
138
+ puts ""
139
+ end
140
+ end
141
+
114
142
  def self.set(conf, authors)
115
143
  self.git_repo?
116
144
  authors.sort!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-pairing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Quince
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-02 00:00:00.000000000 Z
11
+ date: 2013-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop