devlog 0.0.0 → 0.0.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/Gemfile +7 -0
- data/Gemfile.lock +58 -0
- data/README.md +24 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/devlog +20 -4
- data/devlog.gemspec +38 -6
- data/devlog.markdown +104 -1
- data/empty_devlog.markdown +5 -0
- data/lib/devlog.rb +271 -10
- data/sublime_text/.DS_Store +0 -0
- data/sublime_text/devlog.tmbundle/Snippets/begin.tmSnippet +14 -0
- data/sublime_text/devlog.tmbundle/Snippets/combegin.tmSnippet +14 -0
- data/sublime_text/devlog.tmbundle/Snippets/comend.tmSnippet +14 -0
- data/sublime_text/devlog.tmbundle/Snippets/end.tmSnippet +14 -0
- data/sublime_text/devlog.tmbundle/Snippets/link.tmSnippet +14 -0
- data/sublime_text/devlog.tmbundle/Snippets/selfbegin.tmSnippet +14 -0
- data/sublime_text/devlog.tmbundle/Snippets/selfend.tmSnippet +14 -0
- data/sublime_text/devlog.tmbundle/Snippets/tu.tmSnippet +14 -0
- data/sublime_text/devlog.tmbundle/info.plist +20 -0
- data/sublime_text/tu.py +9 -0
- data/test/devlog_test.rb +122 -7
- data/test/test_helper.rb +32 -0
- data/test_devlog.markdown +30 -0
- data/test_single_devlog.markdown +6 -0
- data/test_stats_devlog.markdown +62 -0
- metadata +49 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57d73038e69a1550073fd71d8272085ad3feb660
|
4
|
+
data.tar.gz: a234e808266dbcd543ec9f35f06cc2d2f3ea5729
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8b88776ad5e576499f5915aaec0ef8c48b7490fc096cdcb217233cd711363cf48a3a8363be4b8cdad9ce31f4e2af75ddb5172f1b1cbbee6c7e865196eac1f50
|
7
|
+
data.tar.gz: b81742c5df67f1f985908e93a6e0db8c5fb86763dc28d3d5a6ef94b2c1a806f86f7bcd7a1796393bf66fb8babbb9c07e58f110b5b9d31169511dfc368d98a39c
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (3.2.16)
|
5
|
+
i18n (~> 0.6, >= 0.6.4)
|
6
|
+
multi_json (~> 1.0)
|
7
|
+
addressable (2.3.5)
|
8
|
+
builder (3.2.2)
|
9
|
+
descendants_tracker (0.0.3)
|
10
|
+
faraday (0.9.0)
|
11
|
+
multipart-post (>= 1.2, < 3)
|
12
|
+
git (1.2.6)
|
13
|
+
github_api (0.11.2)
|
14
|
+
addressable (~> 2.3)
|
15
|
+
descendants_tracker (~> 0.0.1)
|
16
|
+
faraday (~> 0.8, < 0.10)
|
17
|
+
hashie (>= 1.2)
|
18
|
+
multi_json (>= 1.7.5, < 2.0)
|
19
|
+
nokogiri (~> 1.6.0)
|
20
|
+
oauth2
|
21
|
+
hashie (2.0.5)
|
22
|
+
highline (1.6.20)
|
23
|
+
i18n (0.6.9)
|
24
|
+
jeweler (2.0.1)
|
25
|
+
builder
|
26
|
+
bundler (>= 1.0)
|
27
|
+
git (>= 1.2.5)
|
28
|
+
github_api
|
29
|
+
highline (>= 1.6.15)
|
30
|
+
nokogiri (>= 1.5.10)
|
31
|
+
rake
|
32
|
+
rdoc
|
33
|
+
json (1.8.1)
|
34
|
+
jwt (0.1.11)
|
35
|
+
multi_json (>= 1.5)
|
36
|
+
mini_portile (0.5.2)
|
37
|
+
multi_json (1.8.4)
|
38
|
+
multi_xml (0.5.5)
|
39
|
+
multipart-post (2.0.0)
|
40
|
+
nokogiri (1.6.1)
|
41
|
+
mini_portile (~> 0.5.0)
|
42
|
+
oauth2 (0.9.3)
|
43
|
+
faraday (>= 0.8, < 0.10)
|
44
|
+
jwt (~> 0.1.8)
|
45
|
+
multi_json (~> 1.3)
|
46
|
+
multi_xml (~> 0.5)
|
47
|
+
rack (~> 1.2)
|
48
|
+
rack (1.5.2)
|
49
|
+
rake (10.1.1)
|
50
|
+
rdoc (4.1.1)
|
51
|
+
json (~> 1.4)
|
52
|
+
|
53
|
+
PLATFORMS
|
54
|
+
ruby
|
55
|
+
|
56
|
+
DEPENDENCIES
|
57
|
+
activesupport (~> 3.2)
|
58
|
+
jeweler (~> 2.0)
|
data/README.md
CHANGED
@@ -2,3 +2,27 @@ devlog
|
|
2
2
|
======
|
3
3
|
|
4
4
|
the headless standup programmer's development log writing tool
|
5
|
+
|
6
|
+
structure
|
7
|
+
=========
|
8
|
+
|
9
|
+
a devlog consists of many coding or communication sessions.
|
10
|
+
|
11
|
+
the current session is always written on the top of the file.
|
12
|
+
|
13
|
+
older sessions are towards the end of the file.
|
14
|
+
|
15
|
+
the first session is the most down, scroll down at the end of the file.
|
16
|
+
|
17
|
+
sessions are separated with beginning and end "devlog DSL" entries,
|
18
|
+
|
19
|
+
these must be entered at the start of the line.
|
20
|
+
|
21
|
+
|
22
|
+
devlog DSL
|
23
|
+
==========
|
24
|
+
|
25
|
+
#DD.MM.YYYY HH:MM:SS CodingSession::BEGIN
|
26
|
+
|
27
|
+
syntax
|
28
|
+
======
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/bin/devlog
CHANGED
@@ -24,12 +24,28 @@ def dodo
|
|
24
24
|
if @in_file
|
25
25
|
include Devlog
|
26
26
|
time = Benchmark.realtime do
|
27
|
-
t =
|
28
|
-
puts "\nSession::
|
27
|
+
t = parse_devlog_now(@in_file)
|
28
|
+
puts "\nSession::Time: = #{t.session_time} [h]\n"
|
29
29
|
puts("\nCodingSession::Time = %.1f [h]" % t.coding_session_time)
|
30
30
|
puts("\nComSession::Time = %.1f [h]" % t.com_session_time)
|
31
|
-
puts("\nCharge::Time = #{
|
32
|
-
puts("\nUnpayed::Time = #{
|
31
|
+
puts("\nCharge::Time = #{t.charge_time} [h]")
|
32
|
+
puts("\nUnpayed::Time = #{t.unpayed_time} [h]\n")
|
33
|
+
puts("\n")
|
34
|
+
puts("Num of Sessions = #{t.devlog_sessions.size}\n")
|
35
|
+
puts("Hours per Day = #{t.per_day} [h]\n")
|
36
|
+
puts("Hours per Week = #{t.per_week} [h]\n")
|
37
|
+
puts("Hours per Month = #{t.per_month} [h]\n")
|
38
|
+
puts("Hours last 7 days = #{t.hours_for_last(7)} [h]\n")
|
39
|
+
puts("Hours last 14 days = #{t.hours_for_last(14)} [h]\n")
|
40
|
+
puts("Hours last 28 days = #{t.hours_for_last(28)} [h]\n")
|
41
|
+
puts("\n")
|
42
|
+
puts("Devlog Time = #{t.devlog_days * 24} [hours]\n")
|
43
|
+
puts("Devlog Days = #{t.devlog_days} [days]\n")
|
44
|
+
puts("Devlog Weeks = #{t.devlog_weeks} [weeks]\n")
|
45
|
+
puts("Devlog Months = #{t.devlog_months} [months]\n")
|
46
|
+
puts("\n")
|
47
|
+
puts("Longest Session = #{t.longest_session.session_time.round(2)} [hours]\n")
|
48
|
+
puts("Shortest Session = #{t.shortest_session.session_time.round(2)} [hours]\n")
|
33
49
|
end
|
34
50
|
puts "\nRealtime used : #{time}sec"
|
35
51
|
end
|
data/devlog.gemspec
CHANGED
@@ -2,15 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: devlog 0.0.
|
5
|
+
# stub: devlog 0.0.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "devlog"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
12
13
|
s.authors = ["mihael"]
|
13
|
-
s.date = "2014-
|
14
|
+
s.date = "2014-02-10"
|
14
15
|
s.description = "devlog.markdown time&space extractor"
|
15
16
|
s.email = "kitschmaster@gmail.com"
|
16
17
|
s.executables = ["devlog"]
|
@@ -21,6 +22,8 @@ Gem::Specification.new do |s|
|
|
21
22
|
s.files = [
|
22
23
|
".ruby-gemset",
|
23
24
|
".ruby-version",
|
25
|
+
"Gemfile",
|
26
|
+
"Gemfile.lock",
|
24
27
|
"LICENSE",
|
25
28
|
"README.md",
|
26
29
|
"Rakefile",
|
@@ -28,14 +31,43 @@ Gem::Specification.new do |s|
|
|
28
31
|
"bin/devlog",
|
29
32
|
"devlog.gemspec",
|
30
33
|
"devlog.markdown",
|
34
|
+
"empty_devlog.markdown",
|
31
35
|
"lib/devlog.rb",
|
36
|
+
"sublime_text/.DS_Store",
|
37
|
+
"sublime_text/devlog.tmbundle/Snippets/begin.tmSnippet",
|
38
|
+
"sublime_text/devlog.tmbundle/Snippets/combegin.tmSnippet",
|
39
|
+
"sublime_text/devlog.tmbundle/Snippets/comend.tmSnippet",
|
40
|
+
"sublime_text/devlog.tmbundle/Snippets/end.tmSnippet",
|
41
|
+
"sublime_text/devlog.tmbundle/Snippets/link.tmSnippet",
|
42
|
+
"sublime_text/devlog.tmbundle/Snippets/selfbegin.tmSnippet",
|
43
|
+
"sublime_text/devlog.tmbundle/Snippets/selfend.tmSnippet",
|
44
|
+
"sublime_text/devlog.tmbundle/Snippets/tu.tmSnippet",
|
45
|
+
"sublime_text/devlog.tmbundle/info.plist",
|
46
|
+
"sublime_text/tu.py",
|
32
47
|
"test/devlog_test.rb",
|
33
|
-
"test/test_helper.rb"
|
48
|
+
"test/test_helper.rb",
|
49
|
+
"test_devlog.markdown",
|
50
|
+
"test_single_devlog.markdown",
|
51
|
+
"test_stats_devlog.markdown"
|
34
52
|
]
|
35
53
|
s.homepage = "http://github.com/mihael/devlog"
|
36
54
|
s.licenses = ["MIT"]
|
37
|
-
s.
|
38
|
-
s.rubygems_version = "2.1.11"
|
55
|
+
s.rubygems_version = "2.2.1"
|
39
56
|
s.summary = "takes devlog.markdown and gives info"
|
57
|
+
|
58
|
+
if s.respond_to? :specification_version then
|
59
|
+
s.specification_version = 4
|
60
|
+
|
61
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
62
|
+
s.add_runtime_dependency(%q<jeweler>, ["~> 2.0"])
|
63
|
+
s.add_runtime_dependency(%q<activesupport>, ["~> 3.2"])
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
66
|
+
s.add_dependency(%q<activesupport>, ["~> 3.2"])
|
67
|
+
end
|
68
|
+
else
|
69
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
70
|
+
s.add_dependency(%q<activesupport>, ["~> 3.2"])
|
71
|
+
end
|
40
72
|
end
|
41
73
|
|
data/devlog.markdown
CHANGED
@@ -1,3 +1,104 @@
|
|
1
|
+
#03.02.2014 21:02:30 CodingSession::END
|
2
|
+
|
3
|
+
added some tests, and some new calculations, the devlog binary prints out better stats... 0.0.1 it is.
|
4
|
+
|
5
|
+
#03.02.2014 09:37:36 CodingSession::BEGIN
|
6
|
+
|
7
|
+
|
8
|
+
#02.02.2014 17:06:00 CodingSession::END
|
9
|
+
|
10
|
+
experiencing some bad weather, which took down an optical cable and cut our village off the internet grid...
|
11
|
+
which is always a good time to do an open source coding session.
|
12
|
+
|
13
|
+
ii added new folder "sublime_text". it will hold everything Sublime Text snippets and commands, which make working with the devlog DSL a breeze. that said, ii feel like a marketeer, haha.
|
14
|
+
|
15
|
+
ii added this command "tu.py". which ii use the most, to insert a date time entry into the devlog, like this one #02.02.2014 14:03:35.
|
16
|
+
You can attach it to Your favourite key binding, ii usually use "ctrl+alt+t".
|
17
|
+
|
18
|
+
to install a command, drop it into
|
19
|
+
|
20
|
+
/Users/You/Library/Application Suport/Sublime Text 3/Packages/User/
|
21
|
+
|
22
|
+
ii added a TextMate bundle, which can be installed for Sublime Text as well. it contains these snippets:
|
23
|
+
|
24
|
+
begin+Tab : CodingSession::BEGIN
|
25
|
+
combegin+Tab: ComSession::BEGIN
|
26
|
+
end+Tab: CodingSession::END
|
27
|
+
comend+Tab: ComSession::END
|
28
|
+
selfbegin+Tab: SelfSession::BEGIN
|
29
|
+
selfend+Tab: SelfSession::END
|
30
|
+
|
31
|
+
and the last one should work in TextMate to insert time:
|
32
|
+
|
33
|
+
tu+Tab: #`date '+%d.%m.%Y %H:%M:%S'`
|
34
|
+
|
35
|
+
the tmbundle can be dropped in the same folder as the "tu.py" snippet.
|
36
|
+
|
37
|
+
just realized, the date format could be something that one would want to configure to its liking... so how would ii code that?
|
38
|
+
the snippets would have to be adjusted as well, and the parsing method would have to read some setting from somewhere. which ii dislike very much at this moment, so let me postpone this idea for someone else or some other time...
|
39
|
+
|
40
|
+
currently the parser is amazingly simple, written in a very very very short time. and it can stay like that, the devlog only needs to parse its own DSL entries from the devlog file. what ii want to to now is to extend the current code to load each coding session as a separate object, then ii want to see how much time per day, per week... and so on...
|
41
|
+
|
42
|
+
ii am in the process of learning to test ruby code, ii started doing this some time ago on my professional projects and it definitely feels very nice, have to practice more, so let me test-code the devlog and have some fun, while the internet is down and my professional life does not exist at all in this moment :).
|
43
|
+
|
44
|
+
coding... kids building lego rifles, little fast cars and minifigs...
|
45
|
+
|
46
|
+
man, ii really have to think hard to not do it old school, to not simply stare at the code and stare and stare, until ii see it and simply write it down. this time, ii have to just ask questions about the functionality, then we will stare. so the first question is, what do ii want to know:
|
47
|
+
|
48
|
+
+ how much ii coded per day in hours (this is a sum/n(sum) value)
|
49
|
+
+ how much ii coded per week in hours
|
50
|
+
+ how much ii coded per month in hours
|
51
|
+
|
52
|
+
alright! that's nice, so let me add three test methods and write the expectations...
|
53
|
+
|
54
|
+
done at #02.02.2014 14:55:46:
|
55
|
+
|
56
|
+
4 tests, 12 assertions, 0 failures, 3 errors, 0 skips
|
57
|
+
|
58
|
+
now all ii need to do is make these three methods pass, easy, and no staring at the code yet :).
|
59
|
+
kids are still playing... haha...
|
60
|
+
|
61
|
+
ii added an empty devlog, to test that too... it should not give any results other than Zero...
|
62
|
+
|
63
|
+
this works out of the box,
|
64
|
+
|
65
|
+
4 tests, 15 assertions, 0 failures, 3 errors, 0 skips
|
66
|
+
|
67
|
+
now let me see, how to implement per_day...
|
68
|
+
|
69
|
+
ii already know, ii need to keep the whole dataset of datetimes of coding session beginnings and endings somewhere in the Mind, so that ii can ... wait let me first take a look at the code... let me imeplement those methods, before ii begin any mystical thinkings, starings and so forth, let the mystery reveal itself, without me having to think a single thought... staring is thinking, isn't it... deep thinkins are not for prograamming goods... haha...
|
70
|
+
|
71
|
+
obviously the parse_devlog method returns the Tajm object, so that is where the methods belong to... for now, ... how long is now? usually not much...
|
72
|
+
|
73
|
+
ii have the methods implemented at #02.02.2014 15:10:01 and am about to run the test again... the darn thing still fails! :) and the methods are simply empty now, so let's make the tests pass by returning what, more than zero... ii would need to know exactly the hours and the some testing... so let me do something funky...
|
74
|
+
|
75
|
+
ii adedd parse_devlog_now, which will be developed as the new thing, while parse_devlog will be used as reference, to get the reference time and compare for validity.
|
76
|
+
|
77
|
+
also, this morning, ii discovered ii am unable to install gems under ruby 1.8.7 after installing that with rvm on 10.9 OSX, soo ii will add some more code to the binary script, to enable me to push this devlog to a github or any git repo actually and have the summary of the devlog parse inserted before pushing. it just requires some more commands to be implemented and some more parsing...
|
78
|
+
|
79
|
+
anyway... ii don't see any other way but to code another class...
|
80
|
+
|
81
|
+
ii called it Zezzion.
|
82
|
+
|
83
|
+
since ii would need to store each sessions begin and end, to be able to fetch only the hours between those dates that are in a day or in a week or month...
|
84
|
+
|
85
|
+
ii added class Parsing, to better express the needed calucaltions...
|
86
|
+
|
87
|
+
each Parsing represents one parsing, and holds an array of sessions read from the devlog file, these are called @zezzions.
|
88
|
+
|
89
|
+
and the kids are playing zombies, while the internets are still hovering somewhere, winter times came late...
|
90
|
+
|
91
|
+
let me add
|
92
|
+
-9000h
|
93
|
+
|
94
|
+
of communication hours to this devlog, so that tests can be written...
|
95
|
+
|
96
|
+
and start a new session higher up, after ii take some breaths...
|
97
|
+
|
98
|
+
as text gets written down, at the end of the session ii scroll to the top again and insert the ending command like: #02.02.2014 17:05:50 CodingSession::END
|
99
|
+
|
100
|
+
#02.02.2014 13:53:37 CodingSession::BEGIN
|
101
|
+
|
1
102
|
#19.01.2014 13:54:16 CodingSession::END
|
2
103
|
|
3
104
|
adding some simple testing :)
|
@@ -34,7 +135,7 @@ let me pay for all the development hours of this work in advance like this:
|
|
34
135
|
-3000h
|
35
136
|
+3000000000000$
|
36
137
|
|
37
|
-
|
138
|
+
a +300$ is an optional entry, the parser does not yet parse money, it only parses + hours and - hours, integers, ii can add two more hours like this:
|
38
139
|
+2h
|
39
140
|
|
40
141
|
or subtract three:
|
@@ -58,4 +159,6 @@ the time has come to add these features, slowly, naturally.
|
|
58
159
|
|
59
160
|
so here is the initial devlog entry for the development of the devlog tool writing software.
|
60
161
|
|
162
|
+
"2014-01-19T10:16:08+00:00"
|
163
|
+
|
61
164
|
#19.01.2014 10:16:08 CodingSession::BEGIN
|
data/lib/devlog.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "date"
|
2
|
+
require "active_support/all"
|
2
3
|
class String
|
3
4
|
def red; colorize(self, "\e[1m\e[31m"); end
|
4
5
|
def green; colorize(self, "\e[1m\e[32m"); end
|
@@ -53,20 +54,107 @@ module Devlog
|
|
53
54
|
def self.log(txt)
|
54
55
|
puts "#{txt}"
|
55
56
|
end
|
56
|
-
|
57
|
-
class Tajm
|
58
|
-
attr_accessor :coding_session_time, :com_session_time, :payed_time
|
59
|
-
def initialize
|
60
|
-
@coding_session_time = 0.0
|
61
|
-
@com_session_time = 0.0
|
62
|
-
@payed_time = 0.0
|
63
|
-
end
|
64
|
-
end
|
57
|
+
|
65
58
|
|
66
59
|
def parse_datetime(line)
|
67
60
|
parts = line[1..-1].split
|
68
61
|
DateTime.strptime("#{parts[0]} #{parts[1]}","%d.%m.%Y %H:%M:%S")
|
69
62
|
end
|
63
|
+
|
64
|
+
def parse_devlog_now(devlog=nil)
|
65
|
+
t = Parsing.new
|
66
|
+
return t unless devlog
|
67
|
+
|
68
|
+
timeEnd = nil
|
69
|
+
timeBegin = nil
|
70
|
+
in_session = false
|
71
|
+
temp_zezzion = nil
|
72
|
+
|
73
|
+
File.open(devlog, "r").each do |line|
|
74
|
+
if line =~ /-NOCHARGE/
|
75
|
+
in_session = false #do not count nocharge sessions, this is a secret feature
|
76
|
+
elsif line =~ /\A#/ && line =~ /CodingSession::END/
|
77
|
+
in_session = true
|
78
|
+
timeEnd = parse_datetime(line)
|
79
|
+
|
80
|
+
#zezzion
|
81
|
+
temp_zezzion = Zezzion.new
|
82
|
+
temp_zezzion.zzend = timeEnd
|
83
|
+
|
84
|
+
elsif line =~ /\A#/ && line =~ /CodingSession::BEGIN/
|
85
|
+
if in_session
|
86
|
+
in_session = false
|
87
|
+
timeBegin = parse_datetime(line)
|
88
|
+
#cs_time += (timeEnd - timeBegin).to_f * 24 #hours *60 #minutes *60 #seconds
|
89
|
+
delta = (timeEnd - timeBegin).to_f * 24 #hours *60 #minutes *60 #seconds
|
90
|
+
t.coding_session_time += delta
|
91
|
+
|
92
|
+
#zezzion
|
93
|
+
temp_zezzion.coding_session_time += delta
|
94
|
+
temp_zezzion.zzbegin = timeBegin
|
95
|
+
t.add_zezzion temp_zezzion
|
96
|
+
temp_zezzion = nil
|
97
|
+
|
98
|
+
end
|
99
|
+
elsif line =~ /\A#/ && line =~ /ComSession::END/
|
100
|
+
in_session = true
|
101
|
+
timeEnd = parse_datetime(line)
|
102
|
+
|
103
|
+
#zezzion
|
104
|
+
temp_zezzion = Zezzion.new(Zezzion::COM)
|
105
|
+
temp_zezzion.zzend = timeEnd
|
106
|
+
|
107
|
+
|
108
|
+
elsif line =~ /\A#/ && line =~ /ComSession::BEGIN/
|
109
|
+
if in_session
|
110
|
+
in_session = false
|
111
|
+
timeBegin = parse_datetime(line)
|
112
|
+
delta = (timeEnd - timeBegin).to_f * 24
|
113
|
+
t.com_session_time += delta
|
114
|
+
|
115
|
+
#zezzion
|
116
|
+
temp_zezzion.coding_session_time += delta
|
117
|
+
temp_zezzion.zzbegin = timeBegin
|
118
|
+
t.add_zezzion temp_zezzion
|
119
|
+
temp_zezzion = nil
|
120
|
+
|
121
|
+
end
|
122
|
+
elsif line =~ /\A\+[0-9]+[h]/
|
123
|
+
delta = line.to_f
|
124
|
+
t.com_session_time += delta
|
125
|
+
|
126
|
+
#zezzion
|
127
|
+
if temp_zezzion
|
128
|
+
temp_zezzion.com_session_time += delta
|
129
|
+
else
|
130
|
+
puts "error adding temp_zezzion com_session_time at line: #{line}"
|
131
|
+
end
|
132
|
+
elsif line =~ /\A\+[0-9]+[m]/
|
133
|
+
delta = (line.to_f / 60)
|
134
|
+
t.com_session_time += delta
|
135
|
+
|
136
|
+
#zezzion
|
137
|
+
if temp_zezzion
|
138
|
+
temp_zezzion.com_session_time += delta
|
139
|
+
else
|
140
|
+
puts "error adding temp_zezzion com_session_time at line: #{line}"
|
141
|
+
end
|
142
|
+
elsif line =~ /\A\-[0-9]+[h]/
|
143
|
+
delta = (line.to_f)
|
144
|
+
t.payed_time += delta
|
145
|
+
|
146
|
+
#zezzion
|
147
|
+
if temp_zezzion
|
148
|
+
temp_zezzion.payed_time += delta
|
149
|
+
else
|
150
|
+
puts "error adding temp_zezzion delta time at line: #{line}"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
155
|
+
#return the Parsing object
|
156
|
+
t
|
157
|
+
end
|
70
158
|
|
71
159
|
def parse_devlog(devlog=nil)
|
72
160
|
t = Tajm.new
|
@@ -107,8 +195,181 @@ module Devlog
|
|
107
195
|
end
|
108
196
|
|
109
197
|
end
|
110
|
-
#return the
|
198
|
+
#return the Tajm object
|
111
199
|
t
|
112
200
|
end
|
201
|
+
|
202
|
+
class Parsing
|
203
|
+
#this is the total time, but each sessino has these same params
|
204
|
+
attr_accessor :coding_session_time, :com_session_time, :payed_time #backward compatible object with Tajm, from devlog 0.0.0
|
205
|
+
|
206
|
+
attr_accessor :zezzions
|
207
|
+
|
208
|
+
def initialize(viewing_time_current_date=DateTime.now)
|
209
|
+
@viewing_time_current_date = viewing_time_current_date
|
210
|
+
@zezzions = []
|
211
|
+
|
212
|
+
#backward compatible object with Tajm, from devlog 0.0.0
|
213
|
+
@coding_session_time = 0.0
|
214
|
+
@com_session_time = 0.0
|
215
|
+
@payed_time = 0.0
|
216
|
+
end
|
217
|
+
|
218
|
+
def add_zezzion(zezzion)
|
219
|
+
@zezzions << zezzion
|
220
|
+
end
|
221
|
+
|
222
|
+
#gloabl devlog start, first entry
|
223
|
+
def devlog_begin
|
224
|
+
@zezzions.last.zzbegin
|
225
|
+
end
|
226
|
+
|
227
|
+
#global devlog end, last entry
|
228
|
+
def devlog_end
|
229
|
+
@zezzions.first.zzend
|
230
|
+
end
|
231
|
+
|
232
|
+
#how much time between first session begin and last session end
|
233
|
+
#in seconds
|
234
|
+
#def devlog_time
|
235
|
+
# (self.devlog_end.to_time - self.devlog_begin.to_time)/60.0/60.0
|
236
|
+
#end
|
237
|
+
|
238
|
+
def session_time
|
239
|
+
@zezzions.inject(time=0){|time, zezzion| time+zezzion.session_time}.round(2)
|
240
|
+
end
|
241
|
+
|
242
|
+
#how many days devlog spans
|
243
|
+
def devlog_days
|
244
|
+
count_time(:days=>1)
|
245
|
+
#(self.devlog_end - self.devlog_begin).to_i + 1 #counting days like this, would not account for daylight saving changes
|
246
|
+
end
|
247
|
+
|
248
|
+
#how many weeks devlog spans
|
249
|
+
def devlog_weeks
|
250
|
+
(devlog_days/7.0).round(2)
|
251
|
+
end
|
252
|
+
|
253
|
+
def devlog_months
|
254
|
+
count_time(:months=>1)
|
255
|
+
end
|
256
|
+
|
257
|
+
#hours per day
|
258
|
+
def per_day
|
259
|
+
(self.session_time/self.devlog_days).round(2)
|
260
|
+
end
|
261
|
+
def per_week
|
262
|
+
(self.session_time/self.devlog_weeks).round(2)
|
263
|
+
end
|
264
|
+
def per_month
|
265
|
+
(self.session_time/self.devlog_months).round(2)
|
266
|
+
end
|
267
|
+
|
268
|
+
#total charge time in hours, coding plus communication sessions
|
269
|
+
def charge_time
|
270
|
+
(coding_session_time + com_session_time).round(2)
|
271
|
+
end
|
272
|
+
|
273
|
+
#total charge time in hours, coding plus communication sessions - payed hours
|
274
|
+
def unpayed_time
|
275
|
+
(coding_session_time + com_session_time + payed_time).round(2)
|
276
|
+
end
|
277
|
+
|
278
|
+
#return hours worked for the last X days, from beginTime
|
279
|
+
def hours_for_last(days, beginTime=DateTime.now)
|
280
|
+
endTime = beginTime.to_time - days.days
|
281
|
+
selected_zezzions = @zezzions.select{|z| z.zzbegin.to_time<beginTime && z.zzend>=endTime}
|
282
|
+
#puts("Selected sessons from #{beginTime} to #{endTime}: #{selected_zezzions.size}")
|
283
|
+
selected_zezzions.inject(time=0){|time, z| time+z.session_time}.round(2)
|
284
|
+
end
|
285
|
+
|
286
|
+
def longest_session
|
287
|
+
@zezzions.max_by(&:session_time)
|
288
|
+
end
|
289
|
+
|
290
|
+
def shortest_session
|
291
|
+
@zezzions.min_by(&:session_time)
|
292
|
+
end
|
293
|
+
|
294
|
+
#return all sessions
|
295
|
+
def devlog_sessions
|
296
|
+
@zezzions
|
297
|
+
end
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
private
|
302
|
+
#count :weeks=>1, or :days=>1, or :years=>1
|
303
|
+
def count_time(options)
|
304
|
+
num = 0
|
305
|
+
cur = self.devlog_begin
|
306
|
+
while cur < self.devlog_end
|
307
|
+
num += 1
|
308
|
+
cur = cur.advance(options)
|
309
|
+
end
|
310
|
+
return num
|
311
|
+
end
|
312
|
+
|
313
|
+
end
|
314
|
+
|
315
|
+
|
316
|
+
class Zezzion
|
317
|
+
COM = 1
|
318
|
+
COD = 0
|
319
|
+
attr_accessor :zzbegin, :zzend, :zzbegin_title, :zzend_title, :zztype
|
320
|
+
attr_accessor :coding_session_time, :com_session_time, :payed_time
|
321
|
+
|
322
|
+
def initialize(zztype=COD)
|
323
|
+
@zztype = zztype
|
324
|
+
@zzbegin = nil
|
325
|
+
@zzend = nil
|
326
|
+
@zzbegin = nil
|
327
|
+
@zzbegin_title = nil
|
328
|
+
@zzend_title = nil
|
329
|
+
@coding_session_time = 0.0
|
330
|
+
@com_session_time = 0.0
|
331
|
+
@payed_time = 0.0
|
332
|
+
end
|
333
|
+
|
334
|
+
#in seconds
|
335
|
+
def time
|
336
|
+
@zzend.to_time - @zzbegin.to_time
|
337
|
+
end
|
338
|
+
|
339
|
+
#zezzion_time in days
|
340
|
+
def days
|
341
|
+
min = self.time / 60
|
342
|
+
hours = min / 60
|
343
|
+
days = hours / 24
|
344
|
+
end
|
345
|
+
|
346
|
+
#the whole coding session time
|
347
|
+
def session_time
|
348
|
+
@coding_session_time + @com_session_time #in seconds
|
349
|
+
end
|
350
|
+
|
351
|
+
#hours per day
|
352
|
+
def per_day
|
353
|
+
#whole time over number of days the parsing covers
|
354
|
+
session_time/days
|
355
|
+
end
|
356
|
+
def per_week
|
357
|
+
|
358
|
+
end
|
359
|
+
def per_month
|
360
|
+
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
class Tajm
|
365
|
+
attr_accessor :coding_session_time, :com_session_time, :payed_time
|
366
|
+
|
367
|
+
def initialize
|
368
|
+
@coding_session_time = 0.0
|
369
|
+
@com_session_time = 0.0
|
370
|
+
@payed_time = 0.0
|
371
|
+
end
|
372
|
+
|
373
|
+
end
|
113
374
|
|
114
375
|
end
|
Binary file
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>content</key>
|
6
|
+
<string>$1 CodingSession::BEGIN</string>
|
7
|
+
<key>name</key>
|
8
|
+
<string>begin</string>
|
9
|
+
<key>tabTrigger</key>
|
10
|
+
<string>begin</string>
|
11
|
+
<key>uuid</key>
|
12
|
+
<string>4FD91A00-AC38-410F-9257-954EBC5BE925</string>
|
13
|
+
</dict>
|
14
|
+
</plist>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>content</key>
|
6
|
+
<string>$1 ComSession::BEGIN</string>
|
7
|
+
<key>name</key>
|
8
|
+
<string>combegin</string>
|
9
|
+
<key>tabTrigger</key>
|
10
|
+
<string>combegin</string>
|
11
|
+
<key>uuid</key>
|
12
|
+
<string>551F1E72-FF3B-417B-9D85-F3E7DF7FE8E2</string>
|
13
|
+
</dict>
|
14
|
+
</plist>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>content</key>
|
6
|
+
<string>$1 ComSession::END</string>
|
7
|
+
<key>name</key>
|
8
|
+
<string>comend</string>
|
9
|
+
<key>tabTrigger</key>
|
10
|
+
<string>comend</string>
|
11
|
+
<key>uuid</key>
|
12
|
+
<string>2110A9F4-FF06-435E-8380-00EC6DBB4323</string>
|
13
|
+
</dict>
|
14
|
+
</plist>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>content</key>
|
6
|
+
<string>$1 CodingSession::END</string>
|
7
|
+
<key>name</key>
|
8
|
+
<string>end</string>
|
9
|
+
<key>tabTrigger</key>
|
10
|
+
<string>end</string>
|
11
|
+
<key>uuid</key>
|
12
|
+
<string>5BD1E38C-B3E3-43A4-A3DB-8416B1860A07</string>
|
13
|
+
</dict>
|
14
|
+
</plist>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>content</key>
|
6
|
+
<string>[$1](${0:http://url})</string>
|
7
|
+
<key>name</key>
|
8
|
+
<string>link</string>
|
9
|
+
<key>tabTrigger</key>
|
10
|
+
<string>link</string>
|
11
|
+
<key>uuid</key>
|
12
|
+
<string>4047CF8D-707D-478F-9B7A-0FF9CA022522</string>
|
13
|
+
</dict>
|
14
|
+
</plist>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>content</key>
|
6
|
+
<string>$1 SelfSession::BEGIN</string>
|
7
|
+
<key>name</key>
|
8
|
+
<string>selfbegin</string>
|
9
|
+
<key>tabTrigger</key>
|
10
|
+
<string>selfbegin</string>
|
11
|
+
<key>uuid</key>
|
12
|
+
<string>83D648DE-8FB0-4997-B293-29F48779BABA</string>
|
13
|
+
</dict>
|
14
|
+
</plist>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>content</key>
|
6
|
+
<string>$1 SelfSession::END</string>
|
7
|
+
<key>name</key>
|
8
|
+
<string>selfend</string>
|
9
|
+
<key>tabTrigger</key>
|
10
|
+
<string>selfend</string>
|
11
|
+
<key>uuid</key>
|
12
|
+
<string>931EE4CC-247D-40F3-B64A-284B19F3D15C</string>
|
13
|
+
</dict>
|
14
|
+
</plist>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>content</key>
|
6
|
+
<string>#`date '+%d.%m.%Y %H:%M:%S'`</string>
|
7
|
+
<key>name</key>
|
8
|
+
<string>tu</string>
|
9
|
+
<key>tabTrigger</key>
|
10
|
+
<string>tu</string>
|
11
|
+
<key>uuid</key>
|
12
|
+
<string>0F06AC41-635E-4686-BC21-CFCAE774F9E7</string>
|
13
|
+
</dict>
|
14
|
+
</plist>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>name</key>
|
6
|
+
<string>devlog</string>
|
7
|
+
<key>ordering</key>
|
8
|
+
<array>
|
9
|
+
<string>0F06AC41-635E-4686-BC21-CFCAE774F9E7</string>
|
10
|
+
<string>4FD91A00-AC38-410F-9257-954EBC5BE925</string>
|
11
|
+
<string>83D648DE-8FB0-4997-B293-29F48779BABA</string>
|
12
|
+
<string>551F1E72-FF3B-417B-9D85-F3E7DF7FE8E2</string>
|
13
|
+
<string>5BD1E38C-B3E3-43A4-A3DB-8416B1860A07</string>
|
14
|
+
<string>2110A9F4-FF06-435E-8380-00EC6DBB4323</string>
|
15
|
+
<string>931EE4CC-247D-40F3-B64A-284B19F3D15C</string>
|
16
|
+
</array>
|
17
|
+
<key>uuid</key>
|
18
|
+
<string>8AA4E4E3-64B6-4BD2-9507-FD54890DF7FA</string>
|
19
|
+
</dict>
|
20
|
+
</plist>
|
data/sublime_text/tu.py
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
import datetime
|
2
|
+
import sublime, sublime_plugin
|
3
|
+
|
4
|
+
class TuCommand(sublime_plugin.TextCommand):
|
5
|
+
def run(self, edit):
|
6
|
+
tu = "#%s" % (datetime.datetime.now().strftime("%d.%m.%Y %H:%M:%S"))
|
7
|
+
if len(self.view.sel()) == 1:
|
8
|
+
region = self.view.sel()[0]
|
9
|
+
self.view.insert(edit, region.a, tu)
|
data/test/devlog_test.rb
CHANGED
@@ -1,11 +1,126 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class DevlogTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
|
5
|
+
def test_empty_devlog
|
6
|
+
@tajm = parse_devlog(File.join(File.dirname(__FILE__), '..', 'empty_devlog.markdown'))
|
7
|
+
puts "#{@tajm.coding_session_time} #{@tajm.com_session_time} #{@tajm.payed_time}"
|
8
|
+
assert(@tajm.coding_session_time==0, "time is money is love")
|
9
|
+
assert(@tajm.com_session_time==0, "selftalk")
|
10
|
+
assert(@tajm.payed_time==0, "selfpay")
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_devlog_now
|
14
|
+
load_devlog
|
15
|
+
load_devlog_now
|
16
|
+
|
17
|
+
assert(@tajm.coding_session_time==@tajm_now.coding_session_time, "not equal coding times")
|
18
|
+
assert(@tajm.com_session_time==@tajm_now.com_session_time, "selftalk not repeated")
|
19
|
+
assert(@tajm.payed_time==@tajm_now.payed_time, "selfpay not equal")
|
20
|
+
|
21
|
+
assert(@tajm_now.zezzions.size>0, "where are the seeds of zezzions?")
|
22
|
+
assert(@tajm_now.unpayed_time<0, "let's make sure opensource is free to develop it self")
|
23
|
+
assert(@tajm_now.zezzions.size>4, "at least 4 recorded sessions must there be?")
|
24
|
+
assert(@tajm_now.devlog_begin.to_s=="2014-01-19T10:16:08+00:00", "a historycal moment in the akashic records was deleted, what?")
|
25
|
+
assert(@tajm_now.devlog_begin.to_time.to_i == 1390126568, "or just a random number in a random dream...")
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_devlog_test
|
29
|
+
load_devlog_test
|
30
|
+
|
31
|
+
assert(@tajm_test.coding_session_time== 4.5, "wrong total coding session time")
|
32
|
+
assert(@tajm_test.com_session_time==1.0 , "wrong com session time")
|
33
|
+
assert(@tajm_test.payed_time==-1, "wrong payed time")
|
34
|
+
assert(@tajm_test.unpayed_time==4.5, "wrong unpayed wrong")
|
35
|
+
assert(@tajm_test.charge_time==5.5, "wrong charge wrong")
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_p_session_time
|
39
|
+
p = Parsing.new
|
40
|
+
zezzion = Zezzion.new
|
41
|
+
zezzion.zzend = parse_datetime("#08.03.2014 11:00:00 CodingSession::END")
|
42
|
+
zezzion.zzbegin = parse_datetime("#08.03.2014 10:00:00 CodingSession::BEGIN")
|
43
|
+
zezzion.coding_session_time = 60*60 #1h
|
44
|
+
p.add_zezzion zezzion
|
45
|
+
zezzion.zzend = parse_datetime("#09.03.2014 11:00:00 CodingSession::END")
|
46
|
+
zezzion.zzbegin = parse_datetime("#09.03.2014 10:00:00 CodingSession::BEGIN")
|
47
|
+
zezzion.coding_session_time = 60*60 #1h
|
48
|
+
p.add_zezzion zezzion
|
49
|
+
|
50
|
+
assert(p.session_time==60*60*2, "should be 7200s but is #{p.session_time}")
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_how_much_per_day
|
54
|
+
load_devlog_stat
|
55
|
+
assert(@tajm_stat.per_day>0, "the middle day value, not the mean")
|
56
|
+
assert(@tajm_stat.per_day==1.0, "per day should be 1.0 but is #{@tajm_stat.per_day}")
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_how_much_per_week
|
60
|
+
load_devlog_stat
|
61
|
+
assert(@tajm_stat.per_week>0, "the middle week value, not the mean")
|
62
|
+
assert(@tajm_stat.per_week==7.02, "per week should be 7.02 but is #{@tajm_stat.per_week}")
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_devlog_weeks
|
66
|
+
load_devlog_stat
|
67
|
+
assert(@tajm_stat.devlog_weeks==1.14, "devlog weeks should be 1.14 but is #{@tajm_stat.devlog_weeks}")
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_how_much_per_month
|
71
|
+
load_devlog_stat
|
72
|
+
assert(@tajm_stat.per_week>0, "the middle month value, not the mean")
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_devlog_days_0
|
76
|
+
load_devlog_test
|
77
|
+
assert(@tajm_test.devlog_days==33, "should be 33 devlog days")
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_devlog_days_1
|
81
|
+
load_devlog_stat
|
82
|
+
assert(@tajm_stat.devlog_days==8, "should be 8 devlog days")
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_devlog_days_2
|
86
|
+
load_devlog_single
|
87
|
+
assert(@tajm_single.devlog_days==1, "should be 1 devlog day")
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_devlog_begin
|
91
|
+
load_devlog_stat
|
92
|
+
assert(@tajm_stat.devlog_begin.to_s=="2014-03-01T10:00:00+00:00", "devlog begin is wrong")
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_devlog_end
|
96
|
+
load_devlog_stat
|
97
|
+
assert(@tajm_stat.devlog_end.to_s=="2014-03-08T11:00:00+00:00", "devlog end is wrong")
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_hours_for_last7
|
101
|
+
load_devlog_stat
|
102
|
+
hours = @tajm_stat.hours_for_last(0, parse_datetime("#09.03.2014 11:00:00"))
|
103
|
+
assert(hours==0, "should be 0, but is #{hours}")
|
104
|
+
end
|
105
|
+
def test_hours_for_last7
|
106
|
+
load_devlog_stat
|
107
|
+
hours = @tajm_stat.hours_for_last(7, parse_datetime("#09.03.2014 11:00:00"))
|
108
|
+
assert(hours==7, "should be 7, but is #{hours}")
|
109
|
+
end
|
110
|
+
def test_hours_for_last1
|
111
|
+
load_devlog_stat
|
112
|
+
hours = @tajm_stat.hours_for_last(1, parse_datetime("#09.03.2014 11:00:00"))
|
113
|
+
assert(hours==1, "should be 1, but is #{hours}")
|
114
|
+
|
115
|
+
end
|
116
|
+
def test_hours_for_last7
|
117
|
+
load_devlog_stat
|
118
|
+
hours = @tajm_stat.hours_for_last(7, parse_datetime("#20.03.2014 11:00:00"))
|
119
|
+
assert(hours==0, "should be 0, but is #{hours}")
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_session_count
|
123
|
+
load_devlog_stat
|
124
|
+
assert(@tajm_stat.devlog_sessions.size==8, "should be 8, but is #{@tajm_stat.devlog_sessions.size}")
|
125
|
+
end
|
11
126
|
end
|
data/test/test_helper.rb
CHANGED
@@ -8,3 +8,35 @@ require 'devlog'
|
|
8
8
|
class Test::Unit::TestCase
|
9
9
|
include Devlog
|
10
10
|
end
|
11
|
+
|
12
|
+
def load_devlog
|
13
|
+
@tajm = parse_devlog(File.join(File.dirname(__FILE__), '..', 'devlog.markdown'))
|
14
|
+
puts "#{@tajm.coding_session_time} #{@tajm.com_session_time} #{@tajm.payed_time}"
|
15
|
+
assert(@tajm.coding_session_time>0, "no time no money no love")
|
16
|
+
assert(@tajm.com_session_time>0, "no selftalk")
|
17
|
+
assert(@tajm.payed_time<0, "no selfpay")
|
18
|
+
end
|
19
|
+
|
20
|
+
def load_devlog_now
|
21
|
+
@tajm_now = parse_devlog_now(File.join(File.dirname(__FILE__), '..', 'devlog.markdown'))
|
22
|
+
puts "#{@tajm_now.coding_session_time} #{@tajm_now.com_session_time} #{@tajm_now.payed_time}"
|
23
|
+
assert(@tajm_now.coding_session_time>0, "no time no money no love")
|
24
|
+
assert(@tajm_now.com_session_time>0, "no selftalk")
|
25
|
+
assert(@tajm_now.payed_time<0, "no selfpay")
|
26
|
+
end
|
27
|
+
|
28
|
+
def load_devlog_test
|
29
|
+
@tajm_test = parse_devlog_now(File.join(File.dirname(__FILE__), '..', 'test_devlog.markdown'))
|
30
|
+
puts "#{@tajm_test.coding_session_time} #{@tajm_test.com_session_time} #{@tajm_test.payed_time}"
|
31
|
+
assert(@tajm_test.coding_session_time>0, "no time no money no love")
|
32
|
+
assert(@tajm_test.com_session_time>0, "no selftalk")
|
33
|
+
assert(@tajm_test.payed_time<0, "no selfpay")
|
34
|
+
end
|
35
|
+
|
36
|
+
def load_devlog_stat
|
37
|
+
@tajm_stat = parse_devlog_now(File.join(File.dirname(__FILE__), '..', 'test_stats_devlog.markdown'))
|
38
|
+
end
|
39
|
+
|
40
|
+
def load_devlog_single
|
41
|
+
@tajm_single = parse_devlog_now(File.join(File.dirname(__FILE__), '..', 'test_single_devlog.markdown'))
|
42
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#02.02.2014 16:50:03 CodingSession::END
|
2
|
+
|
3
|
+
bla bla... and much more!
|
4
|
+
|
5
|
+
exactly 0.5 hours
|
6
|
+
|
7
|
+
#02.02.2014 16:20:03 CodingSession::BEGIN
|
8
|
+
|
9
|
+
|
10
|
+
#02.02.2014 11:10:10 ComSession::END
|
11
|
+
|
12
|
+
a shiny text...
|
13
|
+
|
14
|
+
this is 1 hour...
|
15
|
+
|
16
|
+
a payment of one hour:
|
17
|
+
-1h
|
18
|
+
|
19
|
+
#02.02.2014 10:10:10 ComSession::BEGIN
|
20
|
+
|
21
|
+
|
22
|
+
#01.01.2014 20:20:20 CodingSession::END
|
23
|
+
|
24
|
+
need to create a test dev log as well...
|
25
|
+
|
26
|
+
test_devlog.markdown
|
27
|
+
|
28
|
+
this session is exactly 4 hours
|
29
|
+
|
30
|
+
#01.01.2014 16:20:20 CodingSession::BEGIN
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#08.03.2014 11:00:00 CodingSession::END
|
2
|
+
|
3
|
+
coding session 1h
|
4
|
+
.
|
5
|
+
|
6
|
+
#08.03.2014 10:00:00 CodingSession::BEGIN
|
7
|
+
|
8
|
+
|
9
|
+
#07.03.2014 11:00:00 CodingSession::END
|
10
|
+
|
11
|
+
coding session 1h
|
12
|
+
.
|
13
|
+
|
14
|
+
#07.03.2014 10:00:00 CodingSession::BEGIN
|
15
|
+
|
16
|
+
|
17
|
+
#06.03.2014 11:00:00 CodingSession::END
|
18
|
+
|
19
|
+
coding session 1h
|
20
|
+
.
|
21
|
+
|
22
|
+
#06.03.2014 10:00:00 CodingSession::BEGIN
|
23
|
+
|
24
|
+
|
25
|
+
#05.03.2014 11:00:00 CodingSession::END
|
26
|
+
|
27
|
+
coding session 1h
|
28
|
+
.
|
29
|
+
|
30
|
+
#05.03.2014 10:00:00 CodingSession::BEGIN
|
31
|
+
|
32
|
+
|
33
|
+
#04.03.2014 11:00:00 CodingSession::END
|
34
|
+
|
35
|
+
coding session 1h
|
36
|
+
.
|
37
|
+
|
38
|
+
#04.03.2014 10:00:00 CodingSession::BEGIN
|
39
|
+
|
40
|
+
|
41
|
+
#03.03.2014 11:00:00 CodingSession::END
|
42
|
+
|
43
|
+
coding session 1h
|
44
|
+
.
|
45
|
+
|
46
|
+
#03.03.2014 10:00:00 CodingSession::BEGIN
|
47
|
+
|
48
|
+
|
49
|
+
#02.03.2014 11:00:00 CodingSession::END
|
50
|
+
|
51
|
+
coding session 1h
|
52
|
+
.
|
53
|
+
|
54
|
+
#02.03.2014 10:00:00 CodingSession::BEGIN
|
55
|
+
|
56
|
+
|
57
|
+
#01.03.2014 11:00:00 CodingSession::END
|
58
|
+
|
59
|
+
coding session 1h
|
60
|
+
.
|
61
|
+
|
62
|
+
#01.03.2014 10:00:00 CodingSession::BEGIN
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devlog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mihael
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
-
dependencies:
|
11
|
+
date: 2014-02-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jeweler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.2'
|
13
41
|
description: devlog.markdown time&space extractor
|
14
42
|
email: kitschmaster@gmail.com
|
15
43
|
executables:
|
@@ -21,6 +49,8 @@ extra_rdoc_files:
|
|
21
49
|
files:
|
22
50
|
- .ruby-gemset
|
23
51
|
- .ruby-version
|
52
|
+
- Gemfile
|
53
|
+
- Gemfile.lock
|
24
54
|
- LICENSE
|
25
55
|
- README.md
|
26
56
|
- Rakefile
|
@@ -28,9 +58,24 @@ files:
|
|
28
58
|
- bin/devlog
|
29
59
|
- devlog.gemspec
|
30
60
|
- devlog.markdown
|
61
|
+
- empty_devlog.markdown
|
31
62
|
- lib/devlog.rb
|
63
|
+
- sublime_text/.DS_Store
|
64
|
+
- sublime_text/devlog.tmbundle/Snippets/begin.tmSnippet
|
65
|
+
- sublime_text/devlog.tmbundle/Snippets/combegin.tmSnippet
|
66
|
+
- sublime_text/devlog.tmbundle/Snippets/comend.tmSnippet
|
67
|
+
- sublime_text/devlog.tmbundle/Snippets/end.tmSnippet
|
68
|
+
- sublime_text/devlog.tmbundle/Snippets/link.tmSnippet
|
69
|
+
- sublime_text/devlog.tmbundle/Snippets/selfbegin.tmSnippet
|
70
|
+
- sublime_text/devlog.tmbundle/Snippets/selfend.tmSnippet
|
71
|
+
- sublime_text/devlog.tmbundle/Snippets/tu.tmSnippet
|
72
|
+
- sublime_text/devlog.tmbundle/info.plist
|
73
|
+
- sublime_text/tu.py
|
32
74
|
- test/devlog_test.rb
|
33
75
|
- test/test_helper.rb
|
76
|
+
- test_devlog.markdown
|
77
|
+
- test_single_devlog.markdown
|
78
|
+
- test_stats_devlog.markdown
|
34
79
|
homepage: http://github.com/mihael/devlog
|
35
80
|
licenses:
|
36
81
|
- MIT
|
@@ -51,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
96
|
version: '0'
|
52
97
|
requirements: []
|
53
98
|
rubyforge_project:
|
54
|
-
rubygems_version: 2.1
|
99
|
+
rubygems_version: 2.2.1
|
55
100
|
signing_key:
|
56
101
|
specification_version: 4
|
57
102
|
summary: takes devlog.markdown and gives info
|