ttrack 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/ttrack +12 -3
- data/lib/ttrack/datastore.rb +6 -2
- data/lib/ttrack.rb +8 -2
- metadata +4 -4
data/bin/ttrack
CHANGED
@@ -16,14 +16,23 @@ case ARGV[0]
|
|
16
16
|
end
|
17
17
|
|
18
18
|
when 'stop' then
|
19
|
-
|
20
|
-
|
19
|
+
stop = tt.stop
|
20
|
+
if stop
|
21
|
+
puts 'Stop issue "%s", run for %s' % [
|
22
|
+
stop[:name],
|
23
|
+
Time.at(stop[:elapsed]).utc.strftime("%H hours %M minutes %S seconds")
|
24
|
+
]
|
25
|
+
else
|
26
|
+
puts('Not tracking')
|
21
27
|
end
|
22
28
|
|
23
29
|
when 'status' then
|
24
30
|
status = tt.status(ARGV[1])
|
25
31
|
unless status.nil?
|
26
|
-
puts '
|
32
|
+
puts 'Stats for task "%s": %s' % [
|
33
|
+
status[:task],
|
34
|
+
Time.at(status[:elapsed]).utc.strftime("%H hours %M minutes %S seconds")
|
35
|
+
]
|
27
36
|
else
|
28
37
|
puts "Currently not tracking"
|
29
38
|
end
|
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, timezone="+02:00", version='v0.1
|
6
|
+
def initialize dbname, timezone="+02:00", version='v0.2.1', verbosity=0
|
7
7
|
@dbname = dbname
|
8
8
|
@timezone = timezone
|
9
9
|
@version = version
|
@@ -88,7 +88,7 @@ class TTrack::DataStore
|
|
88
88
|
if current
|
89
89
|
@db.execute "UPDATE timesheet set tstop = datetime('now') WHERE id = %d" % current
|
90
90
|
@db.execute "UPDATE system SET current = '', latest = '%d'" % current
|
91
|
-
|
91
|
+
current.to_i
|
92
92
|
else
|
93
93
|
false
|
94
94
|
end
|
@@ -120,6 +120,10 @@ class TTrack::DataStore
|
|
120
120
|
@db.execute "SELECT id,tstart,tstop,synced, notes FROM timesheet WHERE name='%s'" % issuename
|
121
121
|
end
|
122
122
|
|
123
|
+
def getnamebyissueid issueid
|
124
|
+
result = @db.execute "SELECT name FROM timesheet WHERE id=%d" % issueid
|
125
|
+
end
|
126
|
+
|
123
127
|
def settstart id, tstart
|
124
128
|
@db.execute "UPDATE timesheet SET tstart=datetime('%s') WHERE id=%d" % [tstart, id]
|
125
129
|
end
|
data/lib/ttrack.rb
CHANGED
@@ -24,9 +24,14 @@ class TTrack
|
|
24
24
|
end
|
25
25
|
|
26
26
|
# Stop the current running task
|
27
|
-
# Return
|
27
|
+
# Return info about the stopped running task, false if it was not tracking
|
28
28
|
def stop
|
29
|
-
@db.stoprunning
|
29
|
+
result = @db.stoprunning
|
30
|
+
if result and result != []
|
31
|
+
{ :name => @db.getnamebyissueid(result)[0][0], :id => result, :elapsed => getissueduration(result) }
|
32
|
+
else
|
33
|
+
false
|
34
|
+
end
|
30
35
|
end
|
31
36
|
|
32
37
|
# Get current running task status if no issuename given
|
@@ -189,3 +194,4 @@ end # End TTrack class
|
|
189
194
|
|
190
195
|
require 'ttrack/datastore'
|
191
196
|
# TODO: add support for timezone
|
197
|
+
# TODO: add version check
|
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.2.
|
4
|
+
version: 0.2.1
|
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-15 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sqlite3
|
16
|
-
requirement: &
|
16
|
+
requirement: &70168324648680 !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: *70168324648680
|
25
25
|
description: A simple CLI time tracker
|
26
26
|
email: alexander.fortin@gmail.com
|
27
27
|
executables:
|