ryanbriones-git-pair 0.0.2 → 0.0.3

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.
@@ -21,11 +21,12 @@ I wanted a way for git to show me when a commit was made from a pair during pair
21
21
 
22
22
  # Usage
23
23
 
24
- * Add an author: `git-pair add abbr 'Person <emailaddress>'`
25
- * example: `git-pair add js 'John Smith <jsmith@example.com>'`
24
+ * Add an author: `git-pair add [--global] abbr 'Person <emailaddress>'`
25
+ * example: `git-pair add --global js 'John Smith <jsmith@example.com>'` # adds pair to ~/.gitconfig
26
+ * example: `git-pair add js 'John Smith <jsmith@example.com>'` # WARNING adds pair to current git repo
26
27
  * Show available authors: `git-pair show`
27
- * Commit with a pair: `git-pair commit [abbr] [-m 'Commit Message']`
28
+ * Commit with a pair: `git-pair commit [abbr] [git_options]`
28
29
 
29
30
  # Authors
30
31
 
31
- * [Ryan Carmelo Briones &lt;ryan.briones@brionesandco.com&gt;](mailto:ryan.briones@brionesandco.com)
32
+ * [Ryan Carmelo Briones &lt;ryan.briones@brionesandco.com&gt;](mailto:ryan.briones@brionesandco.com)
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake/gempackagetask'
3
3
 
4
4
  spec = Gem::Specification.new do |s|
5
5
  s.name = 'git-pair'
6
- s.version = '0.0.2'
6
+ s.version = '0.0.3'
7
7
  s.summary = 'Simple interface for adding your pair to a commit via git commit --author'
8
8
  s.files = FileList['[A-Z]*', 'bin/*', 'lib/**/*']
9
9
  s.has_rdoc = false
@@ -5,7 +5,7 @@ require 'git-pair/commit'
5
5
  module GitPair
6
6
  class Command
7
7
  def initialize
8
- @options = {}
8
+ @options = {:passthru => []}
9
9
  @sub_command = nil
10
10
  @sub_args = []
11
11
  end
@@ -22,17 +22,20 @@ module GitPair
22
22
  return GitPair::Author.show
23
23
  when "add"
24
24
  unless @sub_args.length == 2
25
- puts %Q(Usage: #{$0} add js "John Smith <jsmith@example.com>")
25
+ puts %Q(Usage: #{$0} add [--global] js "John Smith <jsmith@example.com>")
26
26
  return 1
27
27
  end
28
28
 
29
29
  return GitPair::Author.add(@sub_args[0], @sub_args[1], @options)
30
30
  when "commit"
31
- return GitPair::Commit.commit(@options[:message], @sub_args[0])
31
+ pair_abbr = @sub_args.shift
32
+ passthru = "#{@options[:passthru].join(' ')} -- #{@sub_args.join(' ')}"
33
+
34
+ return GitPair::Commit.commit(pair_abbr, passthru)
32
35
  else
33
36
  puts %Q(Usage: #{$0} show)
34
- puts %Q(Usage: #{$0} add js "John Smith <jsmith@example.com>")
35
- puts %Q(Usage: #{$0} commit [pair] [-m <msg>] )
37
+ puts %Q(Usage: #{$0} add [--global] js "John Smith <jsmith@example.com>")
38
+ puts %Q(Usage: #{$0} commit [pair] [git_options])
36
39
  return 0
37
40
  end
38
41
  end
@@ -40,14 +43,29 @@ module GitPair
40
43
  def parse(args)
41
44
  OptionParser.new do |opts|
42
45
 
43
- opts.on('-m <msg>') do |m|
44
- @options[:message] = m
45
- end
46
-
47
46
  opts.on('--global') do |g|
48
47
  @options[:global] = g
49
48
  end
50
49
 
50
+ # git commit options
51
+ opts.on('-a', '--all') { |a| @options[:passthru] << "-a"}
52
+ opts.on('-C <commit>', '--reuse-message=<commit>') { |c| @options[:passthru] << "-C #{c}" }
53
+ opts.on('-c <commit>', '--reedit-message=<commit>') { |c| @options[:passthru] << "-c #{c}" }
54
+ opts.on('-F <file>', '--file=<file>') { |f| @options[:passthru] << %Q(-F "#{f}") }
55
+ opts.on('-m <msg>', '--message=<msg>') { |m| @options[:passthru] << %Q(-m "#{m}") }
56
+ opts.on('-t <file>', '--template=<file>') { |t| @options[:passthru] << %Q(-t "#{t}") }
57
+ opts.on('-s', '--signoff') { |s| @options[:passthru] << "-s" }
58
+ opts.on('-n', '--no-verify') { |n| @options[:passthru] << "-n" }
59
+ opts.on('--allow-empty') { |ae| @options[:passthru] << "--allow-empty" }
60
+ opts.on('--cleanup=<mode>') { |cl| @options[:passthru] << "-cleanup=#{cl}" }
61
+ opts.on('-e', '--edit') { |e| @options[:passthru] << "-e" }
62
+ opts.on('--amend') { |am| @options[:passthru] << "--amend" }
63
+ opts.on('-i', '--include') { |i| @options[:passthru] << "-i" }
64
+ opts.on('-o', '--only') { |o| @options[:passthru] << "-o" }
65
+ opts.on('-u[<mode>]', '--untracked-files[=<mode>]') { |u| @options[:passthru] << "-u#{u}" }
66
+ opts.on('-v', '--verbose') { |v| @options[:passthru] << "-v" }
67
+ opts.on('-q', '--quiet') { |q| @options[:passthru] << "-q" }
68
+
51
69
  opts.parse!(args)
52
70
 
53
71
  end
@@ -2,16 +2,14 @@ require 'git-pair/author'
2
2
 
3
3
  module GitPair
4
4
  class Commit
5
- def self.commit(message, pair_abbr)
6
- base_command = "git commit"
5
+ def self.commit(pair_abbr, git_args)
6
+ command = "git commit"
7
7
 
8
8
  author = GitPair::Author.find_by_abbr(pair_abbr)
9
-
10
- args = []
11
- args << %Q(-m "#{message}") unless message.nil? || message.empty?
12
- args << %Q(--author="#{author}") if author
13
9
 
14
- command = "#{base_command} #{args.join(' ')}"
10
+ command << %Q( --author="#{author}") if author
11
+ command << " #{git_args}" if git_args && git_args != ""
12
+
15
13
  system(command)
16
14
  return $?
17
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ryanbriones-git-pair
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Carmelo Briones
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-28 00:00:00 -07:00
12
+ date: 2008-11-03 00:00:00 -08:00
13
13
  default_executable: git-pair
14
14
  dependencies: []
15
15