timr 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -5
- data/.gitlab-ci.yml +95 -0
- data/.travis.yml +23 -0
- data/bin/build_info.sh +3 -2
- data/bin/install.sh +6 -4
- data/bin/publish +11 -4
- data/bin/release.sh +5 -3
- data/bin/timr_bash_completion.sh +1 -0
- data/lib/timr/command/log_command.rb +2 -2
- data/lib/timr/command/report_command.rb +54 -4
- data/lib/timr/command/status_command.rb +2 -1
- data/lib/timr/command/task_command.rb +13 -9
- data/lib/timr/command/track_command.rb +4 -4
- data/lib/timr/model/task.rb +55 -27
- data/lib/timr/model/track.rb +37 -0
- data/lib/timr/timr.rb +0 -1
- data/lib/timr/version.rb +2 -2
- data/man/index.txt +15 -0
- data/man/timr-report.1 +92 -27
- data/man/timr-report.1.ronn +56 -0
- data/timr.sublime-project +7 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a52eda0ed77a6f73e3c0e039bc938fa21248a54
|
4
|
+
data.tar.gz: a17fe3a693f1cf2a7c544b6212f405cb3ba42e1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86632a136e85c82349380204a9e02d9ed9bea484ea634b85c44fed7af4ab1707470b85995c3cce4c8325562704826bb9bdf0aa526c283f3f83ed50705ad03458
|
7
|
+
data.tar.gz: e9be4b7834949de95f9cfcdb77a8f279dbf23d448ae83219bd169a5fd96d2ae7d2b1c02b14035e706710ab7b00f9d3ed90b4e7859bf3ab81d69969de3b63505b
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
before_script:
|
2
|
+
- apt-get update -yqq
|
3
|
+
- 'which ssh-agent || ( apt-get install openssh-client -y )'
|
4
|
+
- 'which rsync || ( apt-get install rsync -yqq --force-yes )'
|
5
|
+
- eval $(ssh-agent -s)
|
6
|
+
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
7
|
+
- mkdir -p ~/.ssh
|
8
|
+
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
9
|
+
- ruby -v
|
10
|
+
- gem update --system
|
11
|
+
- gem install bundler -v '~>1.13'
|
12
|
+
- gem install ronn -v '0.7.3'
|
13
|
+
- bundler --version
|
14
|
+
- bundler install
|
15
|
+
|
16
|
+
stages:
|
17
|
+
- test
|
18
|
+
- release
|
19
|
+
- deploy
|
20
|
+
|
21
|
+
test_feature:
|
22
|
+
image: ruby:2.1
|
23
|
+
stage: test
|
24
|
+
environment: test
|
25
|
+
only:
|
26
|
+
- /^feature/
|
27
|
+
script:
|
28
|
+
- ./bin/test.sh
|
29
|
+
|
30
|
+
test_21:
|
31
|
+
image: ruby:2.1
|
32
|
+
stage: test
|
33
|
+
environment: test
|
34
|
+
only:
|
35
|
+
- tags
|
36
|
+
script:
|
37
|
+
- ./bin/test.sh
|
38
|
+
|
39
|
+
test_22:
|
40
|
+
image: ruby:2.2
|
41
|
+
stage: test
|
42
|
+
environment: test
|
43
|
+
only:
|
44
|
+
- tags
|
45
|
+
script:
|
46
|
+
- ./bin/test.sh
|
47
|
+
|
48
|
+
test_23:
|
49
|
+
image: ruby:2.3
|
50
|
+
stage: test
|
51
|
+
environment: test
|
52
|
+
only:
|
53
|
+
- tags
|
54
|
+
script:
|
55
|
+
- ./bin/test.sh
|
56
|
+
|
57
|
+
test_24:
|
58
|
+
image: ruby:2.4.0
|
59
|
+
stage: test
|
60
|
+
environment: test
|
61
|
+
only:
|
62
|
+
- tags
|
63
|
+
script:
|
64
|
+
- ./bin/test.sh
|
65
|
+
|
66
|
+
release:
|
67
|
+
image: ruby:2.4.0
|
68
|
+
stage: release
|
69
|
+
environment: gem
|
70
|
+
only:
|
71
|
+
- tags
|
72
|
+
script:
|
73
|
+
- mkdir -p ~/.gem
|
74
|
+
- 'printf "%s\n:rubygems_api_key: %s" "---" "${RUBYGEMSORG_API_KEY}" > ~/.gem/credentials; chmod 0600 ~/.gem/credentials'
|
75
|
+
- ./bin/release.sh
|
76
|
+
|
77
|
+
deploy_dev:
|
78
|
+
image: ruby:2.4.0
|
79
|
+
stage: deploy
|
80
|
+
environment: homepage_dev
|
81
|
+
only:
|
82
|
+
- develop
|
83
|
+
script:
|
84
|
+
- ./bin/build.sh
|
85
|
+
- ./bin/publish
|
86
|
+
|
87
|
+
deploy_prod:
|
88
|
+
image: ruby:2.4.0
|
89
|
+
stage: deploy
|
90
|
+
environment: homepage_prod
|
91
|
+
only:
|
92
|
+
- tags
|
93
|
+
script:
|
94
|
+
- ./bin/build.sh
|
95
|
+
- ./bin/publish
|
data/.travis.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.1
|
4
|
+
- 2.2
|
5
|
+
- 2.3
|
6
|
+
- 2.4.0
|
7
|
+
- ruby-head
|
8
|
+
sudo: required
|
9
|
+
before_install:
|
10
|
+
- gem --version
|
11
|
+
- gem update --system
|
12
|
+
- gem install bundler -v '~>1.13'
|
13
|
+
- bundler --version
|
14
|
+
install:
|
15
|
+
- bundler install
|
16
|
+
- 'gem build "${GEMSPEC_FILE}"'
|
17
|
+
- 'gem install "${GEM_NAME}"-*.gem'
|
18
|
+
- 'gem list -l "${GEM_NAME}"'
|
19
|
+
script:
|
20
|
+
- ./bin/test.sh
|
21
|
+
- cd
|
22
|
+
- which -a timr
|
23
|
+
- timr --version
|
data/bin/build_info.sh
CHANGED
@@ -21,7 +21,8 @@ timr: %s
|
|
21
21
|
|
22
22
|
--- build ---
|
23
23
|
id: %s
|
24
|
-
|
24
|
+
branch: %s
|
25
|
+
commit: %s
|
25
26
|
stage: %s
|
26
27
|
server: %s %s
|
27
|
-
" "${DATE}" "${RUBY_VERSION}" "${TIMR_VERSION}" "${CI_BUILD_ID}" "${
|
28
|
+
" "${DATE}" "${RUBY_VERSION}" "${TIMR_VERSION}" "${CI_BUILD_ID}" "${CI_BUILD_REF_NAME}" "${CI_BUILD_REF}" "${CI_BUILD_STAGE}" "${CI_SERVER_NAME}" "${CI_SERVER_VERSION}"
|
data/bin/install.sh
CHANGED
@@ -37,13 +37,15 @@ echo "install gem file '$gem_file'"
|
|
37
37
|
gem install "$gem_file"
|
38
38
|
|
39
39
|
# Create tmp directory.
|
40
|
-
if [[ ! -d tmp ]]; then
|
41
|
-
mkdir -p tmp
|
40
|
+
if [[ ! -d tmp/releases ]]; then
|
41
|
+
mkdir -p tmp/releases
|
42
|
+
|
42
43
|
chmod u=rwx,go-rwx tmp
|
44
|
+
chmod u=rwx,go-rwx tmp/releases
|
43
45
|
fi
|
44
46
|
|
45
47
|
if [[ "$option" = "-f" ]]; then
|
46
|
-
mv -v "$gem_file" tmp
|
48
|
+
mv -v "$gem_file" tmp/releases
|
47
49
|
else
|
48
|
-
mv -v -i "$gem_file" tmp
|
50
|
+
mv -v -i "$gem_file" tmp/releases
|
49
51
|
fi
|
data/bin/publish
CHANGED
@@ -27,10 +27,17 @@ fi
|
|
27
27
|
|
28
28
|
which rsync &> /dev/null || { echo 'ERROR: rsync not found in PATH'; exit 1; }
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
echo "CI_BUILD_REF_NAME: '$CI_BUILD_REF_NAME'"
|
31
|
+
|
32
|
+
case "$CI_BUILD_REF_NAME" in
|
33
|
+
# For example v0.4.0
|
34
|
+
v*.*)
|
35
|
+
remote_path=$RSYNC_REMOTE_PATH_MASTER
|
36
|
+
;;
|
37
|
+
*)
|
38
|
+
remote_path=$RSYNC_REMOTE_PATH_DEVELOP
|
39
|
+
;;
|
40
|
+
esac
|
34
41
|
|
35
42
|
echo "rsync to '${RSYNC_USER}@${RSYNC_HOST}:${remote_path}'"
|
36
43
|
rsync ${RSYNC_OPTIONS} build.txt coverage api "${RSYNC_USER}@${RSYNC_HOST}:${remote_path}"
|
data/bin/release.sh
CHANGED
@@ -28,8 +28,10 @@ echo "push gem file '$gem_file'"
|
|
28
28
|
gem push "$gem_file"
|
29
29
|
|
30
30
|
# Create tmp directory.
|
31
|
-
if [[ ! -d tmp ]]; then
|
32
|
-
mkdir -p tmp
|
31
|
+
if [[ ! -d tmp/releases ]]; then
|
32
|
+
mkdir -p tmp/releases
|
33
|
+
|
33
34
|
chmod u=rwx,go-rwx tmp
|
35
|
+
chmod u=rwx,go-rwx tmp/releases
|
34
36
|
fi
|
35
|
-
mv -v -i "$gem_file" tmp
|
37
|
+
mv -v -i "$gem_file" tmp/releases
|
data/bin/timr_bash_completion.sh
CHANGED
@@ -190,7 +190,7 @@ module TheFox
|
|
190
190
|
begin_datetime_s,
|
191
191
|
end_datetime_s,
|
192
192
|
duration ? duration.to_human : '---',
|
193
|
-
task.
|
193
|
+
task.id_foreign_or_short,
|
194
194
|
'%s %s' % [track.short_id, track.title(15)],
|
195
195
|
]
|
196
196
|
end
|
@@ -220,7 +220,7 @@ module TheFox
|
|
220
220
|
begin_datetime_s,
|
221
221
|
end_datetime_s,
|
222
222
|
duration ? duration.to_human : '---',
|
223
|
-
task.
|
223
|
+
task.id_foreign_or_short,
|
224
224
|
'%s %s' % [track.short_id, track.title(15)],
|
225
225
|
]
|
226
226
|
end
|
@@ -27,6 +27,7 @@ module TheFox
|
|
27
27
|
@to_opt = nil
|
28
28
|
# @billed_opt = false
|
29
29
|
# @unbilled_opt = false
|
30
|
+
@format_opt = nil
|
30
31
|
@csv_opt = nil
|
31
32
|
@force_opt = false
|
32
33
|
|
@@ -60,6 +61,9 @@ module TheFox
|
|
60
61
|
# when '--unbilled'
|
61
62
|
# @unbilled_opt = true
|
62
63
|
|
64
|
+
when '--format'
|
65
|
+
@format_opt = argv.shift
|
66
|
+
|
63
67
|
when '--csv'
|
64
68
|
@csv_opt = argv.shift
|
65
69
|
if !@csv_opt
|
@@ -129,6 +133,14 @@ module TheFox
|
|
129
133
|
else
|
130
134
|
export_tasks_csv
|
131
135
|
end
|
136
|
+
elsif @format_opt
|
137
|
+
if @tasks_opt
|
138
|
+
print_formatted_task_list
|
139
|
+
elsif @tracks_opt
|
140
|
+
print_formatted_track_list
|
141
|
+
else
|
142
|
+
print_formatted_task_list
|
143
|
+
end
|
132
144
|
else
|
133
145
|
if @tasks_opt
|
134
146
|
print_task_table
|
@@ -215,7 +227,7 @@ module TheFox
|
|
215
227
|
duration.to_human,
|
216
228
|
unbilled_duration.to_human,
|
217
229
|
# tracks_c,
|
218
|
-
'%s %s' % [task.
|
230
|
+
'%s %s' % [task.id_foreign_or_short, task.name(15)]
|
219
231
|
]
|
220
232
|
end
|
221
233
|
|
@@ -243,6 +255,13 @@ module TheFox
|
|
243
255
|
end
|
244
256
|
end
|
245
257
|
|
258
|
+
def print_formatted_task_list
|
259
|
+
puts 'print_formatted_task_list'
|
260
|
+
filtered_tasks.each do |task|
|
261
|
+
puts task.formatted(@format_opt)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
246
265
|
def print_track_table
|
247
266
|
puts "From #{@from_opt.strftime('%F %T %z')}"
|
248
267
|
puts " To #{@to_opt.strftime('%F %T %z')}"
|
@@ -303,7 +322,7 @@ module TheFox
|
|
303
322
|
track.begin_datetime_s(@filter_options),
|
304
323
|
track.end_datetime_s(@filter_options),
|
305
324
|
duration.to_human,
|
306
|
-
'%s' % [task.
|
325
|
+
'%s' % [task.id_foreign_or_short],
|
307
326
|
'%s %s' % [track.short_id, track.title(15)],
|
308
327
|
]
|
309
328
|
end
|
@@ -331,6 +350,13 @@ module TheFox
|
|
331
350
|
end
|
332
351
|
end
|
333
352
|
|
353
|
+
def print_formatted_track_list
|
354
|
+
puts 'print_formatted_track_list'
|
355
|
+
@timr.tracks(@filter_options).each do |track_id, track|
|
356
|
+
puts track.formatted(@format_opt)
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
334
360
|
def export_tasks_csv
|
335
361
|
if @csv_opt == '-'
|
336
362
|
csv_file_handle = STDOUT
|
@@ -660,11 +686,13 @@ module TheFox
|
|
660
686
|
end
|
661
687
|
|
662
688
|
def help
|
663
|
-
puts 'usage: timr report '
|
689
|
+
puts 'usage: timr report [-d|--day <date>] [-m|--month <[YYYY-]MM>]'
|
690
|
+
puts ' [-y|--year [<YYYY>]] [-a|--all] [--tasks|--tracks]'
|
691
|
+
puts ' [--csv <path>] [--force]'
|
664
692
|
puts ' or: timr report [-h|--help]'
|
665
693
|
puts
|
666
694
|
puts 'Options'
|
667
|
-
puts ' -d, --day <date>
|
695
|
+
puts ' -d, --day [<date>] A single day from 00:00 to 23:59.'
|
668
696
|
puts ' -m, --month <[YYYY-]MM> A single month from 01 to 31.'
|
669
697
|
puts ' -y, --year [<YYYY>] A single year from 01-01 to 12-31.'
|
670
698
|
puts ' -a, --all All.'
|
@@ -672,6 +700,7 @@ module TheFox
|
|
672
700
|
puts ' --tracks Export Tracks'
|
673
701
|
# puts ' --billed Filter only Tasks/Tracks which are billed.'
|
674
702
|
# puts ' --unbilled Filter only Tasks/Tracks which are not billed.'
|
703
|
+
puts ' --format Format Tasks and Tracks output.'
|
675
704
|
puts " --csv <path> Export as CSV file. Use '--csv -' to use STDOUT."
|
676
705
|
puts " --force Force overwrite file."
|
677
706
|
puts
|
@@ -680,6 +709,27 @@ module TheFox
|
|
680
709
|
puts
|
681
710
|
HelpCommand.print_datetime_help
|
682
711
|
puts
|
712
|
+
puts 'Task Format'
|
713
|
+
puts ' %id ID'
|
714
|
+
puts ' %sid Short ID'
|
715
|
+
puts ' %fid Foreign ID'
|
716
|
+
puts ' %n Name'
|
717
|
+
puts ' %d Description'
|
718
|
+
puts
|
719
|
+
puts 'Track Format'
|
720
|
+
puts ' %id ID'
|
721
|
+
puts ' %sid Short ID'
|
722
|
+
puts ' %m Message'
|
723
|
+
puts ' %bdt Begin DateTime'
|
724
|
+
puts ' %bd Begin Date'
|
725
|
+
puts ' %bt Begin Time'
|
726
|
+
puts ' %edt End DateTime'
|
727
|
+
puts ' %ed End Date'
|
728
|
+
puts ' %et End Time'
|
729
|
+
puts
|
730
|
+
puts "Use '%T' prefix for each Task attribute for Track formatting."
|
731
|
+
puts "For example use '%Tid' to use the Task ID."
|
732
|
+
puts
|
683
733
|
end
|
684
734
|
|
685
735
|
end # class TrackCommand
|
@@ -21,6 +21,7 @@ module TheFox
|
|
21
21
|
|
22
22
|
def initialize(argv = Array.new)
|
23
23
|
super()
|
24
|
+
# puts "argv #{argv}"
|
24
25
|
|
25
26
|
@help_opt = false
|
26
27
|
@show_opt = false
|
@@ -71,6 +72,7 @@ module TheFox
|
|
71
72
|
@description_opt = argv.shift
|
72
73
|
when '-e', '--est', '--estimation'
|
73
74
|
@estimation_opt = argv.shift
|
75
|
+
# puts "est: #{@estimation_opt}"
|
74
76
|
when '-b', '--billed'
|
75
77
|
@billed_opt = true
|
76
78
|
when '--unbilled'
|
@@ -99,6 +101,8 @@ module TheFox
|
|
99
101
|
else
|
100
102
|
@tasks_opt << arg
|
101
103
|
end
|
104
|
+
|
105
|
+
# puts "argv #{argv}"
|
102
106
|
end
|
103
107
|
|
104
108
|
if @foreign_id_opt && @unset_foreign_id_opt
|
@@ -169,14 +173,14 @@ module TheFox
|
|
169
173
|
end
|
170
174
|
task_id = @tasks_opt.first
|
171
175
|
|
172
|
-
if @foreign_id_opt.nil? && @unset_foreign_id_opt.nil?
|
173
|
-
@name_opt.nil? && @description_opt.nil? &&
|
174
|
-
@estimation_opt.nil? &&
|
175
|
-
@billed_opt.nil? && @unbilled_opt.nil? &&
|
176
|
-
@hourly_rate_opt.nil? && @unset_hourly_rate_opt.nil? &&
|
176
|
+
if @foreign_id_opt.nil? && @unset_foreign_id_opt.nil? && \
|
177
|
+
@name_opt.nil? && @description_opt.nil? && \
|
178
|
+
@estimation_opt.nil? && \
|
179
|
+
@billed_opt.nil? && @unbilled_opt.nil? && \
|
180
|
+
@hourly_rate_opt.nil? && @unset_hourly_rate_opt.nil? && \
|
177
181
|
@has_flat_rate_opt.nil? && @unset_flat_rate_opt.nil?
|
178
182
|
|
179
|
-
raise TaskCommandError, "No option given. See '
|
183
|
+
raise TaskCommandError, "No option given. See 'timr task -h'."
|
180
184
|
end
|
181
185
|
|
182
186
|
task = @timr.get_task_by_id(task_id)
|
@@ -256,12 +260,12 @@ module TheFox
|
|
256
260
|
|
257
261
|
def run_show_all
|
258
262
|
@timr.tasks.each do |task_id, task|
|
259
|
-
|
263
|
+
task_id = @verbose_opt ? task.id : task.short_id
|
260
264
|
|
261
265
|
if task.foreign_id
|
262
|
-
puts '%s %s %s' % [
|
266
|
+
puts '%s %s %s' % [task_id, task.foreign_id, task.name_s]
|
263
267
|
else
|
264
|
-
puts '%s - %s' % [
|
268
|
+
puts '%s - %s' % [task_id, task.name_s]
|
265
269
|
end
|
266
270
|
end
|
267
271
|
end
|
@@ -307,7 +307,7 @@ module TheFox
|
|
307
307
|
end
|
308
308
|
|
309
309
|
def check_opts_add
|
310
|
-
if @start_date_opt || @start_time_opt ||
|
310
|
+
if @start_date_opt || @start_time_opt || \
|
311
311
|
@end_date_opt || @end_time_opt
|
312
312
|
|
313
313
|
if @start_date_opt.nil?
|
@@ -327,9 +327,9 @@ module TheFox
|
|
327
327
|
end
|
328
328
|
|
329
329
|
def check_opts_set
|
330
|
-
if @start_date_opt.nil? && @start_time_opt.nil? &&
|
331
|
-
@end_date_opt.nil? && @end_time_opt.nil? &&
|
332
|
-
@message_opt.nil? && @task_id_opt.nil? &&
|
330
|
+
if @start_date_opt.nil? && @start_time_opt.nil? && \
|
331
|
+
@end_date_opt.nil? && @end_time_opt.nil? && \
|
332
|
+
@message_opt.nil? && @task_id_opt.nil? && \
|
333
333
|
@billed_opt.nil? && @unbilled_opt.nil?
|
334
334
|
|
335
335
|
raise TrackCommandError, "No option given. See 'timr track --help'."
|
data/lib/timr/model/task.rb
CHANGED
@@ -29,6 +29,11 @@ module TheFox
|
|
29
29
|
@tracks = Hash.new
|
30
30
|
end
|
31
31
|
|
32
|
+
# Get Foreign ID or Short ID.
|
33
|
+
def id_foreign_or_short
|
34
|
+
@foreign_id ? @foreign_id : short_id
|
35
|
+
end
|
36
|
+
|
32
37
|
def foreign_id=(foreign_id)
|
33
38
|
@foreign_id = foreign_id
|
34
39
|
|
@@ -214,9 +219,12 @@ module TheFox
|
|
214
219
|
bdt = track.begin_datetime
|
215
220
|
edt = track.end_datetime || Time.now
|
216
221
|
|
217
|
-
bdt && (
|
218
|
-
|
219
|
-
bdt
|
222
|
+
bdt && ( \
|
223
|
+
# Track A, B
|
224
|
+
bdt < from_opt && edt > from_opt || \
|
225
|
+
|
226
|
+
# Track C, D, F
|
227
|
+
bdt >= from_opt && edt >= from_opt
|
220
228
|
)
|
221
229
|
}
|
222
230
|
elsif from_opt.nil? && !to_opt.nil?
|
@@ -225,9 +233,12 @@ module TheFox
|
|
225
233
|
bdt = track.begin_datetime
|
226
234
|
edt = track.end_datetime || Time.now
|
227
235
|
|
228
|
-
bdt && (
|
229
|
-
|
230
|
-
bdt < to_opt && edt
|
236
|
+
bdt && ( \
|
237
|
+
# Track B, D, E
|
238
|
+
bdt < to_opt && edt <= to_opt || \
|
239
|
+
|
240
|
+
# Track A, C
|
241
|
+
bdt < to_opt && edt > to_opt
|
231
242
|
)
|
232
243
|
}
|
233
244
|
elsif !from_opt.nil? && !to_opt.nil?
|
@@ -236,11 +247,18 @@ module TheFox
|
|
236
247
|
bdt = track.begin_datetime
|
237
248
|
edt = track.end_datetime || Time.now
|
238
249
|
|
239
|
-
bdt && (
|
240
|
-
|
241
|
-
bdt
|
242
|
-
|
243
|
-
|
250
|
+
bdt && ( \
|
251
|
+
# Track D
|
252
|
+
bdt >= from_opt && edt <= to_opt || \
|
253
|
+
|
254
|
+
# Track A
|
255
|
+
bdt < from_opt && edt > to_opt || \
|
256
|
+
|
257
|
+
# Track B
|
258
|
+
bdt < from_opt && edt <= to_opt && edt > from_opt || \
|
259
|
+
|
260
|
+
# Track C
|
261
|
+
bdt >= from_opt && edt > to_opt && bdt < to_opt
|
244
262
|
)
|
245
263
|
}
|
246
264
|
else
|
@@ -759,13 +777,9 @@ module TheFox
|
|
759
777
|
def to_track_array(options = Hash.new)
|
760
778
|
full_id_opt = options.fetch(:full_id, false) # @TODO full_id unit test
|
761
779
|
|
762
|
-
full_id = full_id_opt ? self.id : self.short_id
|
780
|
+
full_id = full_id_opt ? self.id : ( self.foreign_id ? self.foreign_id : self.short_id )
|
763
781
|
|
764
|
-
name_a = [
|
765
|
-
|
766
|
-
if self.foreign_id
|
767
|
-
name_a << self.foreign_id
|
768
|
-
end
|
782
|
+
name_a = ['Task:', full_id]
|
769
783
|
if self.name
|
770
784
|
name_a << self.name
|
771
785
|
end
|
@@ -782,12 +796,10 @@ module TheFox
|
|
782
796
|
|
783
797
|
# Used to print informations to STDOUT.
|
784
798
|
def to_compact_array
|
799
|
+
full_id = self.foreign_id ? self.foreign_id : self.short_id
|
800
|
+
|
785
801
|
to_ax = Array.new
|
786
|
-
|
787
|
-
to_ax << 'Task: %s %s %s' % [self.short_id, self.foreign_id, self.name]
|
788
|
-
else
|
789
|
-
to_ax << 'Task: %s %s' % [self.short_id, self.name]
|
790
|
-
end
|
802
|
+
to_ax << 'Task: %s %s' % [full_id, self.name]
|
791
803
|
if self.description
|
792
804
|
to_ax << 'Description: %s' % [self.description]
|
793
805
|
end
|
@@ -810,13 +822,11 @@ module TheFox
|
|
810
822
|
def to_detailed_array(options = Hash.new)
|
811
823
|
full_id_opt = options.fetch(:full_id, false)
|
812
824
|
|
825
|
+
full_id = full_id_opt ? self.id : self.short_id
|
826
|
+
|
813
827
|
to_ax = Array.new
|
814
828
|
|
815
|
-
|
816
|
-
to_ax << 'Task: %s' % [self.id]
|
817
|
-
else
|
818
|
-
to_ax << 'Task: %s' % [self.short_id]
|
819
|
-
end
|
829
|
+
to_ax << 'Task: %s' % [full_id]
|
820
830
|
|
821
831
|
if self.foreign_id
|
822
832
|
to_ax << 'Foreign ID: %s' % [self.foreign_id]
|
@@ -925,6 +935,22 @@ module TheFox
|
|
925
935
|
to_ax
|
926
936
|
end
|
927
937
|
|
938
|
+
# Return formatted String.
|
939
|
+
#
|
940
|
+
# - `%id` - ID
|
941
|
+
# - `%sid` - Short ID
|
942
|
+
# - `%fid` - Foreign ID
|
943
|
+
# - `%n` - Name
|
944
|
+
# - `%d` - Description
|
945
|
+
def formatted(format, prefix = '%')
|
946
|
+
format
|
947
|
+
.gsub("#{prefix}id", self.id)
|
948
|
+
.gsub("#{prefix}sid", self.short_id ? self.short_id : '')
|
949
|
+
.gsub("#{prefix}fid", self.foreign_id ? self.foreign_id : '')
|
950
|
+
.gsub("#{prefix}n", self.name ? self.name : '')
|
951
|
+
.gsub("#{prefix}d", self.description ? self.description : '')
|
952
|
+
end
|
953
|
+
|
928
954
|
def inspect
|
929
955
|
"#<Task_#{short_id} tracks=#{@tracks.count}>"
|
930
956
|
end
|
@@ -984,6 +1010,8 @@ module TheFox
|
|
984
1010
|
|
985
1011
|
if @estimation
|
986
1012
|
@meta['estimation'] = @estimation.to_i
|
1013
|
+
else
|
1014
|
+
@meta['estimation'] = nil
|
987
1015
|
end
|
988
1016
|
if @hourly_rate
|
989
1017
|
@meta['hourly_rate'] = @hourly_rate.to_f
|
data/lib/timr/model/track.rb
CHANGED
@@ -509,6 +509,43 @@ module TheFox
|
|
509
509
|
self.id == track.id
|
510
510
|
end
|
511
511
|
|
512
|
+
# Return formatted String.
|
513
|
+
#
|
514
|
+
# - `%id` - ID
|
515
|
+
# - `%sid` - Short ID
|
516
|
+
# - `%t` - Title generated from message.
|
517
|
+
# - `%m` - Message
|
518
|
+
# - `%bdt` - Begin DateTime
|
519
|
+
# - `%bd` - Begin Date
|
520
|
+
# - `%bt` - Begin Time
|
521
|
+
# - `%edt` - End DateTime
|
522
|
+
# - `%ed` - End Date
|
523
|
+
# - `%et` - End Time
|
524
|
+
def formatted(format)
|
525
|
+
formatted_s = format
|
526
|
+
.gsub('%id', self.id)
|
527
|
+
.gsub('%sid', self.short_id)
|
528
|
+
.gsub('%t', self.title ? self.title : '')
|
529
|
+
.gsub('%m', self.message ? self.message : '')
|
530
|
+
.gsub('%bdt', self.begin_datetime ? self.begin_datetime.strftime('%F %H:%M') : '')
|
531
|
+
.gsub('%bd', self.begin_datetime ? self.begin_datetime.strftime('%F') : '')
|
532
|
+
.gsub('%bt', self.begin_datetime ? self.begin_datetime.strftime('%H:%M') : '')
|
533
|
+
.gsub('%edt', self.end_datetime ? self.end_datetime.strftime('%F %H:%M') : '')
|
534
|
+
.gsub('%ed', self.end_datetime ? self.end_datetime.strftime('%F') : '')
|
535
|
+
.gsub('%et', self.end_datetime ? self.end_datetime.strftime('%H:%M') : '')
|
536
|
+
|
537
|
+
if @task
|
538
|
+
formatted_s = @task.formatted(formatted_s, '%T')
|
539
|
+
else
|
540
|
+
tmp_task = Task.new
|
541
|
+
tmp_task.id = ''
|
542
|
+
|
543
|
+
formatted_s = tmp_task.formatted(formatted_s, '%T')
|
544
|
+
end
|
545
|
+
|
546
|
+
formatted_s
|
547
|
+
end
|
548
|
+
|
512
549
|
def inspect
|
513
550
|
"#<Track #{short_id}>"
|
514
551
|
end
|
data/lib/timr/timr.rb
CHANGED
data/lib/timr/version.rb
CHANGED
data/man/index.txt
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
timr(1) timr.1.ronn
|
3
|
+
timr-continue(1) timr-continue.1.ronn
|
4
|
+
timr-log(1) timr-log.1.ronn
|
5
|
+
timr-pause(1) timr-pause.1.ronn
|
6
|
+
timr-pop(1) timr-pop.1.ronn
|
7
|
+
timr-push(1) timr-push.1.ronn
|
8
|
+
timr-report(1) timr-report.1.ronn
|
9
|
+
timr-start(1) timr-start.1.ronn
|
10
|
+
timr-status(1) timr-status.1.ronn
|
11
|
+
timr-stop(1) timr-stop.1.ronn
|
12
|
+
timr-task(1) timr-task.1.ronn
|
13
|
+
timr-track(1) timr-track.1.ronn
|
14
|
+
|
15
|
+
timr-ftime(7) timr-ftime.7.ronn
|
data/man/timr-report.1
CHANGED
@@ -14,41 +14,37 @@ This command is designed to print a list of Tasks or Tracks to STDOUT and to exp
|
|
14
14
|
.
|
15
15
|
.SH "OPTIONS"
|
16
16
|
.
|
17
|
-
.
|
18
|
-
\-d, \-\-day \fIdate\fR
|
19
|
-
A single day from 00:00 to 23:59\. See timr\-ftime(7)\.
|
17
|
+
.IP "\(bu" 4
|
18
|
+
\-d, \-\-day \fIdate\fR: A single day from 00:00 to 23:59\. See timr\-ftime(7)\.
|
20
19
|
.
|
21
|
-
.
|
22
|
-
\-m, \-\-month \fI[YYYY\-]MM\fR
|
23
|
-
A single month from 01 to 31\.
|
20
|
+
.IP "\(bu" 4
|
21
|
+
\-m, \-\-month \fI[YYYY\-]MM\fR: A single month from 01 to 31\.
|
24
22
|
.
|
25
|
-
.
|
26
|
-
\-y, \-\-year [\fIYYYY\fR]
|
27
|
-
A single year from 01\-01 to 12\-31\.
|
23
|
+
.IP "\(bu" 4
|
24
|
+
\-y, \-\-year [\fIYYYY\fR]: A single year from 01\-01 to 12\-31\.
|
28
25
|
.
|
29
|
-
.
|
30
|
-
\-a, \-\-all
|
31
|
-
Export all\.
|
26
|
+
.IP "\(bu" 4
|
27
|
+
\-a, \-\-all: Export all\.
|
32
28
|
.
|
33
|
-
.
|
34
|
-
\-\-tasks
|
35
|
-
Export Tasks (default)
|
29
|
+
.IP "\(bu" 4
|
30
|
+
\-\-tasks : Export Tasks (default)
|
36
31
|
.
|
37
|
-
.
|
38
|
-
\-\-tracks
|
39
|
-
Export Tracks
|
32
|
+
.IP "\(bu" 4
|
33
|
+
\-\-tracks: Export Tracks
|
40
34
|
.
|
41
|
-
.
|
42
|
-
\-\-
|
43
|
-
Export as CSV file\. Use \fB\-\-csv \-\fR to use STDOUT\.
|
35
|
+
.IP "\(bu" 4
|
36
|
+
\-\-format See TASK FORMAT and TRACK FORMAT section\.
|
44
37
|
.
|
45
|
-
.
|
46
|
-
\-\-
|
47
|
-
Force overwrite file\.
|
38
|
+
.IP "\(bu" 4
|
39
|
+
\-\-csv \fIpath\fR: Export as CSV file\. Use \fB\-\-csv \-\fR to use STDOUT\.
|
48
40
|
.
|
49
|
-
.
|
50
|
-
|
51
|
-
|
41
|
+
.IP "\(bu" 4
|
42
|
+
\-\-force : Force overwrite file\.
|
43
|
+
.
|
44
|
+
.IP "\(bu" 4
|
45
|
+
\-h, \-\-help: Displays the help page\.
|
46
|
+
.
|
47
|
+
.IP "" 0
|
52
48
|
.
|
53
49
|
.SH "EXAMPLES"
|
54
50
|
.
|
@@ -61,6 +57,8 @@ timr report \-\-day 2017\-01\-02 \-\-csv timr_report_20170102\.csv \-\-tracks
|
|
61
57
|
timr report \-\-month 2017\-01 \-\-csv timr_report_201701\.csv
|
62
58
|
timr report \-\-year 2017 \-\-csv timr_report_2017\.csv
|
63
59
|
timr report \-\-all \-\-csv timr_report_all\.csv
|
60
|
+
timr report \-\-format \'\- %id\'
|
61
|
+
timr report \-\-tracks \-\-format \'\- %Tsid %sid %t\'
|
64
62
|
.
|
65
63
|
.fi
|
66
64
|
.
|
@@ -218,6 +216,73 @@ TRACK_IS_BILLED
|
|
218
216
|
.P
|
219
217
|
The last row in CSV files is always the total sum\.
|
220
218
|
.
|
219
|
+
.SH "TASK FORMAT"
|
220
|
+
.
|
221
|
+
.TP
|
222
|
+
%id
|
223
|
+
ID
|
224
|
+
.
|
225
|
+
.TP
|
226
|
+
%sid
|
227
|
+
Short ID
|
228
|
+
.
|
229
|
+
.TP
|
230
|
+
%fid
|
231
|
+
Foreign ID
|
232
|
+
.
|
233
|
+
.TP
|
234
|
+
%n
|
235
|
+
Name
|
236
|
+
.
|
237
|
+
.TP
|
238
|
+
%d
|
239
|
+
Description
|
240
|
+
.
|
241
|
+
.SH "TRACK FORMAT"
|
242
|
+
.
|
243
|
+
.TP
|
244
|
+
%id
|
245
|
+
ID
|
246
|
+
.
|
247
|
+
.TP
|
248
|
+
%sid
|
249
|
+
Short ID
|
250
|
+
.
|
251
|
+
.TP
|
252
|
+
%t
|
253
|
+
Title generated from message\.
|
254
|
+
.
|
255
|
+
.TP
|
256
|
+
%m
|
257
|
+
Message
|
258
|
+
.
|
259
|
+
.TP
|
260
|
+
%bdt
|
261
|
+
Begin DateTime
|
262
|
+
.
|
263
|
+
.TP
|
264
|
+
%bd
|
265
|
+
Begin Date
|
266
|
+
.
|
267
|
+
.TP
|
268
|
+
%bt
|
269
|
+
Begin Time
|
270
|
+
.
|
271
|
+
.TP
|
272
|
+
%edt
|
273
|
+
End DateTime
|
274
|
+
.
|
275
|
+
.TP
|
276
|
+
%ed
|
277
|
+
End Date
|
278
|
+
.
|
279
|
+
.TP
|
280
|
+
%et
|
281
|
+
End Time
|
282
|
+
.
|
283
|
+
.P
|
284
|
+
Use \fB%T\fR prefix for each Task attribute for Track formatting\. For example use \fB%Tid\fR to use the Task ID\.
|
285
|
+
.
|
221
286
|
.SH "API REFERENCE"
|
222
287
|
\fIhttps://timr\.fox21\.at/api/TheFox/Timr/Command/ReportCommand\.html\fR
|
223
288
|
.
|
data/man/timr-report.1.ronn
CHANGED
@@ -29,6 +29,9 @@ This command is designed to print a list of Tasks or Tracks to STDOUT and to exp
|
|
29
29
|
* --tracks:
|
30
30
|
Export Tracks
|
31
31
|
|
32
|
+
* --format
|
33
|
+
See TASK FORMAT and TRACK FORMAT section.
|
34
|
+
|
32
35
|
* --csv <path>:
|
33
36
|
Export as CSV file. Use `--csv -` to use STDOUT.
|
34
37
|
|
@@ -48,6 +51,8 @@ timr report --day 2017-01-02 --csv timr_report_20170102.csv --tracks
|
|
48
51
|
timr report --month 2017-01 --csv timr_report_201701.csv
|
49
52
|
timr report --year 2017 --csv timr_report_2017.csv
|
50
53
|
timr report --all --csv timr_report_all.csv
|
54
|
+
timr report --format '- %id'
|
55
|
+
timr report --tracks --format '- %Tsid %sid %t'
|
51
56
|
```
|
52
57
|
|
53
58
|
## TASK TABLE COLUMNS
|
@@ -184,6 +189,57 @@ timr report --all --csv timr_report_all.csv
|
|
184
189
|
|
185
190
|
The last row in CSV files is always the total sum.
|
186
191
|
|
192
|
+
## TASK FORMAT
|
193
|
+
|
194
|
+
* %id:
|
195
|
+
ID
|
196
|
+
|
197
|
+
* %sid:
|
198
|
+
Short ID
|
199
|
+
|
200
|
+
* %fid:
|
201
|
+
Foreign ID
|
202
|
+
|
203
|
+
* %n:
|
204
|
+
Name
|
205
|
+
|
206
|
+
* %d:
|
207
|
+
Description
|
208
|
+
|
209
|
+
## TRACK FORMAT
|
210
|
+
|
211
|
+
* %id:
|
212
|
+
ID
|
213
|
+
|
214
|
+
* %sid:
|
215
|
+
Short ID
|
216
|
+
|
217
|
+
* %t:
|
218
|
+
Title generated from message.
|
219
|
+
|
220
|
+
* %m:
|
221
|
+
Message
|
222
|
+
|
223
|
+
* %bdt:
|
224
|
+
Begin DateTime
|
225
|
+
|
226
|
+
* %bd:
|
227
|
+
Begin Date
|
228
|
+
|
229
|
+
* %bt:
|
230
|
+
Begin Time
|
231
|
+
|
232
|
+
* %edt:
|
233
|
+
End DateTime
|
234
|
+
|
235
|
+
* %ed:
|
236
|
+
End Date
|
237
|
+
|
238
|
+
* %et:
|
239
|
+
End Time
|
240
|
+
|
241
|
+
Use `%T` prefix for each Task attribute for Track formatting. For example use `%Tid` to use the Task ID.
|
242
|
+
|
187
243
|
## API REFERENCE
|
188
244
|
|
189
245
|
<https://timr.fox21.at/api/TheFox/Timr/Command/ReportCommand.html>
|
data/timr.sublime-project
CHANGED
@@ -24,6 +24,13 @@
|
|
24
24
|
"working_dir": "${project_path:${folder}}",
|
25
25
|
"path": "$HOME/.rbenv/shims:/usr/local/bin:$PATH",
|
26
26
|
"shell": true
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"name": "Install",
|
30
|
+
"cmd": [ "./bin/install.sh -f" ],
|
31
|
+
"working_dir": "${project_path:${folder}}",
|
32
|
+
"path": "$HOME/.rbenv/shims:/usr/local/bin:$PATH",
|
33
|
+
"shell": true
|
27
34
|
}
|
28
35
|
]
|
29
36
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Mayer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -191,6 +191,7 @@ files:
|
|
191
191
|
- lib/timr/version.rb
|
192
192
|
- man/.gitignore
|
193
193
|
- man/_footer
|
194
|
+
- man/index.txt
|
194
195
|
- man/timr-continue.1
|
195
196
|
- man/timr-continue.1.ronn
|
196
197
|
- man/timr-ftime.7
|