doing 2.1.2pre → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.yardoc/checksums +5 -5
  3. data/.yardoc/object_types +0 -0
  4. data/.yardoc/objects/root.dat +0 -0
  5. data/CHANGELOG.md +16 -27
  6. data/Gemfile.lock +1 -1
  7. data/README.md +1 -1
  8. data/Rakefile +2 -0
  9. data/doc/Array.html +1 -1
  10. data/doc/Doing/Color.html +1 -1
  11. data/doc/Doing/Completion.html +1 -1
  12. data/doc/Doing/Configuration.html +43 -94
  13. data/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  14. data/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  15. data/doc/Doing/Errors/DoingStandardError.html +1 -1
  16. data/doc/Doing/Errors/EmptyInput.html +1 -1
  17. data/doc/Doing/Errors/NoResults.html +1 -1
  18. data/doc/Doing/Errors/PluginException.html +1 -1
  19. data/doc/Doing/Errors/UserCancelled.html +1 -1
  20. data/doc/Doing/Errors/WrongCommand.html +1 -1
  21. data/doc/Doing/Errors.html +1 -1
  22. data/doc/Doing/Hooks.html +1 -1
  23. data/doc/Doing/Item.html +2 -17
  24. data/doc/Doing/Items.html +1 -1
  25. data/doc/Doing/LogAdapter.html +1 -1
  26. data/doc/Doing/Note.html +1 -1
  27. data/doc/Doing/Pager.html +1 -1
  28. data/doc/Doing/Plugins.html +1 -1
  29. data/doc/Doing/Prompt.html +36 -18
  30. data/doc/Doing/Section.html +1 -1
  31. data/doc/Doing/Util.html +1 -1
  32. data/doc/Doing/WWID.html +1 -1
  33. data/doc/Doing.html +2 -2
  34. data/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  35. data/doc/GLI/Commands.html +1 -1
  36. data/doc/GLI.html +1 -1
  37. data/doc/Hash.html +1 -1
  38. data/doc/Status.html +1 -1
  39. data/doc/String.html +35 -1
  40. data/doc/Symbol.html +1 -1
  41. data/doc/Time.html +1 -1
  42. data/doc/_index.html +1 -1
  43. data/doc/file.README.html +2 -2
  44. data/doc/index.html +2 -2
  45. data/doc/method_list.html +238 -238
  46. data/doc/top-level-namespace.html +1 -1
  47. data/doing.rdoc +1 -1
  48. data/lib/doing/configuration.rb +5 -8
  49. data/lib/doing/item.rb +1 -1
  50. data/lib/doing/plugins/export/template_export.rb +4 -1
  51. data/lib/doing/prompt.rb +9 -9
  52. data/lib/doing/string.rb +31 -1
  53. data/lib/doing/version.rb +1 -1
  54. metadata +4 -4
@@ -102,7 +102,7 @@
102
102
  </div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Sun Nov 28 05:27:33 2021 by
105
+ Generated on Thu Dec 16 11:02:39 2021 by
106
106
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
107
  0.9.26 (ruby-3.0.1).
108
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.2pre
8
+ v2.1.3
9
9
 
10
10
  === Global Options
11
11
  === --config_file arg
@@ -7,7 +7,7 @@ module Doing
7
7
  class Configuration
8
8
  attr_reader :settings
9
9
 
10
- attr_writer :ignore_local
10
+ attr_writer :ignore_local, :config_file
11
11
 
12
12
  MissingConfigFile = Class.new(RuntimeError)
13
13
 
@@ -100,24 +100,21 @@ module Doing
100
100
  @config_file ||= default_config_file
101
101
  end
102
102
 
103
- def config_file=(file)
104
- @config_file = file
105
- end
106
-
107
103
  def config_dir
108
104
  @config_dir ||= File.join(Util.user_home, '.config', 'doing')
109
- # @config_dir ||= Util.user_home
110
105
  end
111
106
 
112
107
  def default_config_file
113
- raise DoingRuntimeError, "#{config_dir} exists but is not a directory" if File.exist?(config_dir) && !File.directory?(config_dir)
108
+ if File.exist?(config_dir) && !File.directory?(config_dir)
109
+ raise DoingRuntimeError, "#{config_dir} exists but is not a directory"
110
+
111
+ end
114
112
 
115
113
  unless File.exist?(config_dir)
116
114
  FileUtils.mkdir_p(config_dir)
117
115
  Doing.logger.log_now(:warn, "Config directory created at #{config_dir}")
118
116
  end
119
117
 
120
- # File.join(config_dir, 'config.yml')
121
118
  File.join(config_dir, 'config.yml')
122
119
  end
123
120
 
data/lib/doing/item.rb CHANGED
@@ -116,7 +116,7 @@ module Doing
116
116
  ## Add (or remove) tags from the title of the item
117
117
  ##
118
118
  ## @param tags [Array] The tags to apply
119
- ## @param **options Additional options
119
+ ## @param options Additional options
120
120
  ##
121
121
  ## @option options :date [Boolean] Include timestamp?
122
122
  ## @option options :single [Boolean] Log as a single change?
@@ -36,7 +36,10 @@ module Doing
36
36
 
37
37
  if opt[:wrap_width]&.positive?
38
38
  width = opt[:wrap_width]
39
- note.map! { |line| line.chomp.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n") }
39
+ note.map! do |line|
40
+ line.simple_wrap(width)
41
+ # line.chomp.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
42
+ end
40
43
  note = note.join("\n").split(/\n/).delete_if(&:empty?)
41
44
  end
42
45
  else
data/lib/doing/prompt.rb CHANGED
@@ -127,16 +127,16 @@ module Doing
127
127
  ## Create an interactive menu to select from a set of Items
128
128
  ##
129
129
  ## @param items [Array] list of items
130
- ## @param opt [Hash] options
131
- ## @param include_section [Boolean] include section
130
+ ## @param opt Additional options
132
131
  ##
133
- ## @option opt [String] :header
134
- ## @option opt [String] :prompt
135
- ## @option opt [String] :query
136
- ## @option opt [Boolean] :show_if_single
137
- ## @option opt [Boolean] :menu
138
- ## @option opt [Boolean] :sort
139
- ## @option opt [Boolean] :multiple
132
+ ## @option opt [Boolean] :include_section Include section name for each item in menu
133
+ ## @option opt [String] :header A custom header string
134
+ ## @option opt [String] :prompt A custom prompt string
135
+ ## @option opt [String] :query Initial query
136
+ ## @option opt [Boolean] :show_if_single Show menu even if there's only one option
137
+ ## @option opt [Boolean] :menu Show menu
138
+ ## @option opt [Boolean] :sort Sort options
139
+ ## @option opt [Boolean] :multiple Allow multiple selections
140
140
  ## @option opt [Symbol] :case (:sensitive, :ignore, :smart)
141
141
  ##
142
142
  def choose_from_items(items, **opt)
data/lib/doing/string.rb CHANGED
@@ -162,6 +162,29 @@ module Doing
162
162
  replace uncolor
163
163
  end
164
164
 
165
+ def simple_wrap(width)
166
+ str = gsub(/@\S+\(.*?\)/) { |tag| tag.gsub(/\s/, '%%%%') }
167
+ words = str.split(/ /).map { |word| word.gsub(/%%%%/, ' ') }
168
+ out = []
169
+ line = []
170
+
171
+ words.each do |word|
172
+ if word.uncolor.length >= width
173
+ chars = word.uncolor.split('')
174
+ out << chars.slice!(0, width - 1).join('') while chars.count >= width
175
+ line << chars.join('')
176
+ next
177
+ elsif line.join(' ').uncolor.length + word.uncolor.length + 1 > width
178
+ out.push(line.join(' '))
179
+ line.clear
180
+ end
181
+
182
+ line << word.uncolor
183
+ end
184
+ out.push(line.join(' '))
185
+ out.join("\n")
186
+ end
187
+
165
188
  ##
166
189
  ## Wrap string at word breaks, respecting tags
167
190
  ##
@@ -177,8 +200,14 @@ module Doing
177
200
  words = str.split(/ /).map { |word| word.gsub(/%%%%/, ' ') }
178
201
  out = []
179
202
  line = []
203
+
180
204
  words.each do |word|
181
- if line.join(' ').uncolor.length + word.uncolor.length + 1 > len
205
+ if word.uncolor.length >= len
206
+ chars = word.uncolor.split('')
207
+ out << chars.slice!(0, len - 1).join('') while chars.count >= len
208
+ line << chars.join('')
209
+ next
210
+ elsif line.join(' ').uncolor.length + word.uncolor.length + 1 > len
182
211
  out.push(line.join(' '))
183
212
  line.clear
184
213
  end
@@ -187,6 +216,7 @@ module Doing
187
216
  end
188
217
  out.push(line.join(' '))
189
218
  note = ''
219
+ after = after.dup if after.frozen?
190
220
  after.sub!(note_rx) do
191
221
  note = Regexp.last_match(0)
192
222
  ''
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '2.1.2pre'
2
+ VERSION = '2.1.3'
3
3
  end
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.2pre
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-28 00:00:00.000000000 Z
11
+ date: 2021-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: safe_yaml
@@ -581,9 +581,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
581
581
  version: '0'
582
582
  required_rubygems_version: !ruby/object:Gem::Requirement
583
583
  requirements:
584
- - - ">"
584
+ - - ">="
585
585
  - !ruby/object:Gem::Version
586
- version: 1.3.1
586
+ version: '0'
587
587
  requirements: []
588
588
  rubygems_version: 3.2.16
589
589
  signing_key: