gitstatsakido 0.1.3 → 0.1.4

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/gitstats +55 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cdf92c5842db20fcb99518acf5de3de1daf96a5
4
- data.tar.gz: 61fb218e95622048114b1596319a9f0903ac65fe
3
+ metadata.gz: 97a86948f12fdfe3a9f27b3443cca2056b3aa27a
4
+ data.tar.gz: 01d651971a219f482c62ea865cd46f98dd3e718f
5
5
  SHA512:
6
- metadata.gz: c289ad3fa5e20c5d867d065b68915c4825b55d72494fac5255af53d655c41fd4546a7444e1bc94c3789e19ecbd39d506f889b1ac2b6789a9b31d6c72380375a2
7
- data.tar.gz: 29dbcab19f9f2acfde102dbb7de187c9f785f2cff5192cafdd23a84c48f260e0acd7e59e14f64217e2ee42d85942449eb52db6cf287af12a5defcc4a3b9c209b
6
+ metadata.gz: 1412a20701cb472fdf454847df319cfe6d511c7188ef06ab40106682d47acb9b040968452ea9ca288fccfcb0c80c9f2c1aa72c93c092b66ac7981660933810f5
7
+ data.tar.gz: c0d46207ceffb5c3cb657c8c3b5c8a0c0ae106aa86cbc833d1c4358c30fb1b8e1a29a119687bccadb02a125c23f4f07bbc9906bb834c808dbdcca00075cbbe79
data/bin/gitstats CHANGED
@@ -1,8 +1,61 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'gitstats'
4
+ require 'optparse'
5
+ require 'yaml'
6
+
7
+ options = {}
8
+ OptionParser.new do |opts|
9
+ opts.banner = 'Usage: gitstats [-c #] [-d #] [-e (#|Date)] [-s (#|Date)]'
10
+
11
+ opts.on("-c", "--commits COMMITS", "list # of commits for each author in descending order") do |c|
12
+ options[:commits] = c.to_i
13
+ end
14
+
15
+ opts.on("-d", "--days DAYS", "days of commits to evaluate") do |d|
16
+ options[:days] = d.to_f
17
+ end
18
+
19
+ opts.on("-s", '--startDate DATE_OR_DAYS", "include commits starting on (2016-1-31|-#) date or days previous') do |s|
20
+ if s[0] == '-'
21
+ options[:start] = DateTime.now + s.to_i
22
+ else
23
+ options[:start] = DateTime.parse(s)
24
+ end
25
+ end
26
+
27
+ opts.on("-e", '--endDate DATE_OR_DAYS", "include commits ending on (2016-2-28|-#) date or days previous') do |e|
28
+ if e[0] == '-'
29
+ options[:end] = DateTime.now + e.to_i
30
+ else
31
+ options[:end] = DateTime.parse(e)
32
+ end
33
+ end
34
+
35
+ end.parse!
36
+
37
+
38
+ if options.key?(:days) && options.key?(:start) && options.key?(:end)
39
+ puts "Please specify only up to 2 of start, end, and days"
40
+ raise Exception
41
+ end
42
+
43
+ if !options.key(:start)
44
+ if options.key?(:end) && options.key?(:days)
45
+ options[:start] = options[:end] - options[:days]
46
+ elsif options.key?(:days)
47
+ options[:start] = DateTime.now - options[:days]
48
+ end
49
+ end
50
+ if !options.key?(:end)
51
+ if options.key?(:start) && options.key?(:days)
52
+ options[:end] = options[:start] + options[:days]
53
+ end
54
+ end
4
55
 
5
56
  runme = Gitstats::Stats.new
6
57
 
7
- runme.print_info
8
- runme.print_commits
58
+ runme.print_info(options[:start], options[:end])
59
+ if options.key?(:commits)
60
+ runme.print_commits(options[:commits])
61
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitstatsakido
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lei Wang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-03 00:00:00.000000000 Z
11
+ date: 2016-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler