git_time_extractor 0.3.0 → 0.3.1

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: 5cd63888dc7235ee55baee19108e6b576dbdf474
4
- data.tar.gz: a0ac045a5dd7ad3d81e763c4a76d74880dcaaf42
3
+ metadata.gz: 1e7bf5aea252dc4ba852c777e24e6c1887d0c75e
4
+ data.tar.gz: 64b45f000e6bc36468b07be0c9713a70a2850fd7
5
5
  SHA512:
6
- metadata.gz: 0363407a1a542759865af72d0958e2af5c4fa1dc235e78bdd56ac6fb2a4809f47275d25618b45bd8769a4cbb54c27751fcaefbb49fc5c0d942f76d5caa90756a
7
- data.tar.gz: 503fe4be1588f616c93911c073a59e1bc8a563e12790cc5532c266f39108967e30a2ebbbb7c4c2415a8ad685b29b85068f91fa0ba707e19b40e828664e1d2ac7
6
+ metadata.gz: a60472dcdde1f9a9db681af4a37ad1eb8bc0b8a8c9d84815b00997536dbca6194445ac3009aef9c4223ba0033787dcb87824c0d100cac581c787aefc191f0d10
7
+ data.tar.gz: 5ed84870e1a41aa44db2b72324e2829977f55cbea77ffa7d6d8b2a62e7b69050a7f127f79ac1a56be0c13bfc8a83e3dbb54945a4c0b4e3599d4229ba063bb206
@@ -20,7 +20,8 @@
20
20
  :max_commits => 10000,
21
21
  :initial_effort_mins => 30,
22
22
  :merge_effort_mins => 30,
23
- :session_duration_hrs => 3
23
+ :session_duration_hrs => 3,
24
+ :filter_by_year => nil,
24
25
  }
25
26
 
26
27
  valid_usage = false
@@ -43,6 +44,16 @@
43
44
  options[:max_commits] = max_commits
44
45
  end
45
46
 
47
+ opts.on('-y YEAR', '--year YEAR',
48
+ "Filter for commits in a given four digit year, such as #{Date.today.year} or #{Date.today.year - 1}. Default: Records for all years."
49
+ ) do |filter_by_year|
50
+ if filter_by_year.to_i > 0
51
+ options[:filter_by_year] = filter_by_year.to_i
52
+ else
53
+ STDERR.puts "Ignoring non-numeric or negative year, #{filter_by_year}"
54
+ end
55
+ end
56
+
46
57
  opts.on('-e INITIAL_EFFORT', '--initial-effort INITIAL_EFFORT',
47
58
  'Initial Effort before each commit, in minutes. Default: ' + options[:initial_effort_mins].to_s ) do |initial_effort|
48
59
  options[:initial_effort_mins] = initial_effort
data/lib/author.rb CHANGED
@@ -22,7 +22,9 @@ class Author
22
22
 
23
23
  # Go through the work log
24
24
  @worklog.keys.sort.each do |date|
25
+ if date_in_filter_range(date)
25
26
  @rows << summarize(@worklog[date], date)
27
+ end
26
28
  end # worklog each
27
29
  end # tabulate_days
28
30
 
@@ -143,4 +145,12 @@ class Author
143
145
  @options[:project]
144
146
  end
145
147
 
148
+ def date_in_filter_range(date_to_check)
149
+ if @options[:filter_by_year] and date_to_check
150
+ date_to_check.strftime("%Y").to_i == @options[:filter_by_year]
151
+ else
152
+ true
153
+ end
154
+ end
155
+
146
156
  end # class
@@ -8,7 +8,7 @@
8
8
  # Portions (C) 2014 Rietta Inc. and licensed under the terms of the BSD license.
9
9
  #
10
10
  class GitTimeExtractor
11
- VERSION = '0.2.3'
11
+ VERSION = '0.3.1'
12
12
 
13
13
  require 'autoload'
14
14
  require 'set'
data/readme.md CHANGED
@@ -22,6 +22,7 @@ Usage: git_time_extractor [options]
22
22
  -i, --repo-path REPOPATH
23
23
  -o, --out OUTPUT_CSV
24
24
  -c, --max-commits MAX_COMMITS Maximum number of commits to read from Git. Default: 10000
25
+ -y, --year YEAR Filter for commits in a given four digit year, such as 2015 or 2014. Default: Records for all years.
25
26
  -e INITIAL_EFFORT, Initial Effort before each commit, in minutes. Default: 30
26
27
  --initial-effort
27
28
  -m, --merge-effort MERGE_EFFORT Effort spent merging, in minutes. Default: 30
@@ -33,6 +34,12 @@ Usage: git_time_extractor [options]
33
34
  - `cd /path/to/your/repository`
34
35
  - `git_time_extractor > time_log.csv`
35
36
 
37
+ ### Filtering for a specific year
38
+ One basic usage of `git_time_extractor` is to tabulated time spent on a project in a particular year. Using a year filter is a way to restrict the output to just records for days in a given calendar year.
39
+
40
+ `git_time_extractor -y 2014 -i ~/Projects/GreatOpenSourceWork`
41
+
42
+ Will scan the git repo in `~/Projects/GreatOpenSourceWork`, reporting only on the days between January 1, 2014, and December 31, 2015.
36
43
  ## 2. Analysis
37
44
 
38
45
  Once the you have used Git Time Extractor to prepare a CSV file, you can perform a lot of different analysis operations using a spreadsheet. See the [examples spreadsheets](examples/) for some ideas.
@@ -48,3 +55,7 @@ Redistribution and use in source and binary forms, with or without modification,
48
55
 
49
56
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50
57
 
58
+ ## 4. Further reading / other projects
59
+
60
+ - [Kimmo Brunfeldt](https://github.com/kimmobrunfeldt) has written [git-hours](
61
+ https://github.com/kimmobrunfeldt/git-hours), a NodeJS-based clone that was inspired by this `git_time_extractor`.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_time_extractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Rietta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-13 00:00:00.000000000 Z
11
+ date: 2015-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -39,8 +39,8 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.2'
41
41
  description: Compute the estimated time spent by developers working on code within
42
- a GIT repository. Useful for verifying developer time sheets and for tax purposes.
43
- See https://github.com/rietta/git_time_extractor/wiki.
42
+ a GIT repository. Useful for verifying developer time sheets and for tax purposes
43
+ and it supports filtering for a specific tax year.. See https://github.com/rietta/git_time_extractor/wiki.
44
44
  email: hello@rietta.com
45
45
  executables:
46
46
  - git_time_extractor
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  version: '0'
75
75
  requirements: []
76
76
  rubyforge_project:
77
- rubygems_version: 2.2.2
77
+ rubygems_version: 2.4.5
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Reasonable developer time log extractor that uses a GIT repository's commit