ttrack 0.1.3 → 0.1.4
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.
- data/lib/ttrack.rb +14 -11
- data/lib/ttrack/datastore.rb +1 -1
- metadata +4 -4
data/lib/ttrack.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# = TTrack class
|
4
|
+
#
|
5
|
+
# Class that handles communication between CLI and data storage
|
6
|
+
#
|
2
7
|
class TTrack
|
3
8
|
|
9
|
+
# At each call we need to declare the datastore
|
4
10
|
def initialize
|
5
11
|
@db = DataStore.new
|
6
12
|
end
|
@@ -25,7 +31,7 @@ class TTrack
|
|
25
31
|
status = @db.getstatus
|
26
32
|
if status
|
27
33
|
delta = Time.now - gettstart(@db.getcurrent)
|
28
|
-
puts "
|
34
|
+
puts "Tracking task '%s' | Run time: %d seconds (%.2f hours)" % [status[1], delta, delta / 3600]
|
29
35
|
else
|
30
36
|
puts "Not tracking"
|
31
37
|
end
|
@@ -47,15 +53,16 @@ class TTrack
|
|
47
53
|
def report issuename
|
48
54
|
if issuename.nil?
|
49
55
|
r = @db.gettimesheet
|
50
|
-
pstring = "%s | %s | %s | %s | %s"
|
51
|
-
puts "id | name | tstart | tstop | notes"
|
56
|
+
pstring = "%s | %s | %s | %s | %s | %d"
|
57
|
+
puts "id | name | tstart | tstop | notes | duration"
|
52
58
|
else
|
53
59
|
r = @db.getissuesidsbyname issuename
|
54
|
-
pstring = "%s | %s | %s | %s"
|
55
|
-
puts "id | tstart | tstop | notes"
|
60
|
+
pstring = "%s | %s | %s | %s | %d"
|
61
|
+
puts "id | tstart | tstop | notes | duration"
|
56
62
|
end
|
57
63
|
unless r[0].nil?
|
58
64
|
r.each do |x|
|
65
|
+
x << getissueduration(x[0])
|
59
66
|
puts pstring % x
|
60
67
|
end
|
61
68
|
else
|
@@ -143,12 +150,8 @@ class TTrack
|
|
143
150
|
|
144
151
|
def getissueduration issueid
|
145
152
|
timestamps = @db.gettime issueid
|
146
|
-
|
147
|
-
|
148
|
-
t1 - t0
|
149
|
-
else
|
150
|
-
false
|
151
|
-
end
|
153
|
+
t0, t1 = gettimeobject(timestamps[0]), gettimeobject(timestamps[1])
|
154
|
+
t1 - t0
|
152
155
|
end
|
153
156
|
|
154
157
|
def gettstart issueid
|
data/lib/ttrack/datastore.rb
CHANGED
@@ -3,7 +3,7 @@ require 'sqlite3'
|
|
3
3
|
|
4
4
|
class TTrack::DataStore
|
5
5
|
|
6
|
-
def initialize dbname=".timetrackerdb", timezone="+02:00", version='v0.1.
|
6
|
+
def initialize dbname=".timetrackerdb", timezone="+02:00", version='v0.1.4', verbosity=0
|
7
7
|
@dbname = "%s/%s" % [ENV['HOME'], dbname]
|
8
8
|
@timezone = timezone
|
9
9
|
@version = version
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ttrack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-08 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sqlite3
|
16
|
-
requirement: &
|
16
|
+
requirement: &70310507347300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 1.3.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70310507347300
|
25
25
|
description: A simple CLI time tracker
|
26
26
|
email: alexander.fortin@gmail.com
|
27
27
|
executables:
|