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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 271617ba22c6a444786172a06c319c130e520e3e
4
- data.tar.gz: 58a80a95272541cf095d4727e580a1feda1b49f4
3
+ metadata.gz: 932d2f57b36aa208733e8f99532073b97c224c2e
4
+ data.tar.gz: c7664fc5641cbcb202d9d368a97ec48e46fa20de
5
5
  SHA512:
6
- metadata.gz: 75ac29be79462ac44122fedbe8255b48091d749cd08eed5ef672327c7d1a8e949f40ffdb584d3a203e2a3a42ea4ff0ef2ba81ca13c25477555e5d0d96556d409
7
- data.tar.gz: d85f15fd101a3a3a321b2d6283c744ac1f7fdc919ee292a8366ad71543841fb70253c2274b8bbd691fae9ef6ac260386e51adf23c1b22fd344b6e287ed989dfb
6
+ metadata.gz: e7e215bbf435d29824abae93dd2d33bdab1e98ea8fba91400a3f34e3d9b6a04f12749fa426b7e12d3db863edf648a527077d364aa074798d2e9ef2863a970fab
7
+ data.tar.gz: 8ca27f988fa422d5044964cae9dff471acd34e4d8f6fd0dbdfd5ef40c6dee1160ffb3fee2d563497a3213724bd9b1eb61d3a181707a0d66ff344747ad157f779
@@ -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
- when Timer.last_checkout
298
- last = Timer.last_checkout
299
- warn "Resuming last entry you checked out of (#{last.note})"
300
- last
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
@@ -1,3 +1,3 @@
1
1
  module Timetrap
2
- VERSION = '1.11.0'
2
+ VERSION = '1.12.0'
3
3
  end
@@ -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 sheet" do
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 second task'
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}' second task"
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.11.0
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-05-30 00:00:00.000000000 Z
11
+ date: 2016-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler