legit 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/bin/legit CHANGED
@@ -1,5 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # trap interrupts to prevent big stack traces
4
+ Signal.trap("INT") { exit 1 }
5
+
6
+ # don't buffer output
7
+ $stdout.sync = true
8
+ $stderr.sync = true
9
+
3
10
  require 'legit'
4
11
 
5
12
  Legit.start
data/lib/legit/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Legit
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/legit.rb CHANGED
@@ -2,9 +2,17 @@ require 'legit_helper'
2
2
  require 'thor'
3
3
 
4
4
  class Legit < Thor
5
- desc "log", "print a graph-like log"
6
- def log
7
- system("git log --pretty=format:'%C(yellow)%h%Creset%C(bold cyan)%d%Creset %s %Cgreen(%cr)%Creset %C(bold magenta) <%an>%Creset' --graph --abbrev-commit --date=relative")
5
+ desc "log [ARGS]", "print a graph-like log"
6
+ method_option :me, :type => :boolean, :desc => 'Only include my commits'
7
+ def log(*args)
8
+ command = []
9
+ command << "git log --pretty=format:'%C(yellow)%h%Creset%C(bold cyan)%d%Creset %s %Cgreen(%cr)%Creset %C(bold magenta) <%an>%Creset' --graph --abbrev-commit --date=relative"
10
+ command << author_equals_me if options[:me]
11
+ args.each do |arg|
12
+ command << arg
13
+ end
14
+
15
+ system(command.join(' '))
8
16
  end
9
17
 
10
18
  desc "catch-todos [TODO_FORMAT]", "Abort commit if any todos in TODO_FORMAT found"
data/lib/legit_helper.rb CHANGED
@@ -8,6 +8,14 @@ def delete_remote_branch(branch_name)
8
8
  system("git push --delete origin #{branch_name}")
9
9
  end
10
10
 
11
+ def author_equals_me
12
+ "--author='#{user_name}'"
13
+ end
14
+
15
+ def user_name
16
+ `git config --get user.name`.chomp
17
+ end
18
+
11
19
  def show(message, type = :success)
12
20
  color =
13
21
  case type
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dillon Kearns
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-01-11 00:00:00 -08:00
18
+ date: 2013-01-12 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency