timecost 0.2.0 → 0.2.2
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 +4 -4
- data/.gitignore +2 -1
- data/Gemfile +2 -0
- data/README.md +8 -7
- data/TODO.md +34 -7
- data/example.activerecord +62 -0
- data/lib/timecost/cli.rb +10 -4
- data/lib/timecost/environment.rb +23 -0
- data/lib/timecost/version.rb +1 -1
- data/timecost.gemspec +1 -0
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 268ca3ddcacee98be7bff07b48509ef135622364
|
4
|
+
data.tar.gz: f31978fd381c22d21247a3d9c46da745b1d8b774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc0f16a139f4b84a5770e719f60a977433539f9e7fb6327753211ce9597430ff31e6a86771da5bfa13eb26b9d7713214bc639f61cfe8f940b65deda82f386cde
|
7
|
+
data.tar.gz: 4012b9fc5bd734604b01b9f5f5787cb67dbb4bfb10027b4479da95875e8416591fddb7a087e5e59612aa0910c519b411c955633fe4a747d73e55e533a392f119
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Installation
|
|
8
8
|
|
9
9
|
Install the project with:
|
10
10
|
|
11
|
-
|
11
|
+
gem install timecost
|
12
12
|
|
13
13
|
Usage
|
14
14
|
-----
|
@@ -32,8 +32,8 @@ TOTAL: 3.36 hours
|
|
32
32
|
To get the time spent on your project since a given date
|
33
33
|
|
34
34
|
```
|
35
|
-
$ git timecost
|
36
|
-
set date filter to 2013-03-01
|
35
|
+
$ git timecost --after 2013-03-01
|
36
|
+
set date filter to >= 2013-03-01
|
37
37
|
(1.0) 2013-09-23T13:02:39+02:00 - 2013-09-23T14:02:39+02:00
|
38
38
|
* Glenn Y. Rolland <glenux@glenux.net>
|
39
39
|
Add support for import / export / merge of ranges.
|
@@ -42,15 +42,16 @@ TOTAL: 1.00 hours
|
|
42
42
|
```
|
43
43
|
|
44
44
|
For other possibilities
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
|
46
|
+
git timecost -h
|
47
|
+
|
48
48
|
|
49
49
|
Contributing
|
50
50
|
------------
|
51
51
|
|
52
|
-
1. Fork it ( https://github.com/
|
52
|
+
1. Fork it ( https://github.com/glenux/timecost/fork )
|
53
53
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
54
54
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
55
55
|
4. Push to the branch (`git push origin my-new-feature`)
|
56
56
|
5. Create a new Pull Request
|
57
|
+
|
data/TODO.md
CHANGED
@@ -3,17 +3,44 @@ TODO
|
|
3
3
|
|
4
4
|
Fixes and ideas for the future
|
5
5
|
|
6
|
+
## Use an in-memory database
|
7
|
+
|
8
|
+
The goal is to be able to keep associations & be able
|
9
|
+
to make request on them, without having to maintain
|
10
|
+
various data structures.
|
11
|
+
|
12
|
+
I imagine i could just use ActiveRecords for Ranges & Commit
|
13
|
+
but i fear its the impact on the code. I would like to keep
|
14
|
+
the codebase as clean as possible.
|
15
|
+
|
16
|
+
|
17
|
+
## Merge users
|
18
|
+
|
19
|
+
Set-up a config file, either global or per repository
|
20
|
+
With id => names associations, so we can merge
|
21
|
+
users who commit with various names/emails/etc
|
22
|
+
|
23
|
+
- name: "John Smith <john.smith@company.com>",
|
24
|
+
match:
|
25
|
+
- "John S. <john@example.com>",
|
26
|
+
- "John Smith <john.s@example.com>",
|
27
|
+
- "J. Smith <smith@example.com>"
|
28
|
+
- name: "Foo Bar <foobar@company.com>",
|
29
|
+
match:
|
30
|
+
- "Foo B. <foobar@example.com>"
|
31
|
+
- "Foo Bar <foobar@company.com>"
|
32
|
+
|
33
|
+
|
6
34
|
## Per user scotch
|
7
35
|
|
8
36
|
Different users have a different commit style & frequency.
|
9
37
|
We should be able to define a per-user scotch.
|
10
38
|
|
39
|
+
## Automatic scotch : Use median delay between consecutive commits, per user
|
11
40
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
return (sorted[(len - 1) / 2] + sorted[len / 2]) / 2.0
|
18
|
-
end
|
41
|
+
def median(array)
|
42
|
+
sorted = array.sort
|
43
|
+
len = sorted.length
|
44
|
+
return (sorted[(len - 1) / 2] + sorted[len / 2]) / 2.0
|
45
|
+
end
|
19
46
|
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
ActiveRecord::Base.logger = Logger.new(STDERR)
|
4
|
+
ActiveRecord::Base.colorize_logging = false
|
5
|
+
|
6
|
+
ActiveRecord::Base.establish_connection(
|
7
|
+
:adapter => "sqlite3",
|
8
|
+
:dbfile => ":memory:"
|
9
|
+
)
|
10
|
+
|
11
|
+
ActiveRecord::Schema.define do
|
12
|
+
create_table :albums do |table|
|
13
|
+
table.column :title, :string
|
14
|
+
table.column :performer, :string
|
15
|
+
end
|
16
|
+
|
17
|
+
create_table :tracks do |table|
|
18
|
+
table.column :album_id, :integer
|
19
|
+
table.column :track_number, :integer
|
20
|
+
table.column :title, :string
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Album < ActiveRecord::Base
|
25
|
+
has_many :tracks
|
26
|
+
end
|
27
|
+
|
28
|
+
class Track < ActiveRecord::Base
|
29
|
+
belongs_to :album
|
30
|
+
end
|
31
|
+
|
32
|
+
album = Album.create(:title => 'Black and Blue',
|
33
|
+
:performer => 'The Rolling Stones')
|
34
|
+
album.tracks.create(:track_number => 1, :title => 'Hot Stuff')
|
35
|
+
album.tracks.create(:track_number => 2, :title => 'Hand Of Fate')
|
36
|
+
album.tracks.create(:track_number => 3, :title => 'Cherry Oh Baby ')
|
37
|
+
album.tracks.create(:track_number => 4, :title => 'Memory Motel ')
|
38
|
+
album.tracks.create(:track_number => 5, :title => 'Hey Negrita')
|
39
|
+
album.tracks.create(:track_number => 6, :title => 'Fool To Cry')
|
40
|
+
album.tracks.create(:track_number => 7, :title => 'Crazy Mama')
|
41
|
+
album.tracks.create(:track_number => 8,
|
42
|
+
:title => 'Melody (Inspiration By Billy Preston)')
|
43
|
+
|
44
|
+
album = Album.create(:title => 'Sticky Fingers',
|
45
|
+
:performer => 'The Rolling Stones')
|
46
|
+
album.tracks.create(:track_number => 1, :title => 'Brown Sugar')
|
47
|
+
album.tracks.create(:track_number => 2, :title => 'Sway')
|
48
|
+
album.tracks.create(:track_number => 3, :title => 'Wild Horses')
|
49
|
+
album.tracks.create(:track_number => 4,
|
50
|
+
:title => 'Can\'t You Hear Me Knocking')
|
51
|
+
album.tracks.create(:track_number => 5, :title => 'You Gotta Move')
|
52
|
+
album.tracks.create(:track_number => 6, :title => 'Bitch')
|
53
|
+
album.tracks.create(:track_number => 7, :title => 'I Got The Blues')
|
54
|
+
album.tracks.create(:track_number => 8, :title => 'Sister Morphine')
|
55
|
+
album.tracks.create(:track_number => 9, :title => 'Dead Flowers')
|
56
|
+
album.tracks.create(:track_number => 10, :title => 'Moonlight Mile')
|
57
|
+
|
58
|
+
puts Album.find(1).tracks.length
|
59
|
+
puts Album.find(2).tracks.length
|
60
|
+
|
61
|
+
puts Album.find_by_title('Sticky Fingers').title
|
62
|
+
puts Track.find_by_title('Fool To Cry').album_id
|
data/lib/timecost/cli.rb
CHANGED
@@ -174,12 +174,18 @@ module TimeCost
|
|
174
174
|
|
175
175
|
def analyze_dumps
|
176
176
|
#read ranges
|
177
|
-
@rangelist = RangeList.new
|
178
177
|
|
179
178
|
@config[:input_dump].each do |filename|
|
180
|
-
|
181
|
-
|
182
|
-
|
179
|
+
filelists = YAML::load(File.open(filename,"r"))
|
180
|
+
# require 'pry'
|
181
|
+
# binding.pry
|
182
|
+
filelists.each do |author, rangelist|
|
183
|
+
# create list if author is new
|
184
|
+
@rangelist[author] ||= RangeList.new
|
185
|
+
|
186
|
+
rangelist.each do |range|
|
187
|
+
@rangelist[author].add range
|
188
|
+
end
|
183
189
|
end
|
184
190
|
end
|
185
191
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
|
3
|
+
ActiveRecord::Base.logger = Logger.new(STDERR)
|
4
|
+
ActiveRecord::Base.colorize_logging = false
|
5
|
+
|
6
|
+
ActiveRecord::Base.establish_connection(
|
7
|
+
:adapter => "sqlite3",
|
8
|
+
:dbfile => ":memory:"
|
9
|
+
)
|
10
|
+
|
11
|
+
ActiveRecord::Schema.define do
|
12
|
+
create_table :albums do |table|
|
13
|
+
table.column :title, :string
|
14
|
+
table.column :performer, :string
|
15
|
+
end
|
16
|
+
|
17
|
+
create_table :tracks do |table|
|
18
|
+
table.column :album_id, :integer
|
19
|
+
table.column :track_number, :integer
|
20
|
+
table.column :title, :string
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
data/lib/timecost/version.rb
CHANGED
data/timecost.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.add_runtime_dependency "activerecord", "~> 4.0"
|
21
22
|
spec.add_development_dependency "bundler", "~> 1.6"
|
22
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
24
|
spec.add_development_dependency "minitest", "~> 4.7.5"
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timecost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Glenn Y. Rolland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,16 +76,17 @@ extra_rdoc_files: []
|
|
62
76
|
files:
|
63
77
|
- ".gitignore"
|
64
78
|
- Gemfile
|
65
|
-
- Gemfile.lock
|
66
79
|
- LICENSE.txt
|
67
80
|
- README.md
|
68
81
|
- Rakefile
|
69
82
|
- TODO.md
|
70
83
|
- bin/git-timecost
|
84
|
+
- example.activerecord
|
71
85
|
- lib/timecost.rb
|
72
86
|
- lib/timecost/author_list.rb
|
73
87
|
- lib/timecost/cli.rb
|
74
88
|
- lib/timecost/commit.rb
|
89
|
+
- lib/timecost/environment.rb
|
75
90
|
- lib/timecost/range.rb
|
76
91
|
- lib/timecost/range_list.rb
|
77
92
|
- lib/timecost/version.rb
|
@@ -101,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
116
|
version: '0'
|
102
117
|
requirements: []
|
103
118
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.
|
119
|
+
rubygems_version: 2.4.5.1
|
105
120
|
signing_key:
|
106
121
|
specification_version: 4
|
107
122
|
summary: Use GIT logs to give an estimation of spent time & costs of your projects.
|