timetrap 1.11.0 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/timetrap/cli.rb +11 -4
- data/lib/timetrap/version.rb +1 -1
- data/spec/timetrap_spec.rb +18 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 932d2f57b36aa208733e8f99532073b97c224c2e
|
4
|
+
data.tar.gz: c7664fc5641cbcb202d9d368a97ec48e46fa20de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7e215bbf435d29824abae93dd2d33bdab1e98ea8fba91400a3f34e3d9b6a04f12749fa426b7e12d3db863edf648a527077d364aa074798d2e9ef2863a970fab
|
7
|
+
data.tar.gz: 8ca27f988fa422d5044964cae9dff471acd34e4d8f6fd0dbdfd5ef40c6dee1160ffb3fee2d563497a3213724bd9b1eb61d3a181707a0d66ff344747ad157f779
|
data/lib/timetrap/cli.rb
CHANGED
@@ -292,12 +292,19 @@ COMMAND is one of:
|
|
292
292
|
entry = case
|
293
293
|
when args['-i']
|
294
294
|
entry = Entry[args['-i']]
|
295
|
+
unless entry
|
296
|
+
warn "No such entry (id #{args['-i'].inspect})!"
|
297
|
+
return
|
298
|
+
end
|
295
299
|
warn "Resuming entry with id #{args['-i'].inspect} (#{entry.note})"
|
296
300
|
entry
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
+
else
|
302
|
+
last_entry = Timer.entries(Timer.current_sheet).order(:id).last
|
303
|
+
last_entry ||= Timer.entries("_#{Timer.current_sheet}").order(:id).last
|
304
|
+
warn "No entry yet on this sheet yet. Started a new entry." unless last_entry
|
305
|
+
note = (last_entry ? last_entry.note : nil)
|
306
|
+
warn "Resuming #{note.inspect} from entry ##{last_entry.id}" if note
|
307
|
+
last_entry
|
301
308
|
end
|
302
309
|
|
303
310
|
unless entry
|
data/lib/timetrap/version.rb
CHANGED
data/spec/timetrap_spec.rb
CHANGED
@@ -1241,7 +1241,18 @@ END:VCALENDAR
|
|
1241
1241
|
@last_active.should_not be_nil
|
1242
1242
|
end
|
1243
1243
|
|
1244
|
-
it "should allow to resume the last active
|
1244
|
+
it "should allow to resume the last active entry" do
|
1245
|
+
invoke 'resume'
|
1246
|
+
|
1247
|
+
Timetrap::Timer.active_entry.note.should ==(@last_active.note)
|
1248
|
+
Timetrap::Timer.active_entry.start.to_s.should == @time.to_s
|
1249
|
+
end
|
1250
|
+
|
1251
|
+
it "should allow to resume the last entry from the current sheet" do
|
1252
|
+
invoke 'sheet another another'
|
1253
|
+
invoke 'in foo11998845'
|
1254
|
+
invoke 'out'
|
1255
|
+
invoke 'sheet -'
|
1245
1256
|
invoke 'resume'
|
1246
1257
|
|
1247
1258
|
Timetrap::Timer.active_entry.note.should ==(@last_active.note)
|
@@ -1322,6 +1333,10 @@ END:VCALENDAR
|
|
1322
1333
|
|
1323
1334
|
describe "with a running entry on another sheet" do
|
1324
1335
|
before do
|
1336
|
+
invoke 'sheet sheet2'
|
1337
|
+
invoke 'in second task'
|
1338
|
+
invoke 'out'
|
1339
|
+
|
1325
1340
|
invoke 'sheet sheet1'
|
1326
1341
|
invoke 'in first task'
|
1327
1342
|
invoke 'sheet sheet2'
|
@@ -1329,7 +1344,7 @@ END:VCALENDAR
|
|
1329
1344
|
|
1330
1345
|
it "should check out of the running entry" do
|
1331
1346
|
Timetrap::Timer.active_entry('sheet1').should be_a(Timetrap::Entry)
|
1332
|
-
invoke 'resume
|
1347
|
+
invoke 'resume'
|
1333
1348
|
Timetrap::Timer.active_entry('sheet1').should be nil
|
1334
1349
|
end
|
1335
1350
|
|
@@ -1337,7 +1352,7 @@ END:VCALENDAR
|
|
1337
1352
|
now = Time.at(Time.now - 5 * 60) # 5 minutes ago
|
1338
1353
|
entry = Timetrap::Timer.active_entry('sheet1')
|
1339
1354
|
entry.should be_a(Timetrap::Entry)
|
1340
|
-
invoke "resume -a '#{now}'
|
1355
|
+
invoke "resume -a '#{now}'"
|
1341
1356
|
entry.reload.end.to_s.should == now.to_s
|
1342
1357
|
end
|
1343
1358
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timetrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Goldstein
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|