doing 2.1.21 → 2.1.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardoc/checksums +13 -13
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/CHANGELOG.md +16 -15
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/Rakefile +4 -2
- data/bin/doing +44 -44
- data/docs/doc/Array.html +7 -35
- data/docs/doc/BooleanTermParser/Clause.html +1 -1
- data/docs/doc/BooleanTermParser/Operator.html +1 -1
- data/docs/doc/BooleanTermParser/Query.html +1 -1
- data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
- data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
- data/docs/doc/BooleanTermParser.html +1 -1
- data/docs/doc/Doing/Color.html +1 -1
- data/docs/doc/Doing/Completion.html +1 -1
- data/docs/doc/Doing/Configuration.html +1 -1
- data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
- data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
- data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
- data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
- data/docs/doc/Doing/Errors/NoResults.html +1 -1
- data/docs/doc/Doing/Errors/PluginException.html +1 -1
- data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
- data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
- data/docs/doc/Doing/Errors.html +1 -1
- data/docs/doc/Doing/Hooks.html +1 -1
- data/docs/doc/Doing/Item.html +1 -1
- data/docs/doc/Doing/Items.html +1 -1
- data/docs/doc/Doing/LogAdapter.html +1 -1
- data/docs/doc/Doing/Note.html +1 -1
- data/docs/doc/Doing/Pager.html +1 -1
- data/docs/doc/Doing/Plugins.html +1 -1
- data/docs/doc/Doing/Prompt.html +5 -5
- data/docs/doc/Doing/Section.html +1 -1
- data/docs/doc/Doing/TemplateString.html +2 -2
- data/docs/doc/Doing/Util/Backup.html +1 -1
- data/docs/doc/Doing/Util.html +1 -1
- data/docs/doc/Doing/WWID.html +1 -1
- data/docs/doc/Doing.html +4 -4
- data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
- data/docs/doc/GLI/Commands.html +1 -1
- data/docs/doc/GLI.html +1 -1
- data/docs/doc/Hash.html +76 -4
- data/docs/doc/Numeric.html +1 -1
- data/docs/doc/PhraseParser/Operator.html +1 -1
- data/docs/doc/PhraseParser/PhraseClause.html +1 -1
- data/docs/doc/PhraseParser/Query.html +1 -1
- data/docs/doc/PhraseParser/QueryParser.html +1 -1
- data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
- data/docs/doc/PhraseParser/TermClause.html +1 -1
- data/docs/doc/PhraseParser.html +1 -1
- data/docs/doc/Status.html +1 -1
- data/docs/doc/String.html +63 -1
- data/docs/doc/Symbol.html +1 -1
- data/docs/doc/Time.html +1 -1
- data/docs/doc/_index.html +20 -13
- data/docs/doc/class_list.html +1 -1
- data/docs/doc/file.README.html +2 -2
- data/docs/doc/index.html +2 -2
- data/docs/doc/method_list.html +238 -214
- data/docs/doc/top-level-namespace.html +1 -92
- data/doing.rdoc +12 -7
- data/lib/doing/array.rb +5 -4
- data/lib/doing/array_chronify.rb +4 -3
- data/lib/doing/configuration.rb +1 -1
- data/lib/doing/hash.rb +21 -3
- data/lib/doing/item.rb +2 -2
- data/lib/doing/log_adapter.rb +1 -1
- data/lib/doing/pager.rb +1 -1
- data/lib/doing/plugins/export/template_export.rb +8 -2
- data/lib/doing/prompt.rb +4 -2
- data/lib/doing/string.rb +10 -1
- data/lib/doing/template_string.rb +7 -0
- data/lib/doing/types.rb +20 -16
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +3 -9
- data/lib/doing.rb +1 -0
- data/lib/helpers/threaded_tests.rb +73 -50
- metadata +2 -2
@@ -91,97 +91,6 @@
|
|
91
91
|
|
92
92
|
</p>
|
93
93
|
|
94
|
-
|
95
|
-
<h2>
|
96
|
-
Constant Summary
|
97
|
-
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
98
|
-
</h2>
|
99
|
-
|
100
|
-
<dl class="constants">
|
101
|
-
|
102
|
-
<dt id="REGEX_BOOL-constant" class="">REGEX_BOOL =
|
103
|
-
|
104
|
-
</dt>
|
105
|
-
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(?:and|all|any|or|not|none|p(?:at(?:tern)?)?)$</span><span class='regexp_end'>/i</span></span></pre></dd>
|
106
|
-
|
107
|
-
<dt id="REGEX_SORT_ORDER-constant" class="">REGEX_SORT_ORDER =
|
108
|
-
|
109
|
-
</dt>
|
110
|
-
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(?:a(?:sc)?|d(?:esc)?)$</span><span class='regexp_end'>/i</span></span></pre></dd>
|
111
|
-
|
112
|
-
<dt id="REGEX_VALUE_QUERY-constant" class="">REGEX_VALUE_QUERY =
|
113
|
-
|
114
|
-
</dt>
|
115
|
-
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(?:!)?@?(?:\S+) +(?:!?[<>=][=*]?|[$*^]=) +(?:.*?)$</span><span class='regexp_end'>/</span></span></pre></dd>
|
116
|
-
|
117
|
-
<dt id="REGEX_CLOCK-constant" class="">REGEX_CLOCK =
|
118
|
-
|
119
|
-
</dt>
|
120
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>(?:\d{1,2}+(?::\d{1,2}+)?(?: *(?:am|pm))?|midnight|noon)</span><span class='tstring_end'>'</span></span></pre></dd>
|
121
|
-
|
122
|
-
<dt id="REGEX_TIME-constant" class="">REGEX_TIME =
|
123
|
-
|
124
|
-
</dt>
|
125
|
-
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="top-level-namespace.html#REGEX_CLOCK-constant" title="REGEX_CLOCK (constant)">REGEX_CLOCK</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>$</span><span class='regexp_end'>/i</span></span></pre></dd>
|
126
|
-
|
127
|
-
<dt id="REGEX_DAY-constant" class="">REGEX_DAY =
|
128
|
-
|
129
|
-
</dt>
|
130
|
-
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(mon|tue|wed|thur?|fri|sat|sun)(\w+(day)?)?$</span><span class='regexp_end'>/i</span></span></pre></dd>
|
131
|
-
|
132
|
-
<dt id="REGEX_RANGE_INDICATOR-constant" class="">REGEX_RANGE_INDICATOR =
|
133
|
-
|
134
|
-
</dt>
|
135
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> +(?:to|through|thru|(?:un)?til|-+) +</span><span class='tstring_end'>'</span></span></pre></dd>
|
136
|
-
|
137
|
-
<dt id="REGEX_RANGE-constant" class="">REGEX_RANGE =
|
138
|
-
|
139
|
-
</dt>
|
140
|
-
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\S+</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="top-level-namespace.html#REGEX_RANGE_INDICATOR-constant" title="REGEX_RANGE_INDICATOR (constant)">REGEX_RANGE_INDICATOR</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>+\S+</span><span class='regexp_end'>/i</span></span></pre></dd>
|
141
|
-
|
142
|
-
<dt id="REGEX_TIME_RANGE-constant" class="">REGEX_TIME_RANGE =
|
143
|
-
|
144
|
-
</dt>
|
145
|
-
<dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="top-level-namespace.html#REGEX_CLOCK-constant" title="REGEX_CLOCK (constant)">REGEX_CLOCK</a></span></span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="top-level-namespace.html#REGEX_RANGE_INDICATOR-constant" title="REGEX_RANGE_INDICATOR (constant)">REGEX_RANGE_INDICATOR</a></span></span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="top-level-namespace.html#REGEX_CLOCK-constant" title="REGEX_CLOCK (constant)">REGEX_CLOCK</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>$</span><span class='regexp_end'>/i</span></span></pre></dd>
|
146
|
-
|
147
|
-
<dt id="InvalidExportType-constant" class="">InvalidExportType =
|
148
|
-
|
149
|
-
</dt>
|
150
|
-
<dd><pre class="code"><span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>RuntimeError</span><span class='rparen'>)</span></pre></dd>
|
151
|
-
|
152
|
-
<dt id="MissingConfigFile-constant" class="">MissingConfigFile =
|
153
|
-
|
154
|
-
</dt>
|
155
|
-
<dd><pre class="code"><span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>RuntimeError</span><span class='rparen'>)</span></pre></dd>
|
156
|
-
|
157
|
-
<dt id="TagArray-constant" class="">TagArray =
|
158
|
-
|
159
|
-
</dt>
|
160
|
-
<dd><pre class="code"><span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></span><span class='rparen'>)</span></pre></dd>
|
161
|
-
|
162
|
-
<dt id="DateBeginString-constant" class="">DateBeginString =
|
163
|
-
|
164
|
-
</dt>
|
165
|
-
<dd><pre class="code"><span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>DateTime</span><span class='rparen'>)</span></pre></dd>
|
166
|
-
|
167
|
-
<dt id="DateEndString-constant" class="">DateEndString =
|
168
|
-
|
169
|
-
</dt>
|
170
|
-
<dd><pre class="code"><span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>DateTime</span><span class='rparen'>)</span></pre></dd>
|
171
|
-
|
172
|
-
<dt id="DateRangeString-constant" class="">DateRangeString =
|
173
|
-
|
174
|
-
</dt>
|
175
|
-
<dd><pre class="code"><span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Array.html" title="Array (class)">Array</a></span></span><span class='rparen'>)</span></pre></dd>
|
176
|
-
|
177
|
-
<dt id="DateIntervalString-constant" class="">DateIntervalString =
|
178
|
-
|
179
|
-
</dt>
|
180
|
-
<dd><pre class="code"><span class='const'>Class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>DateTime</span><span class='rparen'>)</span></pre></dd>
|
181
|
-
|
182
|
-
</dl>
|
183
|
-
|
184
|
-
|
185
94
|
|
186
95
|
|
187
96
|
|
@@ -193,7 +102,7 @@
|
|
193
102
|
</div>
|
194
103
|
|
195
104
|
<div id="footer">
|
196
|
-
Generated on
|
105
|
+
Generated on Fri Jan 21 14:53:33 2022 by
|
197
106
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
198
107
|
0.9.27 (ruby-3.0.1).
|
199
108
|
</div>
|
data/doing.rdoc
CHANGED
@@ -5,7 +5,7 @@ record of what you've been doing, complete with tag-based time tracking. The
|
|
5
5
|
command line tool allows you to add entries, annotate with tags and notes, and
|
6
6
|
view your entries with myriad options, with a focus on a "natural" language syntax.
|
7
7
|
|
8
|
-
v2.1.
|
8
|
+
v2.1.22
|
9
9
|
|
10
10
|
=== Global Options
|
11
11
|
=== --config_file arg
|
@@ -32,7 +32,7 @@ Verbose output
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
-
=== --
|
35
|
+
=== --default
|
36
36
|
Answer yes/no menus with default option
|
37
37
|
|
38
38
|
|
@@ -528,7 +528,7 @@ Update default config file, adding any missing keys
|
|
528
528
|
|
529
529
|
|
530
530
|
[Default Command] edit
|
531
|
-
==== Command: <tt>done|did ENTRY</tt>
|
531
|
+
==== Command: <tt>done|did [ENTRY]</tt>
|
532
532
|
Add a completed item with @done(date). No argument finishes last entry
|
533
533
|
|
534
534
|
Use this command to add an entry after you've already finished it. It will be immediately marked as @done.
|
@@ -612,7 +612,7 @@ Finish last entry not already marked @done
|
|
612
612
|
|
613
613
|
|
614
614
|
|
615
|
-
==== Command: <tt>finish COUNT</tt>
|
615
|
+
==== Command: <tt>finish [COUNT]</tt>
|
616
616
|
Mark last X entries as @done
|
617
617
|
|
618
618
|
Marks the last X entries with a @done tag and current date. Does not alter already completed entries.
|
@@ -1165,7 +1165,7 @@ Force exact search string matching (case sensitive)
|
|
1165
1165
|
|
1166
1166
|
|
1167
1167
|
|
1168
|
-
==== Command: <tt>meanwhile ENTRY</tt>
|
1168
|
+
==== Command: <tt>meanwhile [ENTRY]</tt>
|
1169
1169
|
Finish any running @meanwhile tasks and optionally create a new one
|
1170
1170
|
|
1171
1171
|
The @meanwhile tag allows you to have long-running entries that encompass smaller entries.
|
@@ -1209,7 +1209,7 @@ Edit entry with vim
|
|
1209
1209
|
|
1210
1210
|
|
1211
1211
|
|
1212
|
-
==== Command: <tt>note NOTE_TEXT</tt>
|
1212
|
+
==== Command: <tt>note [NOTE_TEXT]</tt>
|
1213
1213
|
Add a note to the last entry
|
1214
1214
|
|
1215
1215
|
If -r is provided with no other arguments, the last note is removed.
|
@@ -1473,7 +1473,7 @@ Show intervals with totals at the end of output
|
|
1473
1473
|
|
1474
1474
|
|
1475
1475
|
|
1476
|
-
==== Command: <tt>reset|begin DATE_STRING</tt>
|
1476
|
+
==== Command: <tt>reset|begin [DATE_STRING]</tt>
|
1477
1477
|
Reset the start time of an entry
|
1478
1478
|
|
1479
1479
|
Update the start time of the last entry or the last entry matching a tag/search filter.
|
@@ -1530,6 +1530,11 @@ Select from a menu of matching entries
|
|
1530
1530
|
|
1531
1531
|
|
1532
1532
|
|
1533
|
+
===== -n
|
1534
|
+
Change start date but do not remove @done (shortcut for --no-resume)
|
1535
|
+
|
1536
|
+
|
1537
|
+
|
1533
1538
|
===== --not
|
1534
1539
|
Reset items that *don't* match search/tag filters
|
1535
1540
|
|
data/lib/doing/array.rb
CHANGED
@@ -11,17 +11,18 @@ module Doing
|
|
11
11
|
## @return [Array] array of strings
|
12
12
|
##
|
13
13
|
def tags_to_array
|
14
|
-
map
|
14
|
+
map(&:remove_at)
|
15
15
|
end
|
16
16
|
|
17
17
|
# Convert strings to @tags
|
18
18
|
#
|
19
|
-
# @example `['one', '@two', 'three'].to_tags`
|
20
|
-
# @example `=> ['@one', '@two', '@three']`
|
21
19
|
# @return [Array] Array of @tags
|
22
20
|
#
|
21
|
+
# @example
|
22
|
+
# ['one', '@two', 'three'].to_tags
|
23
|
+
# # => ['@one', '@two', '@three']
|
23
24
|
def to_tags
|
24
|
-
map
|
25
|
+
map(&:add_at)
|
25
26
|
end
|
26
27
|
|
27
28
|
def to_tags!
|
data/lib/doing/array_chronify.rb
CHANGED
@@ -6,9 +6,10 @@ module Doing
|
|
6
6
|
##
|
7
7
|
## Format [d, h, m] as string
|
8
8
|
##
|
9
|
-
## @
|
10
|
-
##
|
11
|
-
## @param format [Symbol] The format, :dhm, :hm,
|
9
|
+
## @accept [Array] Array of [days, hours, minutes]
|
10
|
+
##
|
11
|
+
## @param format [Symbol] The format, :dhm, :hm,
|
12
|
+
## :m, :clock, :natural
|
12
13
|
## @return [String] formatted string
|
13
14
|
##
|
14
15
|
def time_string(format: :dhm)
|
data/lib/doing/configuration.rb
CHANGED
@@ -160,7 +160,7 @@ module Doing
|
|
160
160
|
def choose_config(create: false)
|
161
161
|
return @config_file if @force_answer
|
162
162
|
|
163
|
-
if @additional_configs
|
163
|
+
if @additional_configs&.count&.positive? || create
|
164
164
|
choices = [@config_file].concat(@additional_configs)
|
165
165
|
choices.push('Create a new .doingrc in the current directory') if create && !File.exist?('.doingrc')
|
166
166
|
res = Doing::Prompt.choose_from(choices.uniq.sort.reverse,
|
data/lib/doing/hash.rb
CHANGED
@@ -6,14 +6,32 @@ module Doing
|
|
6
6
|
##
|
7
7
|
## Freeze all values in a hash
|
8
8
|
##
|
9
|
-
## @return
|
9
|
+
## @return Hash with all values frozen
|
10
10
|
##
|
11
11
|
def deep_freeze
|
12
|
-
|
12
|
+
chilled = {}
|
13
|
+
each do |k, v|
|
14
|
+
chilled[k] = v.is_a?(Hash) ? v.deep_freeze : v.freeze
|
15
|
+
end
|
16
|
+
|
17
|
+
chilled.freeze
|
13
18
|
end
|
14
19
|
|
15
20
|
def deep_freeze!
|
16
|
-
replace deep_freeze
|
21
|
+
replace deep_thaw.deep_freeze
|
22
|
+
end
|
23
|
+
|
24
|
+
def deep_thaw
|
25
|
+
chilled = {}
|
26
|
+
each do |k, v|
|
27
|
+
chilled[k] = v.is_a?(Hash) ? v.deep_thaw : v.dup
|
28
|
+
end
|
29
|
+
|
30
|
+
chilled.dup
|
31
|
+
end
|
32
|
+
|
33
|
+
def deep_thaw!
|
34
|
+
replace deep_thaw
|
17
35
|
end
|
18
36
|
|
19
37
|
# Turn all keys into string
|
data/lib/doing/item.rb
CHANGED
data/lib/doing/log_adapter.rb
CHANGED
@@ -356,7 +356,7 @@ module Doing
|
|
356
356
|
next if data[:count].zero?
|
357
357
|
|
358
358
|
count = data[:count]
|
359
|
-
tags = data[:tag] ? data[:tag].uniq.map { |t|
|
359
|
+
tags = data[:tag] ? data[:tag].uniq.map { |t| t.add_at.cyan }.join(', ') : 'tags'
|
360
360
|
topic, m = format_counter(key, data)
|
361
361
|
message = m.dup
|
362
362
|
message.sub!(/%count/, count.to_s)
|
data/lib/doing/pager.rb
CHANGED
@@ -49,6 +49,8 @@ module Doing
|
|
49
49
|
note = []
|
50
50
|
end
|
51
51
|
|
52
|
+
placeholders['tags'] = item.tags
|
53
|
+
|
52
54
|
placeholders['date'] = item.date.strftime(opt[:format])
|
53
55
|
|
54
56
|
interval = wwid.get_interval(item, record: true, formatted: false) if opt[:times]
|
@@ -56,8 +58,10 @@ module Doing
|
|
56
58
|
interval = case opt[:interval_format].to_sym
|
57
59
|
when :human
|
58
60
|
interval.time_string(format: :hm)
|
59
|
-
|
61
|
+
when :text
|
60
62
|
interval.time_string(format: :clock)
|
63
|
+
else
|
64
|
+
interval.time_string(format: opt[:interval_format].to_sym)
|
61
65
|
end
|
62
66
|
end
|
63
67
|
|
@@ -69,8 +73,10 @@ module Doing
|
|
69
73
|
duration = case opt[:interval_format].to_sym
|
70
74
|
when :human
|
71
75
|
duration.time_string(format: :hm)
|
72
|
-
|
76
|
+
when :text
|
73
77
|
duration.time_string(format: :clock)
|
78
|
+
else
|
79
|
+
duration.time_string(format: opt[:interval_format].to_sym)
|
74
80
|
end
|
75
81
|
end
|
76
82
|
duration ||= ''
|
data/lib/doing/prompt.rb
CHANGED
@@ -42,7 +42,7 @@ module Doing
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
def read_lines(prompt: 'Enter text', completions: [])
|
45
|
+
def read_lines(prompt: 'Enter text', completions: [], default_response: '')
|
46
46
|
$stdin.reopen('/dev/tty')
|
47
47
|
return default_response if @default_answer
|
48
48
|
|
@@ -72,8 +72,10 @@ module Doing
|
|
72
72
|
res.join("\n").strip
|
73
73
|
end
|
74
74
|
|
75
|
-
def request_lines(prompt: 'Enter text')
|
75
|
+
def request_lines(prompt: 'Enter text', default_response: '')
|
76
76
|
$stdin.reopen('/dev/tty')
|
77
|
+
return default_response if @default_answer
|
78
|
+
|
77
79
|
ask_note = []
|
78
80
|
reader = TTY::Reader.new(interrupt: -> { raise Errors::UserCancelled }, track_history: false)
|
79
81
|
puts "#{boldgreen(prompt.sub(/:?$/, ':'))} #{yellow('Hit return for a new line, ')}#{boldwhite('enter a blank line (')}#{boldyellow('return twice')}#{boldwhite(') to end editing')}"
|
data/lib/doing/string.rb
CHANGED
@@ -458,7 +458,16 @@ module Doing
|
|
458
458
|
## @return [String] @string
|
459
459
|
##
|
460
460
|
def add_at
|
461
|
-
strip.sub(/^([+-]*)
|
461
|
+
strip.sub(/^([+-]*)@?/, '\1@')
|
462
|
+
end
|
463
|
+
|
464
|
+
##
|
465
|
+
## Removes @ prefix if needed, maintains +/- prefix
|
466
|
+
##
|
467
|
+
## @return [String] string without @ prefix
|
468
|
+
##
|
469
|
+
def remove_at
|
470
|
+
strip.sub(/^([+-]*)@?/, '\1')
|
462
471
|
end
|
463
472
|
|
464
473
|
##
|
@@ -146,6 +146,13 @@ module Doing
|
|
146
146
|
end
|
147
147
|
indent ||= placeholder =~ /^title/ ? '' : "\t"
|
148
148
|
prefix = m['prefix']
|
149
|
+
|
150
|
+
if placeholder =~ /^tags/
|
151
|
+
prefix ||= ''
|
152
|
+
value = value.map { |t| "#{prefix}#{t.sub(/^#{prefix}?/, '')}" }.join(' ')
|
153
|
+
prefix = ''
|
154
|
+
end
|
155
|
+
|
149
156
|
if placeholder =~ /^title/
|
150
157
|
color = last_color + color
|
151
158
|
|
data/lib/doing/types.rb
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
module Doing
|
4
|
+
module Types
|
5
|
+
REGEX_BOOL = /^(?:and|all|any|or|not|none|p(?:at(?:tern)?)?)$/i.freeze
|
6
|
+
REGEX_SORT_ORDER = /^(?:a(?:sc)?|d(?:esc)?)$/i.freeze
|
7
|
+
REGEX_VALUE_QUERY = /^(?:!)?@?(?:\S+) +(?:!?[<>=][=*]?|[$*^]=) +(?:.*?)$/.freeze
|
8
|
+
REGEX_CLOCK = '(?:\d{1,2}+(?::\d{1,2}+)?(?: *(?:am|pm))?|midnight|noon)'
|
9
|
+
REGEX_TIME = /^#{REGEX_CLOCK}$/i.freeze
|
10
|
+
REGEX_DAY = /^(mon|tue|wed|thur?|fri|sat|sun)(\w+(day)?)?$/i.freeze
|
11
|
+
REGEX_RANGE_INDICATOR = ' +(?:to|through|thru|(?:un)?til|-+) +'
|
12
|
+
REGEX_RANGE = /^\S+#{REGEX_RANGE_INDICATOR}+\S+/i.freeze
|
13
|
+
REGEX_TIME_RANGE = /^#{REGEX_CLOCK}#{REGEX_RANGE_INDICATOR}#{REGEX_CLOCK}$/i.freeze
|
12
14
|
|
13
|
-
InvalidExportType = Class.new(RuntimeError)
|
14
|
-
MissingConfigFile = Class.new(RuntimeError)
|
15
|
-
TagArray = Class.new(Array)
|
16
|
-
DateBeginString = Class.new(DateTime)
|
17
|
-
DateEndString = Class.new(DateTime)
|
18
|
-
DateRangeString = Class.new(Array)
|
19
|
-
DateIntervalString = Class.new(DateTime)
|
15
|
+
InvalidExportType = Class.new(RuntimeError)
|
16
|
+
MissingConfigFile = Class.new(RuntimeError)
|
17
|
+
TagArray = Class.new(Array)
|
18
|
+
DateBeginString = Class.new(DateTime)
|
19
|
+
DateEndString = Class.new(DateTime)
|
20
|
+
DateRangeString = Class.new(Array)
|
21
|
+
DateIntervalString = Class.new(DateTime)
|
22
|
+
end
|
23
|
+
end
|
data/lib/doing/version.rb
CHANGED
data/lib/doing/wwid.rb
CHANGED
@@ -657,14 +657,8 @@ module Doing
|
|
657
657
|
opt[:time_filter] = [nil, nil]
|
658
658
|
if opt[:from] && !opt[:date_filter]
|
659
659
|
if opt[:from][0].is_a?(String) && opt[:from][0] =~ time_rx
|
660
|
-
|
661
|
-
elsif opt[:from].is_a?(Time)
|
662
|
-
start, finish = opt[:from]
|
663
|
-
end
|
664
|
-
|
665
|
-
if time_start
|
666
|
-
opt[:time_filter] = [time_start, time_end]
|
667
|
-
else
|
660
|
+
opt[:time_filter] = opt[:from]
|
661
|
+
elsif opt[:from][0].is_a?(Time)
|
668
662
|
opt[:date_filter] = opt[:from]
|
669
663
|
end
|
670
664
|
end
|
@@ -1622,6 +1616,7 @@ module Doing
|
|
1622
1616
|
'duration' => @config['duration'],
|
1623
1617
|
'interval_format' => @config['interval_format']
|
1624
1618
|
}, { extend_existing_arrays: true, sort_merged_arrays: true })
|
1619
|
+
|
1625
1620
|
opt[:duration] ||= cfg['duration'] || false
|
1626
1621
|
opt[:interval_format] ||= cfg['interval_format'] || 'text'
|
1627
1622
|
opt[:count] ||= 0
|
@@ -2307,7 +2302,6 @@ EOS
|
|
2307
2302
|
|
2308
2303
|
section_items = @content.in_section(section)
|
2309
2304
|
max = section_items.count - count.to_i
|
2310
|
-
moved_items = []
|
2311
2305
|
|
2312
2306
|
counter = 0
|
2313
2307
|
|
data/lib/doing.rb
CHANGED
@@ -58,10 +58,10 @@ end
|
|
58
58
|
class ThreadedTests
|
59
59
|
include Doing::Color
|
60
60
|
|
61
|
-
def run(pattern: '*', max_threads:
|
61
|
+
def run(pattern: '*', max_threads: 8, max_tests: 0)
|
62
62
|
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
63
63
|
|
64
|
-
max_threads =
|
64
|
+
max_threads = 1000 if max_threads == 0
|
65
65
|
|
66
66
|
c = Doing::Color
|
67
67
|
c.coloring = true
|
@@ -91,11 +91,12 @@ class ThreadedTests
|
|
91
91
|
progress = TTY::ProgressBar::Multi.new(banner,
|
92
92
|
width: 12,
|
93
93
|
hide_cursor: true)
|
94
|
-
children = []
|
94
|
+
@children = []
|
95
95
|
tests.each do |t|
|
96
96
|
test_name = File.basename(t, '.rb').sub(/doing_(.*?)_test/, '\1')
|
97
|
-
new_sp = progress.register("[#{':bar'.cyan}] #{test_name.bold.white}:status",
|
98
|
-
|
97
|
+
new_sp = progress.register("[#{':bar'.cyan}] #{test_name.bold.white}:status",
|
98
|
+
total: 2, width: 1, head: '.', hide_cursor: true, clear: true)
|
99
|
+
@children.push([test_name, new_sp, nil])
|
99
100
|
end
|
100
101
|
|
101
102
|
@elapsed = 0.0
|
@@ -103,57 +104,20 @@ class ThreadedTests
|
|
103
104
|
@assrt_total = 0
|
104
105
|
@error_out = []
|
105
106
|
# progress.start
|
107
|
+
@threads = []
|
106
108
|
|
107
109
|
begin
|
108
|
-
while children.count.positive?
|
109
|
-
|
110
|
-
slices = children.slice!(0, max_threads)
|
110
|
+
while @children.count.positive?
|
111
|
+
|
112
|
+
slices = @children.slice!(0, max_threads)
|
111
113
|
slices.each { |c| c[1].start }
|
112
114
|
slices.each do |s|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
threads << Thread.new do
|
117
|
-
out, _err, status = Open3.capture3(ENV, 'rake', "test:#{s[0]}", stdin_data: nil)
|
118
|
-
unless status.success?
|
119
|
-
m = out.match(/(?<fail>\d+) failures, (?<err>\d+) errors/)
|
120
|
-
status = ": #{m['fail'].bold.red} #{'failures'.red}, #{m['err'].bold.red} #{'errors'.red}"
|
121
|
-
bar.update(head: '✖'.boldred)
|
122
|
-
bar.advance(head: '✖'.boldred, status: status)
|
123
|
-
|
124
|
-
# errs = out.scan(/(?:Failure|Error): [\w_]+\((?:.*?)\):(?:.*?)(?=\n=======)/m)
|
125
|
-
@error_out.push(out.highlight_errors)
|
126
|
-
bar.finish
|
127
|
-
|
128
|
-
Thread.exit
|
129
|
-
end
|
130
|
-
|
131
|
-
time = out.match(/^Finished in (?<time>\d+\.\d+) seconds\./)
|
132
|
-
count = out.match(/^(?<tests>\d+) tests, (?<assrt>\d+) assertions, (?<fails>\d+) failures, (?<errs>\d+) errors/)
|
133
|
-
status = [
|
134
|
-
': ',
|
135
|
-
count['tests'].green,
|
136
|
-
'/',
|
137
|
-
count['assrt'].cyan,
|
138
|
-
# ' (',
|
139
|
-
# count['fails'].to_i == 0 ? '-'.dark.white.reset : count['fails'].bold.red,
|
140
|
-
# '/',
|
141
|
-
# count['errs'].to_i == 0 ? '-'.dark.white.reset : count['errs'].bold.red,
|
142
|
-
# ') ',
|
143
|
-
' ',
|
144
|
-
time['time'].to_f.round(3).to_s.yellow,
|
145
|
-
's'
|
146
|
-
].join('')
|
147
|
-
bar.update(head: '✔'.boldgreen)
|
148
|
-
bar.advance(head: '✔'.boldgreen, status: status)
|
149
|
-
@test_total += count['tests'].to_i
|
150
|
-
@assrt_total += count['assrt'].to_i
|
151
|
-
@elapsed += time['time'].to_f
|
152
|
-
|
153
|
-
bar.finish
|
115
|
+
@threads << Thread.new do
|
116
|
+
run_test(s)
|
154
117
|
end
|
155
118
|
end
|
156
|
-
|
119
|
+
|
120
|
+
@threads.each { |t| t.join }
|
157
121
|
end
|
158
122
|
|
159
123
|
finish_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
@@ -176,6 +140,65 @@ class ThreadedTests
|
|
176
140
|
progress.stop
|
177
141
|
end
|
178
142
|
end
|
143
|
+
|
144
|
+
def run_test(s)
|
145
|
+
bar = s[1]
|
146
|
+
bar.advance(status: ": #{'running'.green}")
|
147
|
+
|
148
|
+
out, _err, status = Open3.capture3(ENV, 'rake', "test:#{s[0]}", stdin_data: nil)
|
149
|
+
unless status.success?
|
150
|
+
m = out.match(/(?<fail>\d+) failures, (?<err>\d+) errors/)
|
151
|
+
status = ": #{m['fail'].bold.red} #{'failures'.red}, #{m['err'].bold.red} #{'errors'.red}"
|
152
|
+
bar.update(head: '✖'.boldred)
|
153
|
+
bar.advance(head: '✖'.boldred, status: status)
|
154
|
+
|
155
|
+
# errs = out.scan(/(?:Failure|Error): [\w_]+\((?:.*?)\):(?:.*?)(?=\n=======)/m)
|
156
|
+
@error_out.push(out.highlight_errors)
|
157
|
+
bar.finish
|
158
|
+
|
159
|
+
next_test
|
160
|
+
Thread.exit
|
161
|
+
end
|
162
|
+
|
163
|
+
time = out.match(/^Finished in (?<time>\d+\.\d+) seconds\./)
|
164
|
+
count = out.match(/^(?<tests>\d+) tests, (?<assrt>\d+) assertions, (?<fails>\d+) failures, (?<errs>\d+) errors/)
|
165
|
+
status = [
|
166
|
+
': ',
|
167
|
+
count['tests'].green,
|
168
|
+
'/',
|
169
|
+
count['assrt'].cyan,
|
170
|
+
# ' (',
|
171
|
+
# count['fails'].to_i == 0 ? '-'.dark.white.reset : count['fails'].bold.red,
|
172
|
+
# '/',
|
173
|
+
# count['errs'].to_i == 0 ? '-'.dark.white.reset : count['errs'].bold.red,
|
174
|
+
# ') ',
|
175
|
+
' ',
|
176
|
+
time['time'].to_f.round(3).to_s.yellow,
|
177
|
+
's'
|
178
|
+
].join('')
|
179
|
+
bar.update(head: '✔'.boldgreen)
|
180
|
+
bar.advance(head: '✔'.boldgreen, status: status)
|
181
|
+
@test_total += count['tests'].to_i
|
182
|
+
@assrt_total += count['assrt'].to_i
|
183
|
+
@elapsed += time['time'].to_f
|
184
|
+
|
185
|
+
bar.finish
|
186
|
+
|
187
|
+
next_test
|
188
|
+
end
|
189
|
+
|
190
|
+
def next_test
|
191
|
+
if @children.count.positive?
|
192
|
+
t = Thread.new do
|
193
|
+
s = @children.shift
|
194
|
+
# s[1].start
|
195
|
+
# s[1].advance(status: ": #{'running'.green}")
|
196
|
+
run_test(s)
|
197
|
+
end
|
198
|
+
|
199
|
+
t.join
|
200
|
+
end
|
201
|
+
end
|
179
202
|
end
|
180
203
|
|
181
204
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: safe_yaml
|