timetrap 1.7.10 → 1.8.0
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 +7 -20
- data/VERSION.yml +2 -2
- data/lib/timetrap/formatters/factor.rb +7 -14
- data/spec/timetrap_spec.rb +4 -35
- data/timetrap.gemspec +2 -2
- metadata +5 -5
data/README.md
CHANGED
@@ -120,7 +120,7 @@ list of parsable time formats, but all of these should work.
|
|
120
120
|
|
121
121
|
Timetrap has built-in support for 6 output formats.
|
122
122
|
|
123
|
-
These are **text**, **csv**, **ical**, **json**,
|
123
|
+
These are **text**, **csv**, **ical**, **json**, and **ids**
|
124
124
|
|
125
125
|
The default is a plain **text** format. (You can change the default format using
|
126
126
|
`t configure`).
|
@@ -171,25 +171,6 @@ A *json* formatter is provided because hackers love json.
|
|
171
171
|
|
172
172
|
$ t d -fjson
|
173
173
|
|
174
|
-
The *factor* formatter is like the default *text* formatter, except it reads special
|
175
|
-
notes in your entry descriptions, and multiplies the entry's duration by them.
|
176
|
-
A note like *f:2* will multiply the entry's duration by two in the output.
|
177
|
-
See https://github.com/samg/timetrap/issues#issue/13 for more details.
|
178
|
-
|
179
|
-
$ # note durations are multiplications of start and end times, based on notes
|
180
|
-
$ t d -ffactor
|
181
|
-
Timesheet: nopoconi
|
182
|
-
Day Start End Duration Notes
|
183
|
-
Mon Mar 07, 2011 19:56:06 - 20:18:37 0:22:31 merge factor in timetrap, f:3
|
184
|
-
20:19:04 - 20:23:02 0:01:59 document factor formatter f:0.5
|
185
|
-
|
186
|
-
0:22:34
|
187
|
-
---------------------------------------------------------
|
188
|
-
Total 0:22:34
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
174
|
#### Custom Formatters
|
194
175
|
|
195
176
|
Timetrap tries to make it easy to define custom output formats.
|
@@ -238,6 +219,12 @@ Now when I invoke it:
|
|
238
219
|
working on issue #123
|
239
220
|
working on issue #234
|
240
221
|
|
222
|
+
Timetrap Formatters Repository
|
223
|
+
------------------------------
|
224
|
+
|
225
|
+
A community focused repository of custom formatters is available at
|
226
|
+
https://github.com/sam/timetrap_formatters.
|
227
|
+
|
241
228
|
Commands
|
242
229
|
--------
|
243
230
|
**archive**
|
data/VERSION.yml
CHANGED
@@ -1,19 +1,12 @@
|
|
1
1
|
module Timetrap
|
2
2
|
module Formatters
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
factor = $2.to_f
|
11
|
-
end
|
12
|
-
e.duration = (e.end_or_now.to_i - e.start.to_i) * factor
|
13
|
-
e
|
14
|
-
end
|
15
|
-
super
|
16
|
-
end
|
3
|
+
class Factor
|
4
|
+
raise <<-WARN
|
5
|
+
The factor formatter has been moved out of timetrap core in and into timetrap_formatters.
|
6
|
+
See https://github.com/samg/timetrap_formatters for more info.
|
7
|
+
WARN
|
8
|
+
def output; end
|
9
|
+
def initialize(*args); end
|
17
10
|
end
|
18
11
|
end
|
19
12
|
end
|
data/spec/timetrap_spec.rb
CHANGED
@@ -87,10 +87,11 @@ describe Timetrap do
|
|
87
87
|
it "should write a config file" do
|
88
88
|
FakeFS do
|
89
89
|
FileUtils.mkdir_p(ENV['HOME'])
|
90
|
-
|
91
|
-
|
90
|
+
config_file = ENV['HOME'] + '/.timetrap.yml'
|
91
|
+
FileUtils.rm(config_file) if File.exist? config_file
|
92
|
+
File.exist?(config_file).should be_false
|
92
93
|
invoke "configure"
|
93
|
-
File.exist?(
|
94
|
+
File.exist?(config_file).should be_true
|
94
95
|
end
|
95
96
|
end
|
96
97
|
|
@@ -323,38 +324,6 @@ Grand Total 10:00:00
|
|
323
324
|
end
|
324
325
|
end
|
325
326
|
|
326
|
-
describe "factor" do
|
327
|
-
before do
|
328
|
-
Timetrap::Entry.create( :sheet => 'SpecSheet',
|
329
|
-
:note => 'entry f:2', :start => '2008-10-03 16:00:00', :end => '2008-10-03 18:00:00'
|
330
|
-
)
|
331
|
-
Timetrap::Entry.create( :sheet => 'SpecSheet',
|
332
|
-
:note => 'entry f:0.5', :start => '2008-10-04 16:00:00', :end => '2008-10-04 18:00:00'
|
333
|
-
)
|
334
|
-
Timetrap::Entry.create( :sheet => 'SpecSheet',
|
335
|
-
:note => 'entry', :start => '2008-10-04 19:00:00'
|
336
|
-
)
|
337
|
-
Time.stub!(:now).and_return local_time('2008-10-04 20:00:00')
|
338
|
-
@desired_output = <<-OUTPUT
|
339
|
-
Timesheet: SpecSheet
|
340
|
-
Day Start End Duration Notes
|
341
|
-
Fri Oct 03, 2008 16:00:00 - 18:00:00 4:00:00 entry f:2
|
342
|
-
4:00:00
|
343
|
-
Sat Oct 04, 2008 16:00:00 - 18:00:00 1:00:00 entry f:0.5
|
344
|
-
19:00:00 - 1:00:00 entry
|
345
|
-
2:00:00
|
346
|
-
---------------------------------------------------------
|
347
|
-
Total 6:00:00
|
348
|
-
OUTPUT
|
349
|
-
end
|
350
|
-
|
351
|
-
it "should correctly handle factors in notes" do
|
352
|
-
Timetrap::Timer.current_sheet = 'SpecSheet'
|
353
|
-
invoke 'display --format factor'
|
354
|
-
$stdout.string.should == @desired_output
|
355
|
-
end
|
356
|
-
end
|
357
|
-
|
358
327
|
describe "default" do
|
359
328
|
before do
|
360
329
|
create_entry(:start => '2008-10-03 12:00:00', :end => '2008-10-03 14:00:00')
|
data/timetrap.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{timetrap}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.8.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Sam Goldstein"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2012-01-01}
|
13
13
|
s.default_executable = %q{t}
|
14
14
|
s.description = %q{Command line time tracker}
|
15
15
|
s.email = %q{sgrock@gmail.com}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timetrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 55
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 8
|
9
|
+
- 0
|
10
|
+
version: 1.8.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sam Goldstein
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-01-01 00:00:00 -08:00
|
19
19
|
default_executable: t
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|