startask 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/lib/startask.rb +229 -0
- data.tar.gz.sig +0 -0
- metadata +91 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ead4294333d7239733bbaec126396d45172f27bf7d8be258087e49d11b14ed48
|
4
|
+
data.tar.gz: 4c1944a82197e8a32389858b941e801b41048336b6eb3e3993fe7d0893ec12d8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2c8efdc52ff696b70f53ca1e4b53dda62a03db3d7ae66f827411a47fc9f7c281edfa2fd72acd77e1d258b951f722a69968df00dafa3088afbdd003e5d221ba65
|
7
|
+
data.tar.gz: 13a7bff394b74bc3455c1bfb6ed6f1ec51daa64967e3d497d6207e0d65adb635460dfc4ae5b6eb3ba43243339d5b69cd6d3d04f28339276716eba41c2d897db5
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/lib/startask.rb
ADDED
@@ -0,0 +1,229 @@
|
|
1
|
+
!#/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: startask.rb
|
4
|
+
# description: An experimental gem representing the STAR technique.
|
5
|
+
|
6
|
+
require 'kvx'
|
7
|
+
require 'rxfhelper'
|
8
|
+
|
9
|
+
class ActionItem
|
10
|
+
|
11
|
+
attr_reader :log
|
12
|
+
|
13
|
+
def initialize(s)
|
14
|
+
@title = s
|
15
|
+
@log = []
|
16
|
+
end
|
17
|
+
|
18
|
+
def done()
|
19
|
+
logit :completed
|
20
|
+
end
|
21
|
+
|
22
|
+
alias completed done
|
23
|
+
|
24
|
+
def to_s()
|
25
|
+
@title
|
26
|
+
end
|
27
|
+
|
28
|
+
def started()
|
29
|
+
logit :started
|
30
|
+
end
|
31
|
+
|
32
|
+
def status()
|
33
|
+
@log.last
|
34
|
+
end
|
35
|
+
|
36
|
+
def stopped()
|
37
|
+
logit :stopped
|
38
|
+
end
|
39
|
+
|
40
|
+
def status=(status)
|
41
|
+
|
42
|
+
case status
|
43
|
+
when :done
|
44
|
+
done()
|
45
|
+
when :started
|
46
|
+
started()
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def logit(label)
|
54
|
+
@log << [label, Time.now.strftime("%H:%M%P")]
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
class Actions
|
60
|
+
|
61
|
+
def import(a)
|
62
|
+
|
63
|
+
@a = a.map do |x|
|
64
|
+
x.is_a?(String) ? ActionItem.new(x) : Actions.new.import(x)
|
65
|
+
end
|
66
|
+
|
67
|
+
return self
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
def [](i)
|
72
|
+
@a[i]
|
73
|
+
end
|
74
|
+
|
75
|
+
def to_s()
|
76
|
+
@a.each(&:to_s)
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
class ResultItem
|
82
|
+
|
83
|
+
def initialize(s)
|
84
|
+
@evidence = s
|
85
|
+
end
|
86
|
+
|
87
|
+
def to_s()
|
88
|
+
@evidence
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
class Results
|
94
|
+
|
95
|
+
def initialize()
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
def import(a)
|
100
|
+
|
101
|
+
@a = a.map do |x|
|
102
|
+
x.is_a?(String) ? ResultItem.new(x) : Results.new.import(x)
|
103
|
+
end
|
104
|
+
|
105
|
+
return self
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
def [](i)
|
110
|
+
@a[i]
|
111
|
+
end
|
112
|
+
|
113
|
+
def to_s()
|
114
|
+
|
115
|
+
@a.map.with_index do |x, i|
|
116
|
+
if x.is_a? ResultItem then
|
117
|
+
x.to_s
|
118
|
+
elsif x.is_a? Results
|
119
|
+
x.print_row(i, indent: 0)
|
120
|
+
end
|
121
|
+
end.join("\n")
|
122
|
+
end
|
123
|
+
|
124
|
+
def print_row(id, indent: 0)
|
125
|
+
|
126
|
+
@a.map.with_index do |x, i|
|
127
|
+
if x.is_a? ResultItem then
|
128
|
+
(' ' * indent) + x.to_s
|
129
|
+
elsif x.is_a? Results
|
130
|
+
x.print_row(i, indent: indent+1)
|
131
|
+
end
|
132
|
+
end.join("\n")
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
# task dictionary
|
138
|
+
# ----------------
|
139
|
+
# import (method) Imports a new "task" which includes a STAR document outline
|
140
|
+
# done (method) The task has been completed
|
141
|
+
# completed - alias of method *done*
|
142
|
+
# status (method) returns the most recent status from the task log
|
143
|
+
# log (attr) returns an Array object containing a timeline of status messages in chronological order
|
144
|
+
# progress (method) returns the most recent action completed or started
|
145
|
+
# duration (method) returns the actual duration
|
146
|
+
# type (attr) Frequency type e.g. (daily, weekly, monthly)
|
147
|
+
# estimate_duration (attr) OPTIONAL. the estimate duration is explicitly declared in the STAR document or is calculated from estimate durations in the actions if declared.
|
148
|
+
# actions (method) returns the Actions object
|
149
|
+
# location (attr) set or get the current physical location
|
150
|
+
# started (method) adds a status message to the log
|
151
|
+
|
152
|
+
class StarTask
|
153
|
+
|
154
|
+
attr_reader :situation, :task, :actions, :log, :results
|
155
|
+
|
156
|
+
def initialize(src=nil, debug: false)
|
157
|
+
@debug = debug
|
158
|
+
@log = []
|
159
|
+
import src if src
|
160
|
+
end
|
161
|
+
|
162
|
+
def done()
|
163
|
+
logit :completed
|
164
|
+
end
|
165
|
+
|
166
|
+
alias completed done
|
167
|
+
|
168
|
+
def import(raws)
|
169
|
+
|
170
|
+
s, _ = RXFHelper.read raws
|
171
|
+
puts 's: ' + s.inspect if @debug
|
172
|
+
|
173
|
+
obj = if s.lstrip[0] == '#' then
|
174
|
+
|
175
|
+
a = s.split(/^#+ /)
|
176
|
+
a.shift
|
177
|
+
|
178
|
+
rawh = a.map do |x|
|
179
|
+
|
180
|
+
rawlabel, body = x.split(/\n/,2)
|
181
|
+
|
182
|
+
[rawlabel.downcase.gsub(/\s+/, '_').to_sym,
|
183
|
+
body.strip.gsub(/^(\s*)[\*\+] /,'\1')]
|
184
|
+
|
185
|
+
end.to_h
|
186
|
+
|
187
|
+
h = {}
|
188
|
+
h[:situation] = rawh[:situation]
|
189
|
+
h[:task] = rawh[:task]
|
190
|
+
h[:action] = {items: LineTree.new(rawh[:action]).to_a(normalize: true)}
|
191
|
+
h[:result] = {items: LineTree.new(rawh[:result]).to_a(normalize: true)}
|
192
|
+
h
|
193
|
+
|
194
|
+
else
|
195
|
+
s
|
196
|
+
end
|
197
|
+
|
198
|
+
puts 'obj: ' + obj.inspect if @debug
|
199
|
+
|
200
|
+
kvx = Kvx.new obj
|
201
|
+
@situation = kvx.situation
|
202
|
+
@task = kvx.task
|
203
|
+
@actions = Actions.new.import(kvx.action[:items])
|
204
|
+
@results = Results.new.import(kvx.result[:items])
|
205
|
+
|
206
|
+
end
|
207
|
+
|
208
|
+
# adds a status message to the log
|
209
|
+
#
|
210
|
+
def started()
|
211
|
+
logit :started
|
212
|
+
end
|
213
|
+
|
214
|
+
def status()
|
215
|
+
@log.last
|
216
|
+
end
|
217
|
+
|
218
|
+
def stopped()
|
219
|
+
logit :stopped
|
220
|
+
end
|
221
|
+
|
222
|
+
private
|
223
|
+
|
224
|
+
def logit(label)
|
225
|
+
@log << [label, Time.now.strftime("%H:%M%P")]
|
226
|
+
return label
|
227
|
+
end
|
228
|
+
|
229
|
+
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: startask
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|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u/dUjAmBgNVHREEHzAdgRtnZW1tYXN0ZXJAamFt
|
28
|
+
ZXNyb2JlcnRzb24uZXUwJgYDVR0SBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
29
|
+
c29uLmV1MA0GCSqGSIb3DQEBCwUAA4IBgQC+aPFOdtBsXgBP+QspB7aMvc9aNUV6
|
30
|
+
76l0CHHPQSd7OP+FtAA3SoNyt+RBCmTpeBHWU6HLXov7/MYtWx3ftL16uP9goXcA
|
31
|
+
YaBAf4fR3JXaCMHHkgFghdjJtvDyq4ast8rkDb4zpNyLyuecz5o9YArbqQ8vcr+y
|
32
|
+
UK/K2+fKWCG6l8a9eCXoITiXw/wq1VU7pE8XzyiS6yZwPhzAcIvIPrfmlXgd2Foy
|
33
|
+
rQgDTpOKBjg0YuxYf6weC20uR1NmaKiFdo2AX5mt1YTIqgzLOZ0Wr76PHhLUXV0/
|
34
|
+
dxFY4fsIxLg/wDTzLBloJLk4rJ609PtXFRPgYIwt5eafgpzEWB/vEEn2XBqdSHoR
|
35
|
+
wuE5sOkZjdE6PI78COErjIbzpmjUwXv+becBBKnwOPILFGat3GSyANQeazCP0SqT
|
36
|
+
BWN+6F7HF8UfTUHWCQqk9FoCAYtbfQWLUqZwWN+dLzn1CPK0yoPjuSR59/HShliV
|
37
|
+
IUEz9QfhClpwEVu+leXBe7RwfxADwAWYEfI=
|
38
|
+
-----END CERTIFICATE-----
|
39
|
+
date: 2022-09-28 00:00:00.000000000 Z
|
40
|
+
dependencies:
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rxfreadwrite
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.2'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 0.2.6
|
51
|
+
type: :runtime
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0.2'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.2.6
|
61
|
+
description:
|
62
|
+
email: digital.robertson@gmail.com
|
63
|
+
executables: []
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files: []
|
66
|
+
files:
|
67
|
+
- lib/startask.rb
|
68
|
+
homepage: https://github.com/jrobertson/startask
|
69
|
+
licenses:
|
70
|
+
- MIT
|
71
|
+
metadata: {}
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubygems_version: 3.3.7
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: An experimental gem representing the STAR technique.
|
91
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|