git_time_extractor 0.2.1 → 0.2.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.
- checksums.yaml +7 -0
- data/lib/git_time_extractor.rb +51 -11
- metadata +19 -25
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 67380a618ca6269c81cdbbcfeccbeacb07320737
|
4
|
+
data.tar.gz: 13ac9b92971197d84aa25ddbcb234ae653c78531
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3f6c5fd9ed017ad1b09ae83bda466c1d0d63188e052340b6dbdb15d1260b31f88c11f27f90fe56604848e28dec2e9d154427c36f853bd6b86c45ce7140d3ead6
|
7
|
+
data.tar.gz: d74d5556f3c677a1bfc2001cc4ca38d6558a5e71b1d7a68071deb8e64cede801bca5388480ea5f86fb1e4ab7a82cd960508d420026a1f63cefea36fad3ecd7a5
|
data/lib/git_time_extractor.rb
CHANGED
@@ -8,13 +8,14 @@
|
|
8
8
|
# Portions (C) 2012 Rietta Inc. and licensed under the terms of the BSD license.
|
9
9
|
#
|
10
10
|
class GitTimeExtractor
|
11
|
-
VERSION = '0.2.
|
11
|
+
VERSION = '0.2.2'
|
12
12
|
|
13
13
|
require 'rubygems'
|
14
14
|
require 'ostruct'
|
15
15
|
require 'logger'
|
16
16
|
require 'git'
|
17
17
|
require 'csv'
|
18
|
+
require 'set'
|
18
19
|
|
19
20
|
#
|
20
21
|
# Go through the GIT commit log, to compute the elapsed working time of each committing developer, based
|
@@ -42,50 +43,71 @@ class GitTimeExtractor
|
|
42
43
|
# Go through the GIT commit records and construct the time
|
43
44
|
log_entries.each_with_index do |commit, index|
|
44
45
|
author_date = commit.author_date.to_date
|
45
|
-
daylog = worklog[author_date] || OpenStruct.new(:date => author_date, :duration => 0)
|
46
|
+
daylog = worklog[author_date] || OpenStruct.new(:date => author_date, :duration => 0, :commit_count => 0, :pivotal_stories => Set.new )
|
46
47
|
daylog.author = commit.author
|
47
48
|
daylog.message = "#{daylog.message} --- #{commit.message}"
|
48
49
|
daylog.duration = daylog.duration + calc_duration_in_minutes(log_entries, index)
|
50
|
+
|
51
|
+
# The git commit count
|
52
|
+
daylog.commit_count += 1
|
53
|
+
|
54
|
+
# Pivotal Stories
|
55
|
+
stories = pivotal_ids(commit.message)
|
56
|
+
if stories
|
57
|
+
# It's a set, so each story only gets added once per day
|
58
|
+
stories.each do |sid|
|
59
|
+
daylog.pivotal_stories << sid
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
|
49
64
|
worklog[author_date] = daylog
|
50
65
|
end # log_entries.each_with_index
|
51
66
|
|
52
67
|
# Print the header row for the CSV
|
53
68
|
puts [
|
54
69
|
'Date',
|
70
|
+
'Git Commits Count',
|
71
|
+
'Pivotal Stories Count',
|
55
72
|
'Minutes',
|
56
73
|
'Hours',
|
57
74
|
'Person',
|
58
75
|
'Email',
|
59
76
|
'Project',
|
60
77
|
'Notes',
|
78
|
+
'Pivotal Stories',
|
61
79
|
'Week Number',
|
62
80
|
'Year'
|
63
81
|
].to_csv
|
64
82
|
|
65
83
|
# Go through the work log
|
66
84
|
worklog.keys.sort.each do |date|
|
67
|
-
|
85
|
+
summary = worklog[date]
|
68
86
|
start_time = DateTime.parse(date.to_s)
|
69
|
-
duration_in_seconds = (
|
70
|
-
duration_in_minutes =
|
71
|
-
duration_in_hours = (
|
87
|
+
duration_in_seconds = (summary.duration.to_f * 60.0).round(0)
|
88
|
+
duration_in_minutes = summary.duration.to_i
|
89
|
+
duration_in_hours = (summary.duration / 60.0).round(1)
|
72
90
|
|
73
91
|
stop_time = start_time + duration_in_seconds
|
92
|
+
|
74
93
|
row = [
|
75
|
-
start_time.strftime("%m/%d/%Y"),
|
94
|
+
start_time.strftime("%m/%d/%Y"),
|
95
|
+
summary.commit_count,
|
96
|
+
summary.pivotal_stories.count,
|
76
97
|
duration_in_minutes,
|
77
98
|
duration_in_hours,
|
78
|
-
|
79
|
-
|
99
|
+
summary.author.name,
|
100
|
+
summary.author.email,
|
80
101
|
project_name,
|
81
|
-
|
102
|
+
summary.message,
|
103
|
+
summary.pivotal_stories.map(&:inspect).join('; '),
|
82
104
|
start_time.strftime("%W").to_i,
|
83
105
|
start_time.strftime("%Y").to_i]
|
84
106
|
puts row.to_csv
|
85
107
|
end # worklog each
|
86
108
|
|
87
109
|
end # process_git_log_into_time
|
88
|
-
|
110
|
+
|
89
111
|
# Calculate the duration of work in minutes
|
90
112
|
def self.calc_duration_in_minutes(log_entries, index)
|
91
113
|
commit = log_entries[index]
|
@@ -108,4 +130,22 @@ class GitTimeExtractor
|
|
108
130
|
def self.say_hi
|
109
131
|
"hi"
|
110
132
|
end
|
133
|
+
|
134
|
+
# --- [#62749778] New Email Page --- Merge branch 'development' of bitbucket.org:rietta/roofregistry-web into development --- [#62749778] Roughed out email form. --- Added delete Attachment functionality --- Merge branch 'development' of bitbucket.org:rietta/roofregistry-web into development --- [#62749778] Refactored controller to be plural. --- [#62749778] Added to the Email model. --- [62749778] The email this report view formatting. --- [#62749778] Breadcrumbs in the navigation. --- [#62749778] The Emails controller routes. --- The report list is now sorted with newest first - and it shows how long ago that the change was made. --- [#62749778] The share link is bold. --- [#62749778] Recipient parsing and form fields --- [#62749778] List of emails that have received it. --- [#62749778] The email form will validate that at least one email is provided. --- [#62749778] Send Roof Report AJAX form. --- [#62749778] Default messages and the mailer --- [Finishes #62749778] The emails are sent! --- removed delete from show --- added txt and xpf to permitted file types --- Attachments can only be deleted by the owner of the roof report. --- Merge branch 'development' of bitbucket.org:rietta/roofregistry-web into development --- The test server is using production. --- Returns all recommended options across all sections with roof_report.recommedations --- patial commit --- Finished summary section --- Added caps to permitted --- added to_s to inspection --- E-mail spec is not focused at the moment. --- Merge branch 'development' of bitbucket.org:rietta/roofregistry-web into development --- fixed a few bugs --- Merge branch 'development' of bitbucket.org:rietta/roofregistry-web into development --- Disable ajax save. --- Merge branch 'development' of bitbucket.org:rietta/roofregistry-web into development
|
135
|
+
# s = "[#62749778] [#62749778] [#6274977] [#1] [#231]"
|
136
|
+
# m = s.scan /\[[A-Za-z ]{0,20}#[0-9]{1,20}\]/
|
137
|
+
def self.pivotal_ids(text)
|
138
|
+
stories = Array.new
|
139
|
+
# Extract the unique ids between brackets
|
140
|
+
if text
|
141
|
+
candidates = text.scan /\[[A-Za-z \t]{0,20}#[0-9]{1,35}[ \t]{0,5}\]/
|
142
|
+
if candidates
|
143
|
+
candidates.uniq.each do |story|
|
144
|
+
story_num = story.match(/[0-9]{1,35}/).to_s.to_i
|
145
|
+
stories << story_num if story_num > 0
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
stories.sort
|
150
|
+
end
|
111
151
|
end # class GitTimeExtractor
|
metadata
CHANGED
@@ -1,50 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_time_extractor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Frank Rietta
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-02-22 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: git
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 1.2.6
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
26
|
+
version: 1.2.6
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: logger
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
33
|
+
version: 1.2.8
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
40
|
+
version: 1.2.8
|
46
41
|
description: Compute the estimated time spent by developers working on code within
|
47
|
-
a GIT
|
42
|
+
a GIT repository. Useful for verifying developer time sheets and for tax purposes.
|
48
43
|
See https://github.com/rietta/git_time_extractor/wiki.
|
49
44
|
email: products@rietta.com
|
50
45
|
executables:
|
@@ -52,34 +47,33 @@ executables:
|
|
52
47
|
extensions: []
|
53
48
|
extra_rdoc_files: []
|
54
49
|
files:
|
55
|
-
- bin/git_time_extractor
|
56
|
-
- README.txt
|
57
50
|
- History.txt
|
51
|
+
- README.txt
|
52
|
+
- bin/git_time_extractor
|
58
53
|
- lib/git_time_extractor.rb
|
59
54
|
homepage: https://github.com/rietta/git_time_extractor
|
60
55
|
licenses:
|
61
56
|
- BSD
|
57
|
+
metadata: {}
|
62
58
|
post_install_message:
|
63
59
|
rdoc_options: []
|
64
60
|
require_paths:
|
65
61
|
- lib
|
66
62
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
63
|
requirements:
|
69
|
-
- -
|
64
|
+
- - ">="
|
70
65
|
- !ruby/object:Gem::Version
|
71
|
-
version:
|
66
|
+
version: 1.9.3
|
72
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
68
|
requirements:
|
75
|
-
- -
|
69
|
+
- - ">="
|
76
70
|
- !ruby/object:Gem::Version
|
77
71
|
version: '0'
|
78
72
|
requirements: []
|
79
73
|
rubyforge_project:
|
80
|
-
rubygems_version:
|
74
|
+
rubygems_version: 2.2.1
|
81
75
|
signing_key:
|
82
|
-
specification_version:
|
76
|
+
specification_version: 4
|
83
77
|
summary: Reasonable developer time log extractor that uses a GIT repository's commit
|
84
78
|
log history.
|
85
79
|
test_files: []
|