timetrap 1.8.3.beta1 → 1.8.3.beta2
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/README.md +1 -2
- data/VERSION.yml +1 -1
- data/lib/timetrap/cli.rb +8 -2
- data/lib/timetrap/config.rb +2 -2
- data/lib/timetrap/timer.rb +3 -2
- data/spec/timetrap_spec.rb +56 -4
- data/timetrap.gemspec +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -364,8 +364,7 @@ See ``t configure`` for details. Currently supported options are:
|
|
364
364
|
|
365
365
|
**default_command**: The default command to invoke when you call `t`
|
366
366
|
|
367
|
-
**
|
368
|
-
false which allows one running entry per sheet.
|
367
|
+
**auto_checkout**: Automatically check out of running entries when you check in
|
369
368
|
|
370
369
|
Special Thanks
|
371
370
|
--------------
|
data/VERSION.yml
CHANGED
data/lib/timetrap/cli.rb
CHANGED
@@ -32,7 +32,13 @@ COMMAND is one of:
|
|
32
32
|
database_file: The file path of the sqlite database
|
33
33
|
append_notes_delimiter: delimiter used when appending notes via
|
34
34
|
t edit --append
|
35
|
+
formatter_search_paths: an array of directories to search for user
|
36
|
+
defined fomatter classes
|
37
|
+
default_formatter: The format to use when display is invoked without a
|
38
|
+
`--format` option
|
35
39
|
default_command: The default command to run when calling t.
|
40
|
+
auto_checkout: Automatically check out of running entries when
|
41
|
+
you check in
|
36
42
|
|
37
43
|
* display - Display the current timesheet or a specific. Pass `all' as SHEET
|
38
44
|
to display all unarchived sheets or `full' to display archived and
|
@@ -225,8 +231,8 @@ COMMAND is one of:
|
|
225
231
|
end
|
226
232
|
|
227
233
|
def in
|
228
|
-
if Config['
|
229
|
-
Timer.
|
234
|
+
if Config['auto_checkout']
|
235
|
+
Timer.stop_all(args['-a']).each do |checked_out_of|
|
230
236
|
warn "Checked out of sheet #{checked_out_of.sheet.inspect}."
|
231
237
|
end
|
232
238
|
end
|
data/lib/timetrap/config.rb
CHANGED
@@ -26,8 +26,8 @@ module Timetrap
|
|
26
26
|
# the default command to when you run `t`. default to printing usage.
|
27
27
|
'default_command' => nil,
|
28
28
|
# only allow one running entry at a time.
|
29
|
-
#
|
30
|
-
'
|
29
|
+
# automatically check out of any running tasks when checking in.
|
30
|
+
'auto_checkout' => false
|
31
31
|
}
|
32
32
|
end
|
33
33
|
|
data/lib/timetrap/timer.rb
CHANGED
@@ -87,8 +87,8 @@ module Timetrap
|
|
87
87
|
Entry.filter(:end => nil)
|
88
88
|
end
|
89
89
|
|
90
|
-
def
|
91
|
-
running_entries.
|
90
|
+
def stop_all(time = nil)
|
91
|
+
running_entries.map{ |e| stop(e, time) }
|
92
92
|
end
|
93
93
|
|
94
94
|
def stop sheet_or_entry, time = nil
|
@@ -104,6 +104,7 @@ module Timetrap
|
|
104
104
|
a.end = time
|
105
105
|
a.save
|
106
106
|
end
|
107
|
+
a
|
107
108
|
end
|
108
109
|
|
109
110
|
def start note, time = nil
|
data/spec/timetrap_spec.rb
CHANGED
@@ -520,9 +520,9 @@ END:VCALENDAR
|
|
520
520
|
$stderr.string.should =~ /\w+/
|
521
521
|
end
|
522
522
|
|
523
|
-
describe "with
|
523
|
+
describe "with auto_checkout config option set" do
|
524
524
|
before do
|
525
|
-
with_stubbed_config '
|
525
|
+
with_stubbed_config 'auto_checkout' => true
|
526
526
|
end
|
527
527
|
|
528
528
|
it "should check in normally if nothing else is running" do
|
@@ -537,10 +537,15 @@ END:VCALENDAR
|
|
537
537
|
invoke 'in first task'
|
538
538
|
end
|
539
539
|
|
540
|
-
it "should
|
540
|
+
it "should check out and back in" do
|
541
541
|
entry = Timetrap::Timer.active_entry('sheet1')
|
542
542
|
invoke 'in second task'
|
543
|
-
Timetrap::Timer.active_entry('sheet1').should ==
|
543
|
+
Timetrap::Timer.active_entry('sheet1').note.should == 'second task'
|
544
|
+
end
|
545
|
+
|
546
|
+
it "should tell me what it's doing" do
|
547
|
+
invoke 'in second task'
|
548
|
+
$stderr.string.should include "Checked out"
|
544
549
|
end
|
545
550
|
end
|
546
551
|
|
@@ -823,6 +828,53 @@ END:VCALENDAR
|
|
823
828
|
Timetrap::Timer.active_entry.note.should ==("New Note")
|
824
829
|
end
|
825
830
|
end
|
831
|
+
|
832
|
+
describe "with auto_checkout config option set" do
|
833
|
+
before do
|
834
|
+
with_stubbed_config 'auto_checkout' => true
|
835
|
+
end
|
836
|
+
|
837
|
+
it "should check in normally if nothing else is running" do
|
838
|
+
Timetrap::Timer.should_not be_running #precondition
|
839
|
+
invoke 'resume'
|
840
|
+
Timetrap::Timer.should be_running
|
841
|
+
end
|
842
|
+
|
843
|
+
describe "with a running entry on current sheet" do
|
844
|
+
before do
|
845
|
+
invoke 'sheet sheet1'
|
846
|
+
invoke 'in first task'
|
847
|
+
end
|
848
|
+
|
849
|
+
it "should check out and back in" do
|
850
|
+
entry = Timetrap::Timer.active_entry('sheet1')
|
851
|
+
invoke 'resume second task'
|
852
|
+
Timetrap::Timer.active_entry('sheet1').id.should_not == entry.id
|
853
|
+
end
|
854
|
+
end
|
855
|
+
|
856
|
+
describe "with a running entry on another sheet" do
|
857
|
+
before do
|
858
|
+
invoke 'sheet sheet1'
|
859
|
+
invoke 'in first task'
|
860
|
+
invoke 'sheet sheet2'
|
861
|
+
end
|
862
|
+
|
863
|
+
it "should check out of the running entry" do
|
864
|
+
Timetrap::Timer.active_entry('sheet1').should be_a(Timetrap::Entry)
|
865
|
+
invoke 'resume second task'
|
866
|
+
Timetrap::Timer.active_entry('sheet1').should be nil
|
867
|
+
end
|
868
|
+
|
869
|
+
it "should check out of the running entry at another time" do
|
870
|
+
now = Time.at(Time.now - 5 * 60) # 5 minutes ago
|
871
|
+
entry = Timetrap::Timer.active_entry('sheet1')
|
872
|
+
entry.should be_a(Timetrap::Entry)
|
873
|
+
invoke "resume -a '#{now}' second task"
|
874
|
+
entry.reload.end.to_s.should == now.to_s
|
875
|
+
end
|
876
|
+
end
|
877
|
+
end
|
826
878
|
end
|
827
879
|
|
828
880
|
describe "sheet" do
|
data/timetrap.gemspec
CHANGED