timetrap 1.8.14 → 1.9.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: e382d25aad4d86af2c0adbafca7ac08214e12bc9
4
- data.tar.gz: 4ef80db091acde2505f029a7028bdfc76747e7b2
3
+ metadata.gz: 05ce9b29076154da0dee41fe4df8a38bffdedc7f
4
+ data.tar.gz: d9617fc345497096984c88798645c64779e51f18
5
5
  SHA512:
6
- metadata.gz: 7cfdf04d7086a4a8ba73bb1c6b51348e01d141a2461301b9bb85f8293df6800998f7b9c8fc3b8251ee936780cc5d31155efafc0301f55f2430d00e04b9571f49
7
- data.tar.gz: 0a5220b5e22404849e583e7dd3d63a359b03cd6011e90e29bf67cf45ac982f7c5d45d38db87e60305361461c4055ad62ffd91be26f47bbbe2cf905ab0ea1dd4e
6
+ metadata.gz: db1443b89c6cc00b5098f59aa1705c9e57796cde4d204cbafdb1423635bb09fd4f3c5ecce95470f8abd877d678a82de3d9ea99fd133f676632671db10b8aca71
7
+ data.tar.gz: ea3431e082d78bcea28801c288e078d595bb4c99951fcab4f106f2ee756090acc65433e8f09d3133b98e2188e67d7f7c0e76fbdf0047a1f5dedec16479b83bfa
data/.travis.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
3
  - 1.9.2
5
4
  - 1.9.3
6
5
  - 2.0.0
6
+ - 2.1.5
7
+ - 2.2.0
data/CONTRIBUTORS CHANGED
@@ -11,3 +11,5 @@
11
11
  * Toby Foster
12
12
  * Michael Moen
13
13
  * Miles Matthias
14
+ * Devon Blandin (@dblandin)
15
+ * Marc Addeo
data/README.md CHANGED
@@ -110,7 +110,7 @@ check in 5 minutes ago using `in`'s `--at` flag.
110
110
 
111
111
  Command line flags also have short versions.
112
112
 
113
- $ # equivilent to the command above
113
+ $ # equivalent to the command above
114
114
  $ t i -a "5 minutes ago"
115
115
 
116
116
  You can consult the Chronic gem (http://chronic.rubyforge.org/) for a full
@@ -231,13 +231,21 @@ Now when I invoke it:
231
231
  working on issue #123
232
232
  working on issue #234
233
233
 
234
- Timetrap Formatters Repository
235
- ------------------------------
234
+ #### Timetrap Formatters Repository
236
235
 
237
236
  A community focused repository of custom formatters is available at
238
237
  https://github.com/samg/timetrap_formatters.
239
238
 
240
- ## AutoSheets
239
+ #### Harvest Integration
240
+
241
+ For timetrap users who use [Harvest][harvest] to manage timesheets,
242
+ [Devon Blandin][dblandin] created [timetrap-harvest][timetrap-harvest], a custom
243
+ formatter which allows you to easily submit your timetrap entries to Harvest
244
+ timesheets.
245
+
246
+ See its [README][timetrap-harvest] for more details.
247
+
248
+ ### AutoSheets
241
249
 
242
250
  Timetrap has a feature called auto sheets that allows you to automatically
243
251
  select which timesheet to check into.
@@ -258,7 +266,9 @@ workflow. You're encouraged to submit these back to timetrap for inclusion in
258
266
  a future version.
259
267
 
260
268
  To create a custom auto sheet module you create a ruby class and implement one
261
- method on it `#sheet`.
269
+ method on it `#sheet`. This method should return the name of the sheet
270
+ timetrap should use (as a string) or `nil` if a sheet shouldn't be
271
+ automatically selected.
262
272
 
263
273
  All timetrap auto sheets live under the namespace `Timetrap::AutoSheets`
264
274
 
@@ -267,7 +277,7 @@ To ensure that timetrap can find your auto sheet put it in
267
277
  string you will set in the configuration (for example
268
278
  `~/.timetrap/auto_sheets/dotfiles.rb`. If you want to put your auto sheet in a
269
279
  different place you can run `t configure` and edit the
270
- `auto sheet_search_paths` option.
280
+ `auto_sheet_search_paths` option.
271
281
 
272
282
  As an example here's the dotfiles auto sheet
273
283
 
@@ -286,9 +296,11 @@ end
286
296
 
287
297
  Commands
288
298
  --------
299
+
289
300
  **archive**
290
301
  Archives the selected entries (by moving them to a sheet called ``_[SHEET]``)
291
302
  These entries can be seen by running ``t display _[SHEET]``.
303
+
292
304
  usage: ``t archive [--start DATE] [--end DATE] [SHEET]``
293
305
 
294
306
  **backend**
@@ -336,7 +348,7 @@ Commands
336
348
  usage: ``t in [--at TIME] [NOTES]``
337
349
 
338
350
  **kill**
339
- Delete a timesheet or an entry. Entry's are referenced using an ``--id``
351
+ Delete a timesheet or an entry. Entries are referenced using an ``--id``
340
352
  flag (see display). Sheets are referenced by name.
341
353
 
342
354
  usage: ``t kill [--id ID] [TIMESHEET]``
@@ -360,11 +372,10 @@ Commands
360
372
  usage: ``t out [--at TIME] [TIMESHEET]``
361
373
 
362
374
  **resume**
363
- Start the timer for the current timesheet with the same notes as the last entry.
364
- If there is no last entry the new one has blank notes ore uses the optional
365
- NOTES parameter.
375
+ Start the timer for the current time sheet for an entry. Defaults to the
376
+ active entry.
366
377
 
367
- usage: ``t resume [--at TIME] [NOTES]``
378
+ usage: ``t resume [--id ID] [--at TIME]``
368
379
 
369
380
  **sheet**
370
381
  Switch to a timesheet creating it if necessary. The default timesheet is
@@ -385,7 +396,7 @@ Commands
385
396
  usage: ``t yesterday [--ids] [--format FMT] [SHEET | all]``
386
397
 
387
398
  **week**
388
- Shortcut for display with start date set to monday of this week
399
+ Shortcut for display with start date set to Monday of this week
389
400
 
390
401
  usage: ``t week [--ids] [--end DATE] [--format FMT] [TIMESHEET | all]``
391
402
 
@@ -396,8 +407,7 @@ Commands
396
407
  usage: ``t month [--ids] [--start MONTH] [--format FMT] [TIMESHEET | all]``
397
408
 
398
409
 
399
- Global Options
400
- --------
410
+ ### Global Options
401
411
 
402
412
  **rounding**
403
413
  passing a ``--round`` or ``-r`` flag to any command will round entry start
@@ -412,10 +422,9 @@ Global Options
412
422
  confirmation (such as ``kill``) to assume an affirmative response to any
413
423
  prompt. This is useful when timetrap is used in a scripted environment.
414
424
 
415
- Configuration
416
- --------
425
+ ### Configuration
417
426
 
418
- Configuration of TimeTrap's behavior can be done through an ERB interpolated
427
+ Configuration of Timetrap's behavior can be done through an ERB interpolated
419
428
  YAML config file.
420
429
 
421
430
  See ``t configure`` for details. Currently supported options are:
@@ -442,8 +451,11 @@ See ``t configure`` for details. Currently supported options are:
442
451
 
443
452
  **auto_sheet**: Which auto sheet module to use.
444
453
 
445
- Autocomplete
446
- ------------
454
+ **auto_sheet_search_paths**: an array of directories to search for user
455
+ defined auto_sheet classes
456
+
457
+
458
+ ### Autocomplete
447
459
 
448
460
  Timetrap has some basic support for autocomplete in bash and zsh.
449
461
  There are completions for commands and for sheets.
@@ -451,7 +463,7 @@ There are completions for commands and for sheets.
451
463
  **HINT** If you don't know where timetrap is installed,
452
464
  have a look in the directories listed in `echo $GEM_PATH`.
453
465
 
454
- ### bash
466
+ #### bash
455
467
 
456
468
  If it isn't already, add the following to your `.bashrc`/`.bash_profile`:
457
469
 
@@ -467,7 +479,7 @@ Then add this to source the completions:
467
479
  source /path/to/timetrap-1.x.y/gem/completions/bash/timetrap-autocomplete.bash
468
480
  ```
469
481
 
470
- ### zsh
482
+ #### zsh
471
483
 
472
484
  If it isn't already, add the following to your `.zshrc`:
473
485
 
@@ -494,3 +506,7 @@ http://bitbucket.org/trevor/timebook/src/
494
506
  Bugs and Feature Requests
495
507
  --------
496
508
  Submit to http://github.com/samg/timetrap/issues
509
+
510
+ [harvest]: http://www.getharvest.com
511
+ [timetrap-harvest]: https://github.com/dblandin/timetrap-harvest
512
+ [dblandin]: https://github.com/dblandin
data/lib/timetrap/cli.rb CHANGED
@@ -84,9 +84,10 @@ COMMAND is one of:
84
84
  usage: t out [--at TIME] [TIMESHEET]
85
85
  -a, --at <time:qs> Use this time instead of now
86
86
 
87
- * resume - Start the timer for the current time sheet with the same note as
88
- the last entry on the sheet. If there is no entry it takes the passed note.
89
- usage: t resume [--at TIME] [NOTES]
87
+ * resume - Start the timer for the current time sheet for an entry. Defaults
88
+ to the active entry.
89
+ usage: t resume [--id ID] [--at TIME]
90
+ -i, --id <id:i> Resume entry with id <id> instead of the last entry
90
91
  -a, --at <time:qs> Use this time instead of now
91
92
 
92
93
  * sheet - Switch to a timesheet creating it if necessary. When no sheet is
@@ -269,13 +270,23 @@ COMMAND is one of:
269
270
  end
270
271
 
271
272
  def resume
272
- last_entry = Timer.entries(Timer.current_sheet).last
273
- last_entry ||= Timer.entries("_#{Timer.current_sheet}").last
274
- warn "No entry yet on this sheet yet. Started a new entry." unless last_entry
275
- note = (last_entry ? last_entry.note : nil)
276
- warn "Resuming #{note.inspect} from entry ##{last_entry.id}" if note
273
+ entry = case
274
+ when args['-i']
275
+ entry = Entry[args['-i']]
276
+ warn "Resuming entry with id #{args['-i'].inspect} (#{entry.note})"
277
+ entry
278
+ when Timer.last_checkout
279
+ last = Timer.last_checkout
280
+ warn "Resuming last enrty you checked out of (#{last.note})"
281
+ last
282
+ end
283
+
284
+ unless entry
285
+ warn "Can't find entry"
286
+ return
287
+ end
277
288
 
278
- self.unused_args = note || unused_args
289
+ self.unused_args = entry.note || unused_args
279
290
 
280
291
  self.in
281
292
  end
@@ -1,3 +1,3 @@
1
1
  module Timetrap
2
- VERSION = '1.8.14'
2
+ VERSION = '1.9.0'
3
3
  end
@@ -317,7 +317,8 @@ The "format" command is deprecated in favor of "display". Sorry for the inconven
317
317
  :note => 'entry 4', :start => '2008-10-05 18:00:00'
318
318
  )
319
319
 
320
- Time.stub(:now).and_return local_time('2008-10-05 20:00:00')
320
+ now = local_time('2008-10-05 20:00:00')
321
+ Time.stub(:now).and_return now
321
322
  @desired_output = <<-OUTPUT
322
323
  Timesheet: SpecSheet
323
324
  Day Start End Duration Notes
@@ -843,7 +844,8 @@ END:VCALENDAR
843
844
 
844
845
  describe "with a numeric sheet name" do
845
846
  before do
846
- Time.stub(:now).and_return local_time("2008-10-05 18:00:00")
847
+ now = local_time("2008-10-05 18:00:00")
848
+ Time.stub(:now).and_return now
847
849
  create_entry( :sheet => 1234, :start => local_time_cli('2008-10-03 12:00:00'),
848
850
  :end => local_time_cli('2008-10-03 14:00:00'))
849
851
  end
@@ -866,7 +868,8 @@ END:VCALENDAR
866
868
 
867
869
  describe "with a numeric sheet name" do
868
870
  before do
869
- Time.stub(:now).and_return local_time("2008-10-05 18:00:00")
871
+ now = local_time("2008-10-05 18:00:00")
872
+ Time.stub(:now).and_return now
870
873
  create_entry( :sheet => '1234', :start => local_time_cli('2008-10-03 12:00:00'),
871
874
  :end => local_time_cli('2008-10-03 14:00:00'))
872
875
  end
@@ -890,7 +893,8 @@ END:VCALENDAR
890
893
 
891
894
  describe "with sheets defined" do
892
895
  before :each do
893
- Time.stub(:now).and_return local_time("2008-10-05 18:00:00")
896
+ now = local_time("2008-10-05 18:00:00")
897
+ Time.stub(:now).and_return now
894
898
  create_entry( :sheet => 'A Longly Named Sheet 2', :start => local_time_cli('2008-10-03 12:00:00'),
895
899
  :end => local_time_cli('2008-10-03 14:00:00'))
896
900
  create_entry( :sheet => 'A Longly Named Sheet 2', :start => local_time_cli('2008-10-03 12:00:00'),
@@ -1041,6 +1045,10 @@ END:VCALENDAR
1041
1045
  @time = Time.now
1042
1046
  Time.stub(:now).and_return @time
1043
1047
 
1048
+ invoke 'in A previous task that isnt last'
1049
+ @previous = Timetrap::Timer.active_entry
1050
+ invoke 'out'
1051
+
1044
1052
  invoke 'in Some strange task'
1045
1053
  @last_active = Timetrap::Timer.active_entry
1046
1054
  invoke 'out'
@@ -1056,6 +1064,20 @@ END:VCALENDAR
1056
1064
  Timetrap::Timer.active_entry.start.to_s.should == @time.to_s
1057
1065
  end
1058
1066
 
1067
+ it "should allow to resume a specific entry" do
1068
+ invoke "resume --id #{@previous.id}"
1069
+
1070
+ Timetrap::Timer.active_entry.note.should ==(@previous.note)
1071
+ Timetrap::Timer.active_entry.start.to_s.should == @time.to_s
1072
+ end
1073
+
1074
+ it "should allow to resume a specific entry with a given time" do
1075
+ invoke "resume --id #{@previous.id} --at \"10am 2008-10-03\""
1076
+
1077
+ Timetrap::Timer.active_entry.note.should ==(@previous.note)
1078
+ Timetrap::Timer.active_entry.start.should eql(Time.parse('2008-10-03 10:00'))
1079
+ end
1080
+
1059
1081
  it "should allow to resume the activity with a given time" do
1060
1082
  invoke 'resume --at "10am 2008-10-03"'
1061
1083
 
@@ -1072,17 +1094,6 @@ END:VCALENDAR
1072
1094
  Timetrap::Timer.active_entry.should be_nil
1073
1095
  end
1074
1096
 
1075
- it "starts a new entry if no entry exists" do
1076
- invoke "resume"
1077
- Timetrap::Timer.active_entry.should_not be_nil
1078
- Timetrap::Timer.active_entry.note.should ==("")
1079
- end
1080
-
1081
- it "allows to pass a note that is used for the new entry" do
1082
- invoke "resume New Note"
1083
- Timetrap::Timer.active_entry.should_not be_nil
1084
- Timetrap::Timer.active_entry.note.should ==("New Note")
1085
- end
1086
1097
  end
1087
1098
 
1088
1099
  describe "with only archived entries" do
@@ -1352,9 +1363,9 @@ END:VCALENDAR
1352
1363
  it "should use round start if the global round attribute is set" do
1353
1364
  with_rounding_on do
1354
1365
  with_stubbed_config('round_in_seconds' => 900) do
1355
- @time = Chronic.parse("12:55am")
1366
+ @time = Chronic.parse("12:55")
1356
1367
  @entry.start = @time
1357
- @entry.start.should == Chronic.parse("1am")
1368
+ @entry.start.should == Chronic.parse("1")
1358
1369
  end
1359
1370
  end
1360
1371
  end
@@ -1362,18 +1373,18 @@ END:VCALENDAR
1362
1373
  it "should use round start if the global round attribute is set" do
1363
1374
  with_rounding_on do
1364
1375
  with_stubbed_config('round_in_seconds' => 900) do
1365
- @time = Chronic.parse("12:50am")
1376
+ @time = Chronic.parse("12:50")
1366
1377
  @entry.start = @time
1367
- @entry.start.should == Chronic.parse("12:45am")
1378
+ @entry.start.should == Chronic.parse("12:45")
1368
1379
  end
1369
1380
  end
1370
1381
  end
1371
1382
 
1372
1383
  it "should have a rounded start" do
1373
1384
  with_stubbed_config('round_in_seconds' => 900) do
1374
- @time = Chronic.parse("12:50am")
1385
+ @time = Chronic.parse("12:50")
1375
1386
  @entry.start = @time
1376
- @entry.rounded_start.should == Chronic.parse("12:45am")
1387
+ @entry.rounded_start.should == Chronic.parse("12:45")
1377
1388
  end
1378
1389
  end
1379
1390
 
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.8.14
4
+ version: 1.9.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: 2014-02-17 00:00:00.000000000 Z
11
+ date: 2015-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  version: '0'
202
202
  requirements: []
203
203
  rubyforge_project:
204
- rubygems_version: 2.2.0
204
+ rubygems_version: 2.4.5.1
205
205
  signing_key:
206
206
  specification_version: 4
207
207
  summary: Command line time tracker