devlog 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bin/devlog +34 -36
- data/devlog.gemspec +5 -5
- data/devlog.markdown +14 -1
- data/lib/devlog.rb +138 -11
- data/test/devlog_test.rb +17 -0
- data/test/test_helper.rb +5 -1
- data/test_negative_devlog.markdown +31 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c17dd2cce02aef60e7d7bc439502746a2fe7ae91
|
4
|
+
data.tar.gz: 6c6dc8f2d7ecdb2d891680a39505f623dd712d9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 380f4bc48f1de2d19d58d5a9a34c46d0150567deb3f4859c0d84fa106daaa4354ff043664df17e20c8e8c9ba3563ee1461f7df578f23115eb665e000352fa2be
|
7
|
+
data.tar.gz: 3aa058eefadc8f68692ad7d04f2091b52d9e6fcdecb453fa38fb1094d9964f1689054040f93819c66e29b9564eb6104059fa11c27cc49e51e29003380d92367c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/bin/devlog
CHANGED
@@ -2,15 +2,18 @@
|
|
2
2
|
require 'benchmark'
|
3
3
|
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib devlog.rb]))
|
4
4
|
USAGE= <<-EOF
|
5
|
-
|
5
|
+
#{Devlog.display_version}
|
6
|
+
This software is intended to parse and present information within devlog.markdown development logs.
|
6
7
|
|
7
|
-
|
8
|
+
#{'Use it as You'.green} #{'dodo'.pur}.
|
8
9
|
|
9
|
-
|
10
|
+
Using with a file:
|
10
11
|
|
11
|
-
|
12
|
+
#{'devlog'.red} /path/to/devlog.markdown
|
12
13
|
|
13
|
-
|
14
|
+
or just in a folder with a 'devlog.markdown' file:
|
15
|
+
|
16
|
+
#{'devlog'.green}
|
14
17
|
|
15
18
|
EOF
|
16
19
|
#arguments
|
@@ -18,40 +21,35 @@ $:.unshift File.join(File.dirname(__FILE__))
|
|
18
21
|
@in_file = ARGV[0]
|
19
22
|
def print_usage
|
20
23
|
puts USAGE
|
21
|
-
exit
|
22
24
|
end
|
23
25
|
def dodo
|
24
|
-
|
25
|
-
|
26
|
-
|
26
|
+
include Devlog
|
27
|
+
time = Benchmark.realtime do
|
28
|
+
if @in_file
|
29
|
+
puts "Parsing #{@in_file}...".red
|
27
30
|
t = parse_devlog_now(@in_file)
|
28
|
-
puts
|
29
|
-
puts
|
30
|
-
|
31
|
-
puts
|
32
|
-
|
33
|
-
puts
|
34
|
-
puts
|
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")
|
31
|
+
puts t.validation_string
|
32
|
+
puts t.to_info_string
|
33
|
+
else
|
34
|
+
puts "Parsing devlog.markdown in current folder...".green
|
35
|
+
t = parse_devlog_now("devlog.markdown") #try default file
|
36
|
+
puts t.validation_string
|
37
|
+
puts t.to_info_string
|
49
38
|
end
|
50
|
-
|
51
|
-
|
39
|
+
end
|
40
|
+
puts "\nRealtime used : #{time}sec\n\n"
|
52
41
|
end
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
42
|
+
|
43
|
+
begin
|
44
|
+
|
45
|
+
if ARGV.size > 0
|
46
|
+
dodo
|
47
|
+
else
|
48
|
+
dodo
|
49
|
+
end
|
50
|
+
|
51
|
+
rescue
|
52
|
+
print_usage
|
57
53
|
end
|
54
|
+
|
55
|
+
#exit
|
data/devlog.gemspec
CHANGED
@@ -2,16 +2,14 @@
|
|
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.2 ruby lib
|
6
5
|
|
7
6
|
Gem::Specification.new do |s|
|
8
7
|
s.name = "devlog"
|
9
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.3"
|
10
9
|
|
11
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
11
|
s.authors = ["mihael"]
|
14
|
-
s.date = "2014-
|
12
|
+
s.date = "2014-08-15"
|
15
13
|
s.description = "devlog.markdown time&space extractor"
|
16
14
|
s.email = "kitschmaster@gmail.com"
|
17
15
|
s.executables = ["devlog"]
|
@@ -47,12 +45,14 @@ Gem::Specification.new do |s|
|
|
47
45
|
"test/devlog_test.rb",
|
48
46
|
"test/test_helper.rb",
|
49
47
|
"test_devlog.markdown",
|
48
|
+
"test_negative_devlog.markdown",
|
50
49
|
"test_single_devlog.markdown",
|
51
50
|
"test_stats_devlog.markdown"
|
52
51
|
]
|
53
52
|
s.homepage = "http://github.com/mihael/devlog"
|
54
53
|
s.licenses = ["MIT"]
|
55
|
-
s.
|
54
|
+
s.require_paths = ["lib"]
|
55
|
+
s.rubygems_version = "2.0.14"
|
56
56
|
s.summary = "takes devlog.markdown and gives info"
|
57
57
|
|
58
58
|
if s.respond_to? :specification_version then
|
data/devlog.markdown
CHANGED
@@ -1,10 +1,23 @@
|
|
1
|
+
#15.08.2014 19:14:21 CodingSession::END
|
2
|
+
|
3
|
+
adding some nice stuff... can now see negative and zero sessions, which are basically error entries with zero or negative time.
|
4
|
+
|
5
|
+
line numbers are recorded, and printed next to the zero and negative sessions...
|
6
|
+
|
7
|
+
running 'devlog' in a folder where there is a devlog.markdown file present, it will attempt to parse and present info...
|
8
|
+
|
9
|
+
improved the output...
|
10
|
+
|
11
|
+
0.0.3 it is
|
12
|
+
|
13
|
+
#15.08.2014 16:35:49 CodingSession::BEGIN
|
14
|
+
|
1
15
|
#03.02.2014 21:02:30 CodingSession::END
|
2
16
|
|
3
17
|
added some tests, and some new calculations, the devlog binary prints out better stats... 0.0.1 it is.
|
4
18
|
|
5
19
|
#03.02.2014 09:37:36 CodingSession::BEGIN
|
6
20
|
|
7
|
-
|
8
21
|
#02.02.2014 17:06:00 CodingSession::END
|
9
22
|
|
10
23
|
experiencing some bad weather, which took down an optical cable and cut our village off the internet grid...
|
data/lib/devlog.rb
CHANGED
@@ -14,7 +14,7 @@ module Devlog
|
|
14
14
|
# :stopdoc:
|
15
15
|
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
16
16
|
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
17
|
-
VERSION = File.open(File.join(File.dirname(__FILE__), %w[.. VERSION]), 'r')
|
17
|
+
VERSION = File.open(File.join(File.dirname(__FILE__), %w[.. VERSION]), 'r').read
|
18
18
|
# :startdoc:
|
19
19
|
# Returns the version string for the library.
|
20
20
|
#
|
@@ -48,13 +48,12 @@ module Devlog
|
|
48
48
|
Dir.glob(search_me).sort.each {|rb| require rb}
|
49
49
|
end
|
50
50
|
def self.display_version
|
51
|
-
"\n#{'Devlog'.green} v#{Devlog.version}\n
|
51
|
+
"\n#{'Devlog'.green} v#{Devlog.version}\n"
|
52
52
|
end
|
53
53
|
# Write siple console log
|
54
54
|
def self.log(txt)
|
55
55
|
puts "#{txt}"
|
56
56
|
end
|
57
|
-
|
58
57
|
|
59
58
|
def parse_datetime(line)
|
60
59
|
parts = line[1..-1].split
|
@@ -63,28 +62,40 @@ module Devlog
|
|
63
62
|
|
64
63
|
def parse_devlog_now(devlog=nil)
|
65
64
|
t = Parsing.new
|
65
|
+
t.devlog_file = devlog
|
66
|
+
|
66
67
|
return t unless devlog
|
68
|
+
return t unless File.exist?(devlog)
|
67
69
|
|
68
70
|
timeEnd = nil
|
69
71
|
timeBegin = nil
|
72
|
+
timeEnd_line_number = nil
|
73
|
+
timeBegin_line_number = nil
|
70
74
|
in_session = false
|
71
75
|
temp_zezzion = nil
|
72
76
|
|
77
|
+
line_number = 0
|
73
78
|
File.open(devlog, "r").each do |line|
|
79
|
+
line_number+=1
|
80
|
+
|
74
81
|
if line =~ /-NOCHARGE/
|
75
82
|
in_session = false #do not count nocharge sessions, this is a secret feature
|
76
83
|
elsif line =~ /\A#/ && line =~ /CodingSession::END/
|
77
84
|
in_session = true
|
78
85
|
timeEnd = parse_datetime(line)
|
86
|
+
timeEnd_line_number = line_number
|
79
87
|
|
80
88
|
#zezzion
|
81
89
|
temp_zezzion = Zezzion.new
|
82
90
|
temp_zezzion.zzend = timeEnd
|
91
|
+
temp_zezzion.zzend_line_number = timeEnd_line_number
|
83
92
|
|
84
93
|
elsif line =~ /\A#/ && line =~ /CodingSession::BEGIN/
|
85
94
|
if in_session
|
86
95
|
in_session = false
|
87
96
|
timeBegin = parse_datetime(line)
|
97
|
+
timeBegin_line_number = line_number
|
98
|
+
|
88
99
|
#cs_time += (timeEnd - timeBegin).to_f * 24 #hours *60 #minutes *60 #seconds
|
89
100
|
delta = (timeEnd - timeBegin).to_f * 24 #hours *60 #minutes *60 #seconds
|
90
101
|
t.coding_session_time += delta
|
@@ -92,6 +103,7 @@ module Devlog
|
|
92
103
|
#zezzion
|
93
104
|
temp_zezzion.coding_session_time += delta
|
94
105
|
temp_zezzion.zzbegin = timeBegin
|
106
|
+
temp_zezzion.zzbegin_line_number = timeBegin_line_number
|
95
107
|
t.add_zezzion temp_zezzion
|
96
108
|
temp_zezzion = nil
|
97
109
|
|
@@ -99,22 +111,26 @@ module Devlog
|
|
99
111
|
elsif line =~ /\A#/ && line =~ /ComSession::END/
|
100
112
|
in_session = true
|
101
113
|
timeEnd = parse_datetime(line)
|
114
|
+
timeEnd_line_number = line_number
|
102
115
|
|
103
116
|
#zezzion
|
104
117
|
temp_zezzion = Zezzion.new(Zezzion::COM)
|
105
118
|
temp_zezzion.zzend = timeEnd
|
106
|
-
|
119
|
+
temp_zezzion.zzend_line_number = timeEnd_line_number
|
107
120
|
|
108
121
|
elsif line =~ /\A#/ && line =~ /ComSession::BEGIN/
|
109
122
|
if in_session
|
110
123
|
in_session = false
|
111
124
|
timeBegin = parse_datetime(line)
|
125
|
+
timeBegin_line_number = line_number
|
126
|
+
|
112
127
|
delta = (timeEnd - timeBegin).to_f * 24
|
113
128
|
t.com_session_time += delta
|
114
129
|
|
115
130
|
#zezzion
|
116
131
|
temp_zezzion.coding_session_time += delta
|
117
132
|
temp_zezzion.zzbegin = timeBegin
|
133
|
+
temp_zezzion.zzbegin_line_number = timeBegin_line_number
|
118
134
|
t.add_zezzion temp_zezzion
|
119
135
|
temp_zezzion = nil
|
120
136
|
|
@@ -200,10 +216,10 @@ module Devlog
|
|
200
216
|
end
|
201
217
|
|
202
218
|
class Parsing
|
203
|
-
#this is the total time, but each
|
219
|
+
#this is the total time, but each session has these same params
|
204
220
|
attr_accessor :coding_session_time, :com_session_time, :payed_time #backward compatible object with Tajm, from devlog 0.0.0
|
205
221
|
|
206
|
-
attr_accessor :zezzions
|
222
|
+
attr_accessor :zezzions, :devlog_file
|
207
223
|
|
208
224
|
def initialize(viewing_time_current_date=DateTime.now)
|
209
225
|
@viewing_time_current_date = viewing_time_current_date
|
@@ -213,13 +229,15 @@ module Devlog
|
|
213
229
|
@coding_session_time = 0.0
|
214
230
|
@com_session_time = 0.0
|
215
231
|
@payed_time = 0.0
|
232
|
+
|
233
|
+
@devlog_file = ""
|
216
234
|
end
|
217
235
|
|
218
236
|
def add_zezzion(zezzion)
|
219
237
|
@zezzions << zezzion
|
220
238
|
end
|
221
239
|
|
222
|
-
#
|
240
|
+
#global devlog start, first entry
|
223
241
|
def devlog_begin
|
224
242
|
@zezzions.last.zzbegin
|
225
243
|
end
|
@@ -291,14 +309,80 @@ module Devlog
|
|
291
309
|
@zezzions.min_by(&:session_time)
|
292
310
|
end
|
293
311
|
|
312
|
+
def negative_sessions
|
313
|
+
@zezzions.select{|zezzion| zezzion.session_time<0}
|
314
|
+
end
|
315
|
+
|
316
|
+
def zero_sessions
|
317
|
+
@zezzions.select{|zezzion| zezzion.session_time==0.0}
|
318
|
+
end
|
319
|
+
|
320
|
+
def zero_sessions_to_s
|
321
|
+
sessions_to_s(zero_sessions)
|
322
|
+
end
|
323
|
+
|
324
|
+
def negative_sessions_to_s
|
325
|
+
sessions_to_s(negative_sessions)
|
326
|
+
end
|
327
|
+
|
328
|
+
def last_session
|
329
|
+
@zezzions.first #devlog_begin
|
330
|
+
end
|
331
|
+
|
332
|
+
def first_session
|
333
|
+
@zezzions.last #devlog_end
|
334
|
+
end
|
335
|
+
|
294
336
|
#return all sessions
|
295
337
|
def devlog_sessions
|
296
338
|
@zezzions
|
297
339
|
end
|
298
340
|
|
341
|
+
def validation_string
|
342
|
+
vs = ""
|
343
|
+
vs << (@zezzions.any? ? '' : "No sessions recorded, add some first...\n".red)
|
344
|
+
vs << (File.exist?(self.devlog_file) ? '' : "No such file #{self.devlog_file}...\n".red)
|
345
|
+
end
|
299
346
|
|
347
|
+
def to_info_string
|
348
|
+
s = ""
|
349
|
+
s << "\nSession::Time: = #{self.session_time} [h]\n"
|
350
|
+
s << ("\nCodingSession::Time = %.1f [h]" % self.coding_session_time)
|
351
|
+
s << ("\nComSession::Time = %.1f [h]" % self.com_session_time)
|
352
|
+
s << ("\nCharge::Time = #{self.charge_time} [h]")
|
353
|
+
s << ("\nUnpayed::Time = #{self.unpayed_time.to_s.green} [h]\n")
|
354
|
+
s << ("\n")
|
355
|
+
s << ("Num of Sessions = #{self.devlog_sessions.size}\n")
|
356
|
+
s << ("Hours per Day = #{self.per_day} [h]\n")
|
357
|
+
s << ("Hours per Week = #{self.per_week} [h]\n")
|
358
|
+
s << ("Hours per Month = #{self.per_month} [h]\n")
|
359
|
+
s << ("Hours last 7 days = #{self.hours_for_last(7)} [h]\n")
|
360
|
+
s << ("Hours last 14 days = #{self.hours_for_last(14)} [h]\n")
|
361
|
+
s << ("Hours last 28 days = #{self.hours_for_last(28)} [h]\n")
|
362
|
+
s << ("\n")
|
363
|
+
s << ("Devlog Time = #{self.devlog_days * 24} [hours]\n")
|
364
|
+
s << ("Devlog Days = #{self.devlog_days} [days]\n")
|
365
|
+
s << ("Devlog Weeks = #{self.devlog_weeks} [weeks]\n")
|
366
|
+
s << ("Devlog Months = #{self.devlog_months} [months]\n")
|
367
|
+
if self.negative_sessions.any?
|
368
|
+
s << ("\n")
|
369
|
+
s << ("#{'Negative Sessions'.red} = #{self.negative_sessions_to_s}\n")
|
370
|
+
end
|
371
|
+
if self.zero_sessions.any?
|
372
|
+
s << ("\n")
|
373
|
+
s << ("#{'Zero Sessions'.blue} = #{self.zero_sessions_to_s}\n")
|
374
|
+
end
|
375
|
+
s << ("\n")
|
376
|
+
s << ("Longest Session = #{self.longest_session.session_time.round(2)} [hours]\n")
|
377
|
+
s << ("Shortest Session = #{self.shortest_session.session_time.round(2)} [hours]\n")
|
378
|
+
s << ("Last Session = #{self.devlog_end.ago_in_words}, duration: #{self.last_session.session_time.round(2)} [hours]")
|
379
|
+
end
|
300
380
|
|
301
381
|
private
|
382
|
+
def sessions_to_s(sessions)
|
383
|
+
"\n" + sessions.collect{|session| " " + session.to_s}.join("\n")
|
384
|
+
end
|
385
|
+
|
302
386
|
#count :weeks=>1, or :days=>1, or :years=>1
|
303
387
|
def count_time(options)
|
304
388
|
num = 0
|
@@ -314,10 +398,11 @@ module Devlog
|
|
314
398
|
|
315
399
|
|
316
400
|
class Zezzion
|
317
|
-
COM = 1
|
318
|
-
COD = 0
|
401
|
+
COM = 1 #communication session
|
402
|
+
COD = 0 #coding session
|
319
403
|
attr_accessor :zzbegin, :zzend, :zzbegin_title, :zzend_title, :zztype
|
320
404
|
attr_accessor :coding_session_time, :com_session_time, :payed_time
|
405
|
+
attr_accessor :zzend_line_number, :zzbegin_line_number
|
321
406
|
|
322
407
|
def initialize(zztype=COD)
|
323
408
|
@zztype = zztype
|
@@ -329,6 +414,8 @@ module Devlog
|
|
329
414
|
@coding_session_time = 0.0
|
330
415
|
@com_session_time = 0.0
|
331
416
|
@payed_time = 0.0
|
417
|
+
@zzbegin_line_number = 0
|
418
|
+
@zzend_line_number = 0
|
332
419
|
end
|
333
420
|
|
334
421
|
#in seconds
|
@@ -354,10 +441,18 @@ module Devlog
|
|
354
441
|
session_time/days
|
355
442
|
end
|
356
443
|
def per_week
|
357
|
-
|
444
|
+
#todo
|
358
445
|
end
|
359
446
|
def per_month
|
447
|
+
#todo
|
448
|
+
end
|
360
449
|
|
450
|
+
def type
|
451
|
+
zztype == 0 ? "CodingSession" : "ComSession"
|
452
|
+
end
|
453
|
+
|
454
|
+
def to_s
|
455
|
+
"#{type}, begin on line #{@zzbegin_line_number} at #{@zzbegin}, ends on line #{@zzend_line_number} at #{@zzend}, #{session_time.round(2)}[hour]"
|
361
456
|
end
|
362
457
|
end
|
363
458
|
|
@@ -371,5 +466,37 @@ module Devlog
|
|
371
466
|
end
|
372
467
|
|
373
468
|
end
|
374
|
-
|
469
|
+
|
470
|
+
end
|
471
|
+
|
472
|
+
module DateTimeAgoInWords
|
473
|
+
def ago_in_words
|
474
|
+
return 'a very very long time ago' if self.year < 1800
|
475
|
+
secs = Time.now - self
|
476
|
+
return 'just now' if secs > -1 && secs < 1
|
477
|
+
return '' if secs <= -1
|
478
|
+
pair = ago_in_words_pair(secs)
|
479
|
+
ary = ago_in_words_singularize(pair)
|
480
|
+
ary.size == 0 ? '' : ary.join(' and ') << ' ago'
|
481
|
+
end
|
482
|
+
private
|
483
|
+
def ago_in_words_pair(secs)
|
484
|
+
[[60, :seconds], [60, :minutes], [24, :hours], [100_000, :days]].map{ |count, name|
|
485
|
+
if secs > 0
|
486
|
+
secs, n = secs.divmod(count)
|
487
|
+
"#{n.to_i} #{name}"
|
488
|
+
end
|
489
|
+
}.compact.reverse[0..1]
|
490
|
+
end
|
491
|
+
def ago_in_words_singularize(pair)
|
492
|
+
if pair.size == 1
|
493
|
+
pair.map! {|part| part[0, 2].to_i == 1 ? part.chomp('s') : part }
|
494
|
+
else
|
495
|
+
pair.map! {|part| part[0, 2].to_i == 1 ? part.chomp('s') : part[0, 2].to_i == 0 ? nil : part }
|
496
|
+
end
|
497
|
+
pair.compact
|
498
|
+
end
|
499
|
+
end
|
500
|
+
class DateTime
|
501
|
+
include DateTimeAgoInWords
|
375
502
|
end
|
data/test/devlog_test.rb
CHANGED
@@ -123,4 +123,21 @@ class DevlogTest < Test::Unit::TestCase
|
|
123
123
|
load_devlog_stat
|
124
124
|
assert(@tajm_stat.devlog_sessions.size==8, "should be 8, but is #{@tajm_stat.devlog_sessions.size}")
|
125
125
|
end
|
126
|
+
|
127
|
+
def test_negative_sessions
|
128
|
+
load_devlog_negative
|
129
|
+
assert(@tajm_negative.devlog_sessions.size==5, "should be 5, but is #{@tajm_negative.devlog_sessions.size}")
|
130
|
+
shortest_session_time_rounded = @tajm_negative.shortest_session.session_time.round(2)
|
131
|
+
assert(shortest_session_time_rounded==-2, "should be -2.0, but is #{shortest_session_time_rounded}")
|
132
|
+
assert(@tajm_negative.negative_sessions.size==2, "should be 2, but is #{@tajm_negative.negative_sessions.size}")
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_zero_sessions
|
136
|
+
load_devlog_negative
|
137
|
+
assert(@tajm_negative.devlog_sessions.size==5, "should be 5, but is #{@tajm_negative.devlog_sessions.size}")
|
138
|
+
zero_session_time_rounded = @tajm_negative.zero_sessions.first.session_time.round(2)
|
139
|
+
assert(zero_session_time_rounded==0.0, "should be 0.0, but is #{zero_session_time_rounded}")
|
140
|
+
assert(@tajm_negative.zero_sessions.size==1, "should be 1, but is #{@tajm_negative.zero_sessions.size}")
|
141
|
+
end
|
142
|
+
|
126
143
|
end
|
data/test/test_helper.rb
CHANGED
@@ -39,4 +39,8 @@ end
|
|
39
39
|
|
40
40
|
def load_devlog_single
|
41
41
|
@tajm_single = parse_devlog_now(File.join(File.dirname(__FILE__), '..', 'test_single_devlog.markdown'))
|
42
|
-
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def load_devlog_negative
|
45
|
+
@tajm_negative = parse_devlog_now(File.join(File.dirname(__FILE__), '..', 'test_negative_devlog.markdown'))
|
46
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#03.02.2014 16:20:03 CodingSession::END
|
2
|
+
|
3
|
+
- 1 hour negative
|
4
|
+
|
5
|
+
#03.02.2014 17:20:03 CodingSession::BEGIN
|
6
|
+
|
7
|
+
|
8
|
+
#02.02.2014 17:20:03 CodingSession::END
|
9
|
+
|
10
|
+
1 hour positive
|
11
|
+
|
12
|
+
#02.02.2014 16:20:03 CodingSession::BEGIN
|
13
|
+
|
14
|
+
|
15
|
+
#02.02.2014 08:10:10 ComSession::END
|
16
|
+
|
17
|
+
-2 hours negative session
|
18
|
+
|
19
|
+
#02.02.2014 10:10:10 ComSession::BEGIN
|
20
|
+
|
21
|
+
#01.01.2014 20:21:20 CodingSession::END
|
22
|
+
|
23
|
+
0 session
|
24
|
+
|
25
|
+
#01.01.2014 20:21:20 CodingSession::BEGIN
|
26
|
+
|
27
|
+
#01.01.2014 20:20:20 CodingSession::END
|
28
|
+
|
29
|
+
1 hour positive session
|
30
|
+
|
31
|
+
#01.01.2014 16:20:20 CodingSession::BEGIN
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mihael
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jeweler
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- test/devlog_test.rb
|
75
75
|
- test/test_helper.rb
|
76
76
|
- test_devlog.markdown
|
77
|
+
- test_negative_devlog.markdown
|
77
78
|
- test_single_devlog.markdown
|
78
79
|
- test_stats_devlog.markdown
|
79
80
|
homepage: http://github.com/mihael/devlog
|
@@ -96,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
97
|
version: '0'
|
97
98
|
requirements: []
|
98
99
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
100
|
+
rubygems_version: 2.0.14
|
100
101
|
signing_key:
|
101
102
|
specification_version: 4
|
102
103
|
summary: takes devlog.markdown and gives info
|