doing 2.1.22 → 2.1.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/.yardoc/checksums +17 -14
  3. data/.yardoc/object_types +0 -0
  4. data/.yardoc/objects/root.dat +0 -0
  5. data/CHANGELOG.md +323 -111
  6. data/Gemfile.lock +1 -1
  7. data/README.md +1 -1
  8. data/Rakefile +2 -1
  9. data/bin/commands/add_section.rb +13 -0
  10. data/bin/commands/again.rb +99 -0
  11. data/bin/commands/archive.rb +96 -0
  12. data/bin/commands/cancel.rb +102 -0
  13. data/bin/commands/changes.rb +42 -0
  14. data/bin/commands/choose.rb +9 -0
  15. data/bin/commands/colors.rb +19 -0
  16. data/bin/commands/commands.rb +87 -0
  17. data/bin/commands/commands_accepting.rb +25 -0
  18. data/bin/commands/completion.rb +24 -0
  19. data/bin/commands/config.rb +245 -0
  20. data/bin/commands/done.rb +249 -0
  21. data/bin/commands/finish.rb +149 -0
  22. data/bin/commands/flag.rb +126 -0
  23. data/bin/commands/grep.rb +124 -0
  24. data/bin/commands/import.rb +101 -0
  25. data/bin/commands/install_fzf.rb +17 -0
  26. data/bin/commands/last.rb +114 -0
  27. data/bin/commands/meanwhile.rb +86 -0
  28. data/bin/commands/note.rb +130 -0
  29. data/bin/commands/now.rb +151 -0
  30. data/bin/commands/on.rb +66 -0
  31. data/bin/commands/open.rb +53 -0
  32. data/bin/commands/plugins.rb +23 -0
  33. data/bin/commands/recent.rb +78 -0
  34. data/bin/commands/redo.rb +22 -0
  35. data/bin/commands/reset.rb +106 -0
  36. data/bin/commands/rotate.rb +73 -0
  37. data/bin/commands/sections.rb +11 -0
  38. data/bin/commands/select.rb +123 -0
  39. data/bin/commands/show.rb +231 -0
  40. data/bin/commands/since.rb +64 -0
  41. data/bin/commands/tag.rb +179 -0
  42. data/bin/commands/tag_dir.rb +29 -0
  43. data/bin/commands/tags.rb +93 -0
  44. data/bin/commands/template.rb +61 -0
  45. data/bin/commands/today.rb +65 -0
  46. data/bin/commands/undo.rb +49 -0
  47. data/bin/commands/view.rb +238 -0
  48. data/bin/commands/views.rb +11 -0
  49. data/bin/commands/yesterday.rb +73 -0
  50. data/bin/doing +54 -3505
  51. data/docs/doc/Array.html +79 -11
  52. data/docs/doc/BooleanTermParser/Clause.html +5 -5
  53. data/docs/doc/BooleanTermParser/Operator.html +4 -4
  54. data/docs/doc/BooleanTermParser/Query.html +8 -8
  55. data/docs/doc/BooleanTermParser/QueryParser.html +2 -2
  56. data/docs/doc/BooleanTermParser/QueryTransformer.html +2 -2
  57. data/docs/doc/BooleanTermParser.html +1 -1
  58. data/docs/doc/Doing/Color.html +4 -4
  59. data/docs/doc/Doing/Completion.html +2 -2
  60. data/docs/doc/Doing/Configuration.html +17 -18
  61. data/docs/doc/Doing/Errors/DoingNoTraceError.html +2 -2
  62. data/docs/doc/Doing/Errors/DoingRuntimeError.html +2 -2
  63. data/docs/doc/Doing/Errors/DoingStandardError.html +2 -2
  64. data/docs/doc/Doing/Errors/EmptyInput.html +2 -2
  65. data/docs/doc/Doing/Errors/NoResults.html +2 -2
  66. data/docs/doc/Doing/Errors/PluginException.html +3 -3
  67. data/docs/doc/Doing/Errors/UserCancelled.html +2 -2
  68. data/docs/doc/Doing/Errors/WrongCommand.html +2 -2
  69. data/docs/doc/Doing/Errors.html +1 -1
  70. data/docs/doc/Doing/Hooks.html +6 -6
  71. data/docs/doc/Doing/Item.html +50 -16
  72. data/docs/doc/Doing/Items.html +10 -10
  73. data/docs/doc/Doing/LogAdapter.html +24 -24
  74. data/docs/doc/Doing/Note.html +7 -7
  75. data/docs/doc/Doing/Pager.html +4 -4
  76. data/docs/doc/Doing/Plugins.html +7 -7
  77. data/docs/doc/Doing/Prompt.html +59 -14
  78. data/docs/doc/Doing/Section.html +6 -6
  79. data/docs/doc/Doing/TemplateString.html +8 -8
  80. data/docs/doc/Doing/Types.html +206 -0
  81. data/docs/doc/Doing/Util/Backup.html +10 -10
  82. data/docs/doc/Doing/Util.html +16 -19
  83. data/docs/doc/Doing/WWID.html +65 -53
  84. data/docs/doc/Doing.html +3 -3
  85. data/docs/doc/FalseClass.html +201 -0
  86. data/docs/doc/GLI/Commands/Help.html +185 -0
  87. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +17 -17
  88. data/docs/doc/GLI/Commands.html +5 -3
  89. data/docs/doc/GLI.html +4 -2
  90. data/docs/doc/Hash.html +47 -21
  91. data/docs/doc/Numeric.html +5 -5
  92. data/docs/doc/Object.html +203 -0
  93. data/docs/doc/PhraseParser/Operator.html +4 -4
  94. data/docs/doc/PhraseParser/PhraseClause.html +5 -5
  95. data/docs/doc/PhraseParser/Query.html +10 -10
  96. data/docs/doc/PhraseParser/QueryParser.html +2 -2
  97. data/docs/doc/PhraseParser/QueryTransformer.html +2 -2
  98. data/docs/doc/PhraseParser/TermClause.html +5 -5
  99. data/docs/doc/PhraseParser.html +1 -1
  100. data/docs/doc/Status.html +7 -7
  101. data/docs/doc/String.html +144 -51
  102. data/docs/doc/Symbol.html +8 -8
  103. data/docs/doc/Time.html +6 -6
  104. data/docs/doc/TrueClass.html +201 -0
  105. data/docs/doc/_index.html +46 -16
  106. data/docs/doc/class_list.html +1 -1
  107. data/docs/doc/file.README.html +2 -2
  108. data/docs/doc/index.html +2 -2
  109. data/docs/doc/method_list.html +292 -212
  110. data/docs/doc/top-level-namespace.html +2 -2
  111. data/docs/index.md +1 -1
  112. data/doing.rdoc +178 -16
  113. data/example_plugin.rb +2 -2
  114. data/lib/completion/_doing.zsh +27 -27
  115. data/lib/completion/doing.bash +31 -20
  116. data/lib/completion/doing.fish +33 -11
  117. data/lib/doing/array.rb +2 -2
  118. data/lib/doing/changelog/change.rb +115 -0
  119. data/lib/doing/changelog/changes.rb +73 -0
  120. data/lib/doing/changelog/entry.rb +21 -0
  121. data/lib/doing/changelog/version.rb +97 -0
  122. data/lib/doing/changelog.rb +6 -0
  123. data/lib/doing/completion/fish_completion.rb +2 -1
  124. data/lib/doing/configuration.rb +20 -13
  125. data/lib/doing/good.rb +64 -0
  126. data/lib/doing/hash.rb +7 -2
  127. data/lib/doing/help_monkey_patch.rb +31 -0
  128. data/lib/doing/hooks.rb +8 -4
  129. data/lib/doing/item.rb +24 -35
  130. data/lib/doing/pager.rb +1 -0
  131. data/lib/doing/plugins/export/template_export.rb +1 -1
  132. data/lib/doing/plugins/import/calendar_import.rb +1 -1
  133. data/lib/doing/plugins/import/doing_import.rb +1 -1
  134. data/lib/doing/plugins/import/timing_import.rb +1 -1
  135. data/lib/doing/prompt.rb +8 -0
  136. data/lib/doing/string.rb +20 -11
  137. data/lib/doing/string_chronify.rb +1 -1
  138. data/lib/doing/template_string.rb +2 -2
  139. data/lib/doing/types.rb +3 -0
  140. data/lib/doing/util.rb +12 -11
  141. data/lib/doing/version.rb +1 -1
  142. data/lib/doing/wwid.rb +62 -37
  143. data/lib/doing.rb +2 -0
  144. data/lib/examples/commands/wiki.rb +6 -7
  145. data/lib/helpers/threaded_tests.rb +61 -71
  146. data/lib/helpers/threaded_tests_string.rb +50 -0
  147. metadata +56 -2
data/lib/doing/item.rb CHANGED
@@ -125,11 +125,11 @@ module Doing
125
125
  return true if same_time?(item_b)
126
126
 
127
127
  start_a = date
128
- interval = interval
129
- end_a = interval ? start_a + interval.to_i : start_a
128
+ a_interval = interval
129
+ end_a = a_interval ? start_a + a_interval.to_i : start_a
130
130
  start_b = item_b.date
131
- interval = item_b.interval
132
- end_b = interval ? start_b + interval.to_i : start_b
131
+ b_interval = item_b.interval
132
+ end_b = b_interval ? start_b + b_interval.to_i : start_b
133
133
  (start_a >= start_b && start_a <= end_b) || (end_a >= start_b && end_a <= end_b) || (start_a < start_b && end_a > end_b)
134
134
  end
135
135
 
@@ -216,8 +216,8 @@ module Doing
216
216
  ##
217
217
  def tags?(tags, bool = :and, negate: false)
218
218
  if bool == :pattern
219
- tags = tags.join(' ') if tags.is_a?(Array)
220
- matches = tag_pattern?(tags.gsub(/ *, */, ' '))
219
+ tags = tags.to_tags.tags_to_array.join(' ')
220
+ matches = tag_pattern?(tags)
221
221
 
222
222
  return negate ? !matches : matches
223
223
  end
@@ -283,7 +283,7 @@ module Doing
283
283
  new_title = @title.gsub(rx) { |m| yellow(m) }
284
284
  new_note.add(@note.to_s.gsub(rx) { |m| yellow(m) })
285
285
  else
286
- query = to_phrase_query(search.strip)
286
+ query = search.strip.to_phrase_query
287
287
 
288
288
  if query[:must].nil? && query[:must_not].nil?
289
289
  query[:must] = query[:should]
@@ -319,7 +319,7 @@ module Doing
319
319
  if search.is_rx? || matching == :fuzzy
320
320
  matches = @title + @note.to_s =~ search.to_rx(distance: distance, case_type: case_type)
321
321
  else
322
- query = to_phrase_query(search.strip)
322
+ query = search.strip.to_phrase_query
323
323
 
324
324
  if query[:must].nil? && query[:must_not].nil?
325
325
  query[:must] = query[:should]
@@ -399,7 +399,7 @@ module Doing
399
399
 
400
400
  # outputs item in Doing file format, including leading tab
401
401
  def to_s
402
- "\t- #{@date.strftime('%Y-%m-%d %H:%M')} | #{@title}#{@note.empty? ? '' : "\n#{@note}"}"
402
+ "\t- #{@date.strftime('%Y-%m-%d %H:%M')} | #{@title}#{@note.good? ? "\n#{@note}" : ''}"
403
403
  end
404
404
 
405
405
  ##
@@ -429,6 +429,10 @@ module Doing
429
429
  %(<Doing::Item @date=#{@date}>)
430
430
  end
431
431
 
432
+ def clone
433
+ Marshal.load(Marshal.dump(self))
434
+ end
435
+
432
436
  private
433
437
 
434
438
  def should?(key)
@@ -457,7 +461,7 @@ module Doing
457
461
  end
458
462
 
459
463
  def all_searches?(searches, case_type: :smart)
460
- return true if searches.nil? || searches.empty?
464
+ return true unless searches.good?
461
465
 
462
466
  text = @title + @note.to_s
463
467
  searches.each do |s|
@@ -468,7 +472,7 @@ module Doing
468
472
  end
469
473
 
470
474
  def no_searches?(searches, case_type: :smart)
471
- return true if searches.nil? || searches.empty?
475
+ return true unless searches.good?
472
476
 
473
477
  text = @title + @note.to_s
474
478
  searches.each do |s|
@@ -479,7 +483,7 @@ module Doing
479
483
  end
480
484
 
481
485
  def any_searches?(searches, case_type: :smart)
482
- return true if searches.nil? || searches.empty?
486
+ return true unless searches.good?
483
487
 
484
488
  text = @title + @note.to_s
485
489
  searches.each do |s|
@@ -490,7 +494,7 @@ module Doing
490
494
  end
491
495
 
492
496
  def all_tags?(tags)
493
- return true if tags.nil? || tags.empty?
497
+ return true unless tags.good?
494
498
 
495
499
  tags.each do |tag|
496
500
  return false unless @title =~ /@#{tag.wildcard_to_rx}(?= |\(|\Z)/i
@@ -499,7 +503,7 @@ module Doing
499
503
  end
500
504
 
501
505
  def no_tags?(tags)
502
- return true if tags.nil? || tags.empty?
506
+ return true unless tags.good?
503
507
 
504
508
  tags.each do |tag|
505
509
  return false if @title =~ /@#{tag.wildcard_to_rx}(?= |\(|\Z)/i
@@ -508,7 +512,7 @@ module Doing
508
512
  end
509
513
 
510
514
  def any_tags?(tags)
511
- return true if tags.nil? || tags.empty?
515
+ return true unless tags.good?
512
516
 
513
517
  tags.each do |tag|
514
518
  return true if @title =~ /@#{tag.wildcard_to_rx}(?= |\(|\Z)/i
@@ -537,7 +541,7 @@ module Doing
537
541
  end
538
542
 
539
543
  def any_values?(queries)
540
- return true if queries.nil? || queries.empty?
544
+ return true unless queries.good?
541
545
 
542
546
  queries.each do |q|
543
547
  parts = split_value_query(q)
@@ -547,7 +551,7 @@ module Doing
547
551
  end
548
552
 
549
553
  def all_values?(queries)
550
- return true if queries.nil? || queries.empty?
554
+ return true unless queries.good?
551
555
 
552
556
  queries.each do |q|
553
557
  parts = split_value_query(q)
@@ -557,7 +561,7 @@ module Doing
557
561
  end
558
562
 
559
563
  def no_values?(queries)
560
- return true if queries.nil? || queries.empty?
564
+ return true unless queries.good?
561
565
 
562
566
  queries.each do |q|
563
567
  parts = split_value_query(q)
@@ -612,29 +616,14 @@ module Doing
612
616
  end
613
617
  end
614
618
 
615
- def to_query(query)
616
- parser = BooleanTermParser::QueryParser.new
617
- transformer = BooleanTermParser::QueryTransformer.new
618
- parse_tree = parser.parse(query)
619
- transformer.apply(parse_tree).to_elasticsearch
620
- end
621
-
622
- def to_phrase_query(query)
623
- parser = PhraseParser::QueryParser.new
624
- transformer = PhraseParser::QueryTransformer.new
625
- parse_tree = parser.parse(query)
626
- transformer.apply(parse_tree).to_elasticsearch
627
- end
628
-
629
619
  def tag_pattern?(tags)
630
- query = to_query(tags)
620
+ query = tags.to_query
631
621
 
632
622
  no_tags?(query[:must_not]) && all_tags?(query[:must]) && any_tags?(query[:should])
633
623
  end
634
624
 
635
625
  def split_tags(tags)
636
- tags = tags.to_tags if tags.is_a? String
637
- tags.map(&:remove_at)
626
+ tags.to_tags.tags_to_array
638
627
  end
639
628
  end
640
629
  end
data/lib/doing/pager.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'pathname'
3
4
 
4
5
  module Doing
@@ -125,7 +125,7 @@ module Doing
125
125
 
126
126
  output.gsub!(/\\%/, '%')
127
127
 
128
- output.highlight_search!(opt[:search]) if opt[:search] && !opt[:not] && opt[:hilite]
128
+ output.highlight_search!(opt[:search]) if opt[:template] =~ /^temp/ && opt[:search] && !opt[:not] && opt[:hilite]
129
129
 
130
130
  out += "#{output}\n"
131
131
  end
@@ -89,7 +89,7 @@ module Doing
89
89
 
90
90
  wwid.content.concat(new_items)
91
91
 
92
- new_items.map { |item| Hooks.trigger :post_entry_added, self, item.dup }
92
+ new_items.map { |item| Hooks.trigger :post_entry_added, self, item }
93
93
 
94
94
  Doing.logger.info(%(Imported #{new_items.count} items to #{section}))
95
95
  end
@@ -93,7 +93,7 @@ module Doing
93
93
  wwid.content.add_section(item.section) unless wwid.content.section?(item.section)
94
94
  Hooks.trigger :pre_entry_add, self, item
95
95
  wwid.content.push(item)
96
- Hooks.trigger :post_entry_added, self, item.dup
96
+ Hooks.trigger :post_entry_added, self, item
97
97
  end
98
98
 
99
99
  Doing.logger.info('Imported:', "#{imported.count} items")
@@ -93,7 +93,7 @@ module Doing
93
93
 
94
94
  wwid.content.concat(new_items)
95
95
 
96
- new_items.map { |item| Hooks.trigger :post_entry_added, self, item.dup }
96
+ new_items.map { |item| Hooks.trigger :post_entry_added, self, item }
97
97
 
98
98
  Doing.logger.info('Imported:', %(#{new_items.count} items to #{section}))
99
99
  end
data/lib/doing/prompt.rb CHANGED
@@ -8,6 +8,14 @@ module Doing
8
8
 
9
9
  include Color
10
10
 
11
+ ##
12
+ ## Clear the terminal screen
13
+ ##
14
+ def clear_screen(msg = nil)
15
+ puts "\e[H\e[2J" if STDOUT.tty?
16
+ puts msg if msg.good?
17
+ end
18
+
11
19
  def force_answer
12
20
  @force_answer ||= nil
13
21
  end
data/lib/doing/string.rb CHANGED
@@ -20,7 +20,9 @@ module Doing
20
20
  ## can be separated by up to *distance* characters in
21
21
  ## haystack, spaces indicate unlimited distance.
22
22
  ##
23
- ## @example `"this word".to_rx(2) => /t.{0,3}h.{0,3}i.{0,3}s.{0,3}.*?w.{0,3}o.{0,3}r.{0,3}d/`
23
+ ## @example
24
+ ## "this word".to_rx(3)
25
+ ## # => /t.{0,3}h.{0,3}i.{0,3}s.{0,3}.*?w.{0,3}o.{0,3}r.{0,3}d/
24
26
  ##
25
27
  ## @param distance [Integer] Allowed distance
26
28
  ## between characters
@@ -53,6 +55,20 @@ module Doing
53
55
  Regexp.new(pattern, !case_sensitive)
54
56
  end
55
57
 
58
+ def to_phrase_query
59
+ parser = PhraseParser::QueryParser.new
60
+ transformer = PhraseParser::QueryTransformer.new
61
+ parse_tree = parser.parse(self)
62
+ transformer.apply(parse_tree).to_elasticsearch
63
+ end
64
+
65
+ def to_query
66
+ parser = BooleanTermParser::QueryParser.new
67
+ transformer = BooleanTermParser::QueryTransformer.new
68
+ parse_tree = parser.parse(self)
69
+ transformer.apply(parse_tree).to_elasticsearch
70
+ end
71
+
56
72
  ##
57
73
  ## Test string for truthiness (0, "f", "false", "n", "no" all return false, case insensitive, otherwise true)
58
74
  ##
@@ -92,7 +108,7 @@ module Doing
92
108
  escapes = scan(/(\e\[[\d;]+m)[^\e]+@/)
93
109
  color = color.split(' ') unless color.is_a?(Array)
94
110
  tag_color = color.each_with_object([]) { |c, arr| arr << Doing::Color.send(c) }.join('')
95
- last_color = if !escapes.empty?
111
+ last_color = if escapes.good?
96
112
  (escapes.count > 1 ? escapes[-2..-1] : [escapes[-1]]).map { |v| v[0] }.join('')
97
113
  else
98
114
  Doing::Color.default
@@ -101,13 +117,6 @@ module Doing
101
117
  gsub(/(\s|m)(@[^ ("']+)/, "\\1#{tag_color}\\2#{last_color}")
102
118
  end
103
119
 
104
- def to_phrase_query(query)
105
- parser = PhraseParser::QueryParser.new
106
- transformer = PhraseParser::QueryTransformer.new
107
- parse_tree = parser.parse(query)
108
- transformer.apply(parse_tree).to_elasticsearch
109
- end
110
-
111
120
  def ignore_case(search, case_type)
112
121
  (case_type == :smart && search !~ /[A-Z]/) || case_type == :ignore
113
122
  end
@@ -127,7 +136,7 @@ module Doing
127
136
  rx = search.to_rx(distance: distance, case_type: case_type)
128
137
  out.gsub!(rx) { |m| m.bgyellow.black }
129
138
  else
130
- query = to_phrase_query(search.strip)
139
+ query = search.strip.to_phrase_query
131
140
 
132
141
  if query[:must].nil? && query[:must_not].nil?
133
142
  query[:must] = query[:should]
@@ -449,7 +458,7 @@ module Doing
449
458
  ## @return [String] Regular expression string
450
459
  ##
451
460
  def wildcard_to_rx
452
- gsub(/\?/, '\S').gsub(/\*/, '\S*?')
461
+ gsub(/\?/, '\S').gsub(/\*/, '\S*?').gsub(/\]\]/, '--')
453
462
  end
454
463
 
455
464
  ##
@@ -173,7 +173,7 @@ module Doing
173
173
  ## @return [Array<DateTime>] Start and end dates as
174
174
  ## array
175
175
  ## @example Process a natural language date range
176
- ## "mon 3pm to mon 5pm".split_date_range
176
+ ## "mon 3pm to mon 5pm".split_date_range
177
177
  ##
178
178
  def split_date_range
179
179
  time_rx = /^(\d{1,2}+(:\d{1,2}+)?( *(am|pm))?|midnight|noon)$/
@@ -131,7 +131,7 @@ module Doing
131
131
 
132
132
  after = m['after']
133
133
 
134
- if value.nil? || value.empty?
134
+ if !value.good?
135
135
  after
136
136
  else
137
137
  pad = m['width'].to_i
@@ -183,7 +183,7 @@ module Doing
183
183
  ' '
184
184
  else
185
185
  line = l.gsub(/%/, '\%').strip.wrap(width, pad: pad, indent: indent, offset: 0, prefix: prefix, color: last_color, after: after, reset: reset, pad_first: true)
186
- line.highlight_tags!(tags_color, last_color: last_color) unless !tags_color || tags_color.nil? || tags_color.empty?
186
+ line.highlight_tags!(tags_color, last_color: last_color) unless !tags_color || !tags_color.good?
187
187
  "#{line} "
188
188
  end
189
189
  end.join("\n")
data/lib/doing/types.rb CHANGED
@@ -14,10 +14,13 @@ module Doing
14
14
 
15
15
  InvalidExportType = Class.new(RuntimeError)
16
16
  MissingConfigFile = Class.new(RuntimeError)
17
+
17
18
  TagArray = Class.new(Array)
19
+ TemplateName = Class.new(String)
18
20
  DateBeginString = Class.new(DateTime)
19
21
  DateEndString = Class.new(DateTime)
20
22
  DateRangeString = Class.new(Array)
23
+ DateRangeOptionalString = Class.new(Array)
21
24
  DateIntervalString = Class.new(DateTime)
22
25
  end
23
26
  end
data/lib/doing/util.rb CHANGED
@@ -19,7 +19,7 @@ module Doing
19
19
  ## @param cli [String] The name or path of the cli
20
20
  ##
21
21
  def exec_available(cli)
22
- return false if cli.nil?
22
+ return false unless cli.good?
23
23
 
24
24
  !TTY::Which.which(cli).nil?
25
25
  end
@@ -27,11 +27,12 @@ module Doing
27
27
  ##
28
28
  ## Return the first valid executable from a list of commands
29
29
  ##
30
- ## @example `Doing::Util.first_available_exec('bat', 'less -Xr', 'more -r', 'cat')`
30
+ ## @example
31
+ ## Doing::Util.first_available_exec('bat', 'less -Xr', 'more -r', 'cat')
31
32
  ##
32
33
  def first_available_exec(*commands)
33
34
  commands.compact.map(&:strip).reject(&:empty?).uniq
34
- .find { |cmd| exec_available(cmd.split.first) }
35
+ .find { |cmd| exec_available(cmd.split.first) }
35
36
  end
36
37
 
37
38
  def merge_default_proc(target, overwrite)
@@ -55,7 +56,7 @@ module Doing
55
56
  # @param [Hash] other_hash The other hash
56
57
  #
57
58
  def deep_merge_hashes(master_hash, other_hash)
58
- deep_merge_hashes!(master_hash.dup, other_hash)
59
+ deep_merge_hashes!(master_hash.clone, other_hash)
59
60
  end
60
61
 
61
62
  # Merges a master hash with another hash, recursively.
@@ -156,32 +157,32 @@ module Doing
156
157
  def find_default_editor(editor_for = 'default')
157
158
  # return nil unless $stdout.isatty || ENV['DOING_EDITOR_TEST']
158
159
 
159
- if ENV['DOING_EDITOR_TEST']
160
- return ENV['EDITOR']
161
- end
160
+ return ENV['EDITOR'] if ENV['DOING_EDITOR_TEST']
162
161
 
163
162
  editor_config = Doing.config.settings['editors']
164
163
 
165
164
  if editor_config.is_a?(String)
166
- Doing.logger.warn('Deprecated:', "Please update your configuration, 'editors' should be a mapping. Delete the key and run `doing config --update`.")
165
+ msg = "Please update your configuration, 'editors' should be a mapping."
166
+ msg << ' Delete the key and run `doing config --update`.'
167
+ Doing.logger.warn('Deprecated:', msg)
167
168
  return editor_config
168
169
  end
169
170
 
170
171
  if editor_config[editor_for]
171
172
  editor = editor_config[editor_for]
172
173
  # Doing.logger.debug('Editor:', "Using #{editor} from config 'editors->#{editor_for}'")
173
- return editor unless editor.nil? || editor.empty?
174
+ return editor unless editor.good?
174
175
  end
175
176
 
176
177
  if editor_for != 'editor' && editor_config['default']
177
178
  editor = editor_config['default']
178
179
  # Doing.logger.debug('Editor:', "Using #{editor} from config: 'editors->default'")
179
- return editor unless editor.nil? || editor.empty?
180
+ return editor unless editor.good?
180
181
  end
181
182
 
182
183
  editor ||= ENV['DOING_EDITOR'] || ENV['GIT_EDITOR'] || ENV['EDITOR']
183
184
 
184
- unless editor.nil? || editor.empty?
185
+ unless editor.good?
185
186
  # Doing.logger.debug('Editor:', "Found editor in environment variables: #{editor}")
186
187
  return editor
187
188
  end
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '2.1.22'
2
+ VERSION = '2.1.26'
3
3
  end