task_report 0.2.3 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 908081dcb425e2557ce5daa1076c7d2946e55c33
4
- data.tar.gz: 67ce04ed13abdd51cc1535a0aeab9d0f152de912
3
+ metadata.gz: 58b3dcb6655e094c4542b46c02fda154acafa640
4
+ data.tar.gz: 3f4d076313447b0c0a3e8a91b2dc9a4b52c44b6d
5
5
  SHA512:
6
- metadata.gz: b5944f6161c7a43abb051eae208bb4403da3989de3335268adbd7862461c56eff92074d540aa770a3b1bf1d3c7d24ec5a175e9beff545b95ada59963be33f2c5
7
- data.tar.gz: b4b41dc1a3a062bc9cf5a6684d75f89768747e141bac581bc52a3a23dc486dc040c241466c28566d3c35041a11383491fa65dd7514a7f86995b84d291870c882
6
+ metadata.gz: ef272ded1ba57d994876ff8366e5ef6f8eb2cc1ed8e41367dd664cc3cd1ce73698df6b0ce7e06fb9b7fbd87d64d48a7d9fe29be5cb84eae59095413431d927c2
7
+ data.tar.gz: 37474c3bbd1e3454465872a58001e31abab1a9ef98edcffa65e7bed9855f3a0117d7bc152d0d004036d0967d675f58774304735645cf8a8b89bfbe0b86ad835b
data/README.md CHANGED
@@ -50,6 +50,10 @@ Use `task` as follows:
50
50
  - if 'today' is passed, then all tasks in today's report will be deleted
51
51
  - if 'gist' is passed, then the whole report gist for today will be deleted
52
52
 
53
+ `task note TASK_ID TASK_NOTE`
54
+ - adds arbitrary note TASK_NOTE to task TASK_ID
55
+ - these notes will be appear in summaries as line items (markdown supported)
56
+
53
57
  `task help`
54
58
  - shows this message
55
59
  ```
@@ -58,24 +62,6 @@ Use `task` as follows:
58
62
 
59
63
  - ruby >= 2.3.0
60
64
 
61
- ## TODO:
62
-
63
- - [x] `continue`
64
- - [x] `delete`
65
- - [x] `list`
66
- - [x] `current`
67
- - [x] basic `summary`
68
- - [x] gist `summary`
69
- - [x] add configuration file support
70
- - [x] setup install
71
- - [ ] `info` - display information about the current gist file (url, etc)
72
- - [ ] confirmation messages for `delete`
73
- - [ ] add jira support?
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
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
78
-
79
65
  ## License
80
66
 
81
67
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.3.3
data/bin/task CHANGED
@@ -32,6 +32,10 @@ def show_usage_message(exit_status = 0)
32
32
  - if 'today' is passed, then all tasks in today's report will be deleted
33
33
  - if 'gist' is passed, then the whole report gist for today will be deleted
34
34
 
35
+ `task note TASK_ID TASK_NOTE`
36
+ - adds arbitrary note TASK_NOTE to task TASK_ID
37
+ - these notes will be appear in summaries as line items (markdown supported)
38
+
35
39
  `task help`
36
40
  - shows this message"
37
41
 
@@ -55,6 +59,8 @@ when 'current'
55
59
  TaskReport.current
56
60
  when 'summary'
57
61
  TaskReport.summary(ARGV[1])
62
+ when 'note'
63
+ TaskReport.note(ARGV[1], ARGV[2])
58
64
  else
59
65
  show_usage_message
60
66
  end
@@ -112,6 +112,10 @@ module TaskReport
112
112
  @tasks.each do |task|
113
113
  puts "'#{task.description}'"
114
114
  puts " - #{task.duration.to_s}"
115
+
116
+ task.notes.each do |note|
117
+ puts " - #{note}"
118
+ end
115
119
  end
116
120
  end
117
121
 
@@ -143,6 +147,14 @@ module TaskReport
143
147
  end
144
148
  end
145
149
 
150
+ def add_note(task_id, note)
151
+ task = find_task_by_id(task_id)
152
+ raise TaskDNE if task.nil?
153
+
154
+ task.add_note(note)
155
+ puts "Note added to #{task.to_s}"
156
+ end
157
+
146
158
  private
147
159
  def initialize(description:, json_file_name:, gist_id: nil, gist_html_url: nil, existing_json_content: {})
148
160
  @description = description
@@ -227,6 +239,10 @@ module TaskReport
227
239
  @tasks.each do |task|
228
240
  lines << "- '#{task.description}'"
229
241
  lines << " - #{task.duration.to_s}"
242
+
243
+ task.notes.each do |note|
244
+ lines << " - #{note}"
245
+ end
230
246
  end
231
247
 
232
248
  lines.join("\n")
@@ -5,7 +5,7 @@ module TaskReport
5
5
  class Task
6
6
  TaskOngoing = Class.new StandardError
7
7
 
8
- attr_reader :id, :description
8
+ attr_reader :id, :description, :notes
9
9
 
10
10
  def self.from_existing_tasks(hash)
11
11
  time =
@@ -19,21 +19,24 @@ module TaskReport
19
19
  self.new(
20
20
  id: hash['id'],
21
21
  description: hash['description'],
22
- time: time
22
+ time: time,
23
+ notes: hash['notes']
23
24
  )
24
25
  end
25
26
 
26
- def initialize(description:, time: nil, id: nil)
27
+ def initialize(description:, time: nil, id: nil, notes: nil)
27
28
  @description = description
28
29
  @time = time || [{ start: Time.now, end: nil }]
29
30
  @id = id || SecureRandom.hex(4)
31
+ @notes = notes || []
30
32
  end
31
33
 
32
34
  def to_h
33
35
  {
34
36
  id: @id,
35
37
  description: @description,
36
- time: @time
38
+ time: @time,
39
+ notes: @notes
37
40
  }
38
41
  end
39
42
 
@@ -68,5 +71,9 @@ module TaskReport
68
71
  def ongoing?
69
72
  @time.last[:end].nil?
70
73
  end
74
+
75
+ def add_note(note)
76
+ @notes << note
77
+ end
71
78
  end
72
79
  end
data/lib/task_report.rb CHANGED
@@ -115,6 +115,17 @@ module TaskReport
115
115
  end
116
116
  end
117
117
 
118
+ def note(task_id, note)
119
+ return if no_gist?
120
+
121
+ @report ||= Report.create_from_gist(report_gist)
122
+ @report.add_note(task_id, note)
123
+
124
+ @report.save_to_gist!
125
+ rescue Report::TaskDNE
126
+ puts "Task '#{identifier}' does not exist - nothing to do."
127
+ end
128
+
118
129
  private
119
130
  def report_gist
120
131
  @report_gist ||=
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: task_report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mat Pataki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-18 00:00:00.000000000 Z
11
+ date: 2016-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler