task_report 0.2.2 → 0.2.3
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.
- checksums.yaml +4 -4
- data/README.md +10 -6
- data/VERSION +1 -1
- data/bin/task +4 -2
- data/lib/task_report.rb +12 -2
- data/lib/task_report/report.rb +38 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 908081dcb425e2557ce5daa1076c7d2946e55c33
|
4
|
+
data.tar.gz: 67ce04ed13abdd51cc1535a0aeab9d0f152de912
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5944f6161c7a43abb051eae208bb4403da3989de3335268adbd7862461c56eff92074d540aa770a3b1bf1d3c7d24ec5a175e9beff545b95ada59963be33f2c5
|
7
|
+
data.tar.gz: b4b41dc1a3a062bc9cf5a6684d75f89768747e141bac581bc52a3a23dc486dc040c241466c28566d3c35041a11383491fa65dd7514a7f86995b84d291870c882
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## Description
|
2
2
|
|
3
|
-
This tool enables you to track where your time goes via a private [gist](https://gist.github.com). The data itself is stored in a gist as json, and a formatted summary can be generated and shared (
|
3
|
+
This tool enables you to track where your time goes via a private [gist](https://gist.github.com). The data itself is stored in a gist as json, and a formatted summary can be generated and shared (coming soon, actually. Right now there is only a stdout summary). This means that task tracking is not tied to any specific machine, but rather a github account.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -40,8 +40,10 @@ Use `task` as follows:
|
|
40
40
|
`task list`
|
41
41
|
- Lists all of today's tasks
|
42
42
|
|
43
|
-
`task summary`
|
43
|
+
`task summary [--gist, -g]`
|
44
44
|
- prints a task summary to the command line
|
45
|
+
- if the `--gist` or `-g` options are used, creates a markdown gist summary
|
46
|
+
and prints the link to stdout
|
45
47
|
|
46
48
|
`task delete {TASK-ID, TASK-DESCRIPTION, today, gist}`
|
47
49
|
- deletes the provided task if it exists
|
@@ -52,25 +54,27 @@ Use `task` as follows:
|
|
52
54
|
- shows this message
|
53
55
|
```
|
54
56
|
|
55
|
-
##
|
57
|
+
## Dependencies
|
56
58
|
|
57
59
|
- ruby >= 2.3.0
|
58
60
|
|
59
61
|
## TODO:
|
60
62
|
|
61
63
|
- [x] `continue`
|
62
|
-
- [ ] `info`
|
63
64
|
- [x] `delete`
|
64
|
-
- [ ] confirmation messages for `delete`
|
65
65
|
- [x] `list`
|
66
66
|
- [x] `current`
|
67
67
|
- [x] basic `summary`
|
68
|
+
- [x] gist `summary`
|
68
69
|
- [x] add configuration file support
|
69
|
-
- [ ] gist `summary`
|
70
70
|
- [x] setup install
|
71
|
+
- [ ] `info` - display information about the current gist file (url, etc)
|
72
|
+
- [ ] confirmation messages for `delete`
|
71
73
|
- [ ] add jira support?
|
72
74
|
- at the very least, a ticket field
|
75
|
+
- stretch goal: add the ability to make new issues, and update time estimates for existing ones
|
73
76
|
- [ ] allow `summary` to take a gist id, so you can retroactively generate summaries
|
77
|
+
- [ ] add User.name as well as User.github_username, so we an pretty print
|
74
78
|
|
75
79
|
## License
|
76
80
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/bin/task
CHANGED
@@ -22,8 +22,10 @@ def show_usage_message(exit_status = 0)
|
|
22
22
|
`task list`
|
23
23
|
- Lists all of today's tasks
|
24
24
|
|
25
|
-
`task summary`
|
25
|
+
`task summary [--gist, -g]`
|
26
26
|
- prints a task summary to the command line
|
27
|
+
- if the `--gist` or `-g` options are used, creates a markdown gist summary
|
28
|
+
and prints the link to stdout
|
27
29
|
|
28
30
|
`task delete {TASK-ID, TASK-DESCRIPTION, today, gist}`
|
29
31
|
- deletes the provided task if it exists
|
@@ -52,7 +54,7 @@ when 'delete'
|
|
52
54
|
when 'current'
|
53
55
|
TaskReport.current
|
54
56
|
when 'summary'
|
55
|
-
TaskReport.summary
|
57
|
+
TaskReport.summary(ARGV[1])
|
56
58
|
else
|
57
59
|
show_usage_message
|
58
60
|
end
|
data/lib/task_report.rb
CHANGED
@@ -98,11 +98,21 @@ module TaskReport
|
|
98
98
|
puts 'Something went wrong. There are multiple ongoing tasks.'
|
99
99
|
end
|
100
100
|
|
101
|
-
def summary
|
101
|
+
def summary(options)
|
102
102
|
return if no_gist?
|
103
103
|
|
104
104
|
@report ||= Report.create_from_gist(report_gist)
|
105
|
-
|
105
|
+
|
106
|
+
if ['--gist', '-g'].include? options
|
107
|
+
@report.gist_summary
|
108
|
+
else
|
109
|
+
unless options.nil?
|
110
|
+
puts "The #{options} option is not recorgnized.\n"\
|
111
|
+
"Printing the summary to the stdout.\n\n"
|
112
|
+
end
|
113
|
+
|
114
|
+
@report.print_summary
|
115
|
+
end
|
106
116
|
end
|
107
117
|
|
108
118
|
private
|
data/lib/task_report/report.rb
CHANGED
@@ -30,6 +30,7 @@ module TaskReport
|
|
30
30
|
description: gist_description,
|
31
31
|
json_file_name: json_file_name,
|
32
32
|
gist_id: gist['id'],
|
33
|
+
gist_html_url: gist['html_url'],
|
33
34
|
existing_json_content: Gist.file_content(raw_url)
|
34
35
|
)
|
35
36
|
end
|
@@ -114,19 +115,40 @@ module TaskReport
|
|
114
115
|
end
|
115
116
|
end
|
116
117
|
|
118
|
+
def gist_summary
|
119
|
+
if @tasks.empty?
|
120
|
+
puts 'There are no tasks reported for today.'
|
121
|
+
return
|
122
|
+
end
|
123
|
+
|
124
|
+
puts 'Creating a gist summary.'
|
125
|
+
|
126
|
+
Gist.edit(@gist_id,
|
127
|
+
description: @description, # do we actually need this? Seems odd...
|
128
|
+
files: {
|
129
|
+
'summary.md' => {
|
130
|
+
content: gist_summary_content
|
131
|
+
}
|
132
|
+
}
|
133
|
+
)
|
134
|
+
|
135
|
+
puts "#{@gist_html_url}#file-summary-md"
|
136
|
+
end
|
137
|
+
|
117
138
|
def save_to_gist!
|
118
139
|
if @gist_id
|
119
|
-
|
140
|
+
edit_existing_data_gist!
|
120
141
|
else
|
121
|
-
|
142
|
+
save_new_data_gist!
|
122
143
|
end
|
123
144
|
end
|
124
145
|
|
125
146
|
private
|
126
|
-
def initialize(description:, json_file_name:, gist_id: nil, existing_json_content: {})
|
147
|
+
def initialize(description:, json_file_name:, gist_id: nil, gist_html_url: nil, existing_json_content: {})
|
127
148
|
@description = description
|
128
149
|
@json_file_name = json_file_name
|
129
150
|
@gist_id = gist_id
|
151
|
+
@gist_html_url = gist_html_url
|
130
152
|
|
131
153
|
@date = Time.parse(
|
132
154
|
existing_json_content.fetch('date', Time.now.strftime('%Y-%m-%d %z'))
|
@@ -149,7 +171,7 @@ module TaskReport
|
|
149
171
|
JSON.pretty_generate(to_h)
|
150
172
|
end
|
151
173
|
|
152
|
-
def
|
174
|
+
def save_new_data_gist!
|
153
175
|
puts "Starting a new report gist for the day."
|
154
176
|
|
155
177
|
Gist.create(
|
@@ -163,7 +185,7 @@ module TaskReport
|
|
163
185
|
)
|
164
186
|
end
|
165
187
|
|
166
|
-
def
|
188
|
+
def edit_existing_data_gist!
|
167
189
|
puts "Saving to today's report gist."
|
168
190
|
|
169
191
|
Gist.edit(@gist_id,
|
@@ -198,5 +220,16 @@ module TaskReport
|
|
198
220
|
def ensure_only_one_ongoing_task!
|
199
221
|
raise MultipleOngoingTasks if @tasks.count(&:ongoing?) > 1
|
200
222
|
end
|
223
|
+
|
224
|
+
def gist_summary_content
|
225
|
+
lines = ["## #{User.name} Task Report #{@date.strftime('%Y-%m-%d')}", '']
|
226
|
+
|
227
|
+
@tasks.each do |task|
|
228
|
+
lines << "- '#{task.description}'"
|
229
|
+
lines << " - #{task.duration.to_s}"
|
230
|
+
end
|
231
|
+
|
232
|
+
lines.join("\n")
|
233
|
+
end
|
201
234
|
end
|
202
235
|
end
|