timetrap 1.12.0 → 1.13.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 +10 -1
- data/lib/timetrap/version.rb +1 -1
- data/spec/timetrap_spec.rb +33 -0
- 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: bbc0d7f0e44a53e45a15d6aa657371644c9c12e0
|
4
|
+
data.tar.gz: ed4fee1b239512ff12507f976b822b5a8f3a64b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb06b383210f57f21129a7881b632a3e80eafa966470cd38df94d2d742e619a8e4937ea4e981ea6e3a7c454e9f5f4c379ca128685abf40a62988861095be15ed
|
7
|
+
data.tar.gz: ff020f3440853d565980b0209807045f48111ad61a18ef21e47228f111007e916d70aa85a9865190828b8772af96228484d16d3a51e07c2a87fd120ec7017613
|
data/lib/timetrap/cli.rb
CHANGED
@@ -246,7 +246,7 @@ COMMAND is one of:
|
|
246
246
|
if args['-z']
|
247
247
|
note = [entry.note, get_note_from_external_editor].join(Config['append_notes_delimiter'])
|
248
248
|
entry.update :note => note
|
249
|
-
elsif
|
249
|
+
elsif editing_a_note?
|
250
250
|
entry.update :note => get_note_from_external_editor(entry.note)
|
251
251
|
end
|
252
252
|
else
|
@@ -492,6 +492,15 @@ COMMAND is one of:
|
|
492
492
|
file.unlink
|
493
493
|
end
|
494
494
|
|
495
|
+
def editing_a_note?
|
496
|
+
return true if args.size == 0
|
497
|
+
|
498
|
+
args.each do |(k,_v)|
|
499
|
+
return false unless ["--id", "-i"].include?(k)
|
500
|
+
end
|
501
|
+
true
|
502
|
+
end
|
503
|
+
|
495
504
|
extend Helpers::AutoLoad
|
496
505
|
def format_entries(entries)
|
497
506
|
load_formatter(args['-f'] || Config['default_formatter']).new(Array(entries)).output
|
data/lib/timetrap/version.rb
CHANGED
data/spec/timetrap_spec.rb
CHANGED
@@ -273,6 +273,39 @@ describe Timetrap do
|
|
273
273
|
expect(capture).to eq("running entry")
|
274
274
|
end
|
275
275
|
|
276
|
+
|
277
|
+
it "should edit a non running entry with an external editor" do |example|
|
278
|
+
not_running = Timetrap::Timer.active_entry
|
279
|
+
Timetrap::Timer.stop(Timetrap::Timer.current_sheet)
|
280
|
+
Timetrap::Timer.start "another entry", nil
|
281
|
+
|
282
|
+
# create a few more entries to ensure we're not falling back on "last
|
283
|
+
# checked out of" feature.
|
284
|
+
Timetrap::Timer.stop(Timetrap::Timer.current_sheet)
|
285
|
+
Timetrap::Timer.start "another entry", nil
|
286
|
+
|
287
|
+
Timetrap::Timer.stop(Timetrap::Timer.current_sheet)
|
288
|
+
|
289
|
+
Timetrap::CLI.stub(:system) do |editor_command|
|
290
|
+
path = editor_command.match(/#{note_editor_command} (?<path>.*)/)
|
291
|
+
File.write(path[:path], "id passed note")
|
292
|
+
end
|
293
|
+
|
294
|
+
invoke "edit --id #{not_running.id}"
|
295
|
+
|
296
|
+
not_running.refresh.note.should == "id passed note"
|
297
|
+
end
|
298
|
+
|
299
|
+
it "should not call the editor if there are arguments other than --id" do
|
300
|
+
not_running = Timetrap::Timer.active_entry
|
301
|
+
Timetrap::Timer.stop(Timetrap::Timer.current_sheet)
|
302
|
+
Timetrap::Timer.start "another entry", nil
|
303
|
+
|
304
|
+
Timetrap::Timer.stop(Timetrap::Timer.current_sheet)
|
305
|
+
expect(Timetrap::CLI).not_to receive(:system)
|
306
|
+
invoke "edit --id #{not_running.id} --start \"yesterday 10am\""
|
307
|
+
end
|
308
|
+
|
276
309
|
context "appending" do
|
277
310
|
it "should open an editor for editing the note with -z" do |example|
|
278
311
|
Timetrap::CLI.stub(:system) do |editor_command|
|
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.13.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-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|