gitstat 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 751b4094d104d7791e6028dd74247b0ff5c82e26
4
- data.tar.gz: 8e0afb91b799ccff7c182e5e6e49d5b6e9401159
3
+ metadata.gz: 14ae8a47ecf218ca705281a52b9de532a98a4f62
4
+ data.tar.gz: b49dfe1e29b8993a967aac6eaf9a80d6d5415691
5
5
  SHA512:
6
- metadata.gz: 8e690144cfda2eaaad66380f5146b48f89837c6db48a198a782e89040723f322307d85a8f1f4ff4a4d3c0de44134d160ee0286f9f0394276409589fd40703391
7
- data.tar.gz: a0a6b8af3c4560a27bbcd28e2a90595bf9bd7b044c35788575274efb67feeef9c67a864ef64debe6196c3fdb8a70525e7675882192d86fa10035dff9b3bdeb71
6
+ metadata.gz: 5852d01714f918c1caaed13c6ed0b109736a2a850b45a3738e24ee7ee8fe3da07451f0f2d03cadae6ef2289ee351baeaf3269a0d1594e144305787a666a7a046
7
+ data.tar.gz: 6cce182868fbf2f9735e42f1e61b53874095601ef1e0db6e9b76a2809f4fc123060dfcd6f7f4fcf25a5fded38086f404510120716505b92218ea8d9e99af564c
data/README.md CHANGED
@@ -4,22 +4,22 @@ Gitstat is a ruby gem for `git log` your repository to get valuable informations
4
4
 
5
5
  ## Installation
6
6
 
7
- $ gem install gitstat
7
+ `$ gem install gitstat`
8
8
 
9
9
  ## Usage
10
10
 
11
11
  After installing the gem, go to your repository & just type `gitstat`. Then you will get the total number of added lines / deleted lines & commits by each author in the repository.
12
12
 
13
13
  ```
14
- Author >>>> //de
14
+ Author >>>> //de
15
15
  lines added: +11839 lines | deleted: -16271 lines | total commits: 368
16
16
  ************************************************************************************
17
17
 
18
- Author >>>> Adrian Hosey
18
+ Author >>>> Adrian Hosey
19
19
  lines added: +52 lines | deleted: -10 lines | total commits: 2
20
20
  ************************************************************************************
21
21
 
22
- Author >>>> Alex Grigorovich
22
+ Author >>>> Alex Grigorovich
23
23
  lines added: +3 lines | deleted: -1 lines | total commits: 1
24
24
  ************************************************************************************
25
25
 
@@ -27,7 +27,11 @@ lines added: +3 lines | deleted: -1 lines | total commits: 1
27
27
 
28
28
  To get total number of added lines / deleted lines & commits by each author in a given period,
29
29
 
30
- `gitstat time 05/22/2015 04/30/2016`
30
+ `gitstat -t 05/22/2015 04/30/2016`
31
+
32
+
33
+ To get total number of added lines / deleted line & commits by author
34
+ `gitstat -a AUTHORNAME`
31
35
 
32
36
 
33
37
  More features coming soon.....
@@ -2,25 +2,31 @@ module Gitstat
2
2
  class CLI
3
3
 
4
4
  def initialize(*)
5
+ string = ""
5
6
  if ARGV.empty?
6
- blank
7
- elsif ARGV[0] == "time"
8
- time
7
+ string = blank
8
+ elsif ARGV.include? "-a"
9
+ string = author
10
+ elsif ARGV.include? "-t"
11
+ string = time
9
12
  end
13
+
14
+ system "bash", "-c", string
10
15
  end
11
16
 
12
17
  def blank
13
18
  str = %q{git log --format='%aN' | sort -u | while read name; do echo "Author >>>> " "$name"; git log --numstat --pretty="%H" --author="$name" | awk 'NF==3 {plus+=$1; minus+=$2} NF==1 {total++} END {printf("lines added: +%d lines \t | \t deleted: -%d lines \t | \t total commits: %d\n****************************************\n\n", plus, minus, total)}' -; done}
14
-
15
- system "bash", "-c", str
16
19
  end
17
20
 
18
21
  def time(*)
19
22
  from = ARGV[1]
20
23
  to = ARGV[2]
21
24
  str = %q{git log --format='%aN' | sort -u | while read name; do echo "Author >>>> " "$name"; git log --numstat --pretty="%H" --author="$name"} + %{ --since '#{from}' --until '#{to}' } + %q{| awk 'NF==3 {plus+=$1; minus+=$2} NF==1 {total++} END {printf("******************************************\nlines added: \t +%d lines \ndeleted: \t -%d lines \ntotal commits: \t %d\n******************************************\n\n", plus, minus, total)}' -; done}
25
+ end
22
26
 
23
- system "bash", "-c", str
27
+ def author
28
+ user = ARGV[1]
29
+ str = %q{git log --numstat --pretty="%H"} + %{--author="#{user}"} + %q{ | awk 'NF==3 {plus+=$1; minus+=$2} NF==1 {total++} END {printf("lines added: +%d\nlines deleted: -%d\ntotal commits: %d\n", plus, minus, total)}'}
24
30
  end
25
31
  end
26
32
  end
@@ -1,3 +1,3 @@
1
1
  module Gitstat
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitstat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - DilumN
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler