doing 1.0.93 → 2.0.6.pre

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.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHORS +19 -0
  3. data/CHANGELOG.md +616 -0
  4. data/COMMANDS.md +1181 -0
  5. data/Gemfile +2 -0
  6. data/Gemfile.lock +110 -0
  7. data/LICENSE +23 -0
  8. data/README.md +15 -699
  9. data/Rakefile +79 -0
  10. data/_config.yml +1 -0
  11. data/bin/doing +1055 -494
  12. data/doing.gemspec +34 -0
  13. data/doing.rdoc +1839 -0
  14. data/example_plugin.rb +209 -0
  15. data/generate_completions.sh +5 -0
  16. data/img/doing-colors.jpg +0 -0
  17. data/img/doing-printf-wrap-800.jpg +0 -0
  18. data/img/doing-show-note-formatting-800.jpg +0 -0
  19. data/lib/completion/_doing.zsh +203 -0
  20. data/lib/completion/doing.bash +449 -0
  21. data/lib/completion/doing.fish +329 -0
  22. data/lib/doing/array.rb +8 -0
  23. data/lib/doing/cli_status.rb +70 -0
  24. data/lib/doing/colors.rb +136 -0
  25. data/lib/doing/configuration.rb +312 -0
  26. data/lib/doing/errors.rb +109 -0
  27. data/lib/doing/hash.rb +31 -0
  28. data/lib/doing/hooks.rb +59 -0
  29. data/lib/doing/item.rb +155 -0
  30. data/lib/doing/log_adapter.rb +344 -0
  31. data/lib/doing/markdown_document_listener.rb +174 -0
  32. data/lib/doing/note.rb +59 -0
  33. data/lib/doing/pager.rb +95 -0
  34. data/lib/doing/plugin_manager.rb +208 -0
  35. data/lib/doing/plugins/export/csv_export.rb +48 -0
  36. data/lib/doing/plugins/export/html_export.rb +83 -0
  37. data/lib/doing/plugins/export/json_export.rb +140 -0
  38. data/lib/doing/plugins/export/markdown_export.rb +85 -0
  39. data/lib/doing/plugins/export/taskpaper_export.rb +34 -0
  40. data/lib/doing/plugins/export/template_export.rb +141 -0
  41. data/lib/doing/plugins/import/cal_to_json.scpt +0 -0
  42. data/lib/doing/plugins/import/calendar_import.rb +76 -0
  43. data/lib/doing/plugins/import/doing_import.rb +144 -0
  44. data/lib/doing/plugins/import/timing_import.rb +78 -0
  45. data/lib/doing/string.rb +348 -0
  46. data/lib/doing/symbol.rb +16 -0
  47. data/lib/doing/time.rb +18 -0
  48. data/lib/doing/util.rb +186 -0
  49. data/lib/doing/version.rb +1 -1
  50. data/lib/doing/wwid.rb +1868 -2349
  51. data/lib/doing/wwidfile.rb +117 -0
  52. data/lib/doing.rb +43 -3
  53. data/lib/examples/commands/autotag.rb +63 -0
  54. data/lib/examples/commands/wiki.rb +81 -0
  55. data/lib/examples/plugins/hooks.rb +22 -0
  56. data/lib/examples/plugins/say_export.rb +202 -0
  57. data/lib/examples/plugins/templates/wiki.css +169 -0
  58. data/lib/examples/plugins/templates/wiki.haml +27 -0
  59. data/lib/examples/plugins/templates/wiki_index.haml +18 -0
  60. data/lib/examples/plugins/wiki_export.rb +87 -0
  61. data/lib/templates/doing-markdown.erb +5 -0
  62. data/man/doing.1 +964 -0
  63. data/man/doing.1.html +711 -0
  64. data/man/doing.1.ronn +600 -0
  65. data/package-lock.json +3 -0
  66. data/rdoc_to_mmd.rb +42 -0
  67. data/rdocfixer.rb +13 -0
  68. data/scripts/generate_bash_completions.rb +211 -0
  69. data/scripts/generate_fish_completions.rb +204 -0
  70. data/scripts/generate_zsh_completions.rb +168 -0
  71. metadata +82 -7
  72. data/lib/doing/helpers.rb +0 -191
  73. data/lib/doing/markdown_export.rb +0 -16
data/lib/doing/helpers.rb DELETED
@@ -1,191 +0,0 @@
1
- ##
2
- ## @brief Date helpers
3
- ##
4
- class ::Time
5
- def relative_date
6
- if self > Date.today.to_time
7
- strftime(' %_I:%M%P')
8
- elsif self > (Date.today - 6).to_time
9
- strftime('%a %_I:%M%P')
10
- elsif self.year == Date.today.year
11
- strftime('%m/%d %_I:%M%P')
12
- else
13
- strftime('%m/%d/%Y %_I:%M%P')
14
- end
15
- end
16
- end
17
-
18
- ##
19
- ## @brief Hash helpers
20
- ##
21
- class ::Hash
22
- def has_tags?(tags, bool = :and)
23
- tags = tags.split(/ *, */) if tags.is_a? String
24
- bool = bool.normalize_bool if bool.is_a? String
25
- item = self
26
- tags.map! {|t| t.strip.sub(/^@/, '')}
27
- case bool
28
- when :and
29
- result = true
30
- tags.each do |tag|
31
- unless item['title'] =~ /@#{tag}/
32
- result = false
33
- break
34
- end
35
- end
36
- result
37
- when :not
38
- result = true
39
- tags.each do |tag|
40
- if item['title'] =~ /@#{tag}/
41
- result = false
42
- break
43
- end
44
- end
45
- result
46
- else
47
- result = false
48
- tags.each do |tag|
49
- if item['title'] =~ /@#{tag}/
50
- result = true
51
- break
52
- end
53
- end
54
- result
55
- end
56
- end
57
-
58
- def matches_search?(search)
59
- item = self
60
- text = item['note'] ? item['title'] + item['note'].join(' ') : item['title']
61
- pattern = if search.strip =~ %r{^/.*?/$}
62
- search.sub(%r{/(.*?)/}, '\1')
63
- else
64
- search.split('').join('.{0,3}')
65
- end
66
- text =~ /#{pattern}/i ? true : false
67
- end
68
- end
69
-
70
- ##
71
- ## @brief String helpers
72
- ##
73
- class ::String
74
- def cap_first
75
- sub(/^\w/) do |m|
76
- m.upcase
77
- end
78
- end
79
-
80
-
81
- ##
82
- ## @brief Convert a boolean string to a symbol
83
- ##
84
- ## @return Symbol :and, :or, or :not
85
- ##
86
- def normalize_bool!
87
- replace normalize_bool
88
- end
89
-
90
- def normalize_bool(default = :and)
91
- case self
92
- when /(and|all)/i
93
- :and
94
- when /(any|or)/i
95
- :or
96
- when /(not|none)/i
97
- :not
98
- else
99
- default.is_a?(Symbol) ? default : default.normalize_bool
100
- end
101
- end
102
-
103
-
104
- ##
105
- ## @brief Remove duplicate tags, leaving only first occurrence
106
- ##
107
- ## @return Deduplicated string
108
- ##
109
- def dedup_tags!
110
- replace dedup_tags
111
- end
112
-
113
- def dedup_tags
114
- item = self.dup
115
- tags = item.scan(/(?<=^| )(\@(\S+?)(\([^)]+\))?)(?=\b|$)/).uniq
116
- tags.each do |tag|
117
- found = false
118
- item.gsub!(/( |^)#{tag[0]}\b/) do |m|
119
- if found
120
- ''
121
- else
122
- found = true
123
- m
124
- end
125
- end
126
- end
127
- item
128
- end
129
-
130
- ##
131
- ## @brief Turn raw urls into HTML links
132
- ##
133
- ## @param opt (Hash) Additional Options
134
- ##
135
- def link_urls!(opt = {})
136
- replace link_urls(opt)
137
- end
138
-
139
- def link_urls(opt = {})
140
- opt[:format] ||= :html
141
- str = self.dup
142
-
143
- if :format == :markdown
144
- # Remove <self-linked> formatting
145
- str.gsub!(/<(.*?)>/) do |match|
146
- m = Regexp.last_match
147
- if m[1] =~ /^https?:/
148
- m[1]
149
- else
150
- match
151
- end
152
- end
153
- end
154
-
155
- # Replace qualified urls
156
- str.gsub!(%r{(?mi)(?<!["'\[(\\])((http|https)://)([\w\-_]+(\.[\w\-_]+)+)([\w\-.,@?^=%&amp;:/~+#]*[\w\-@^=%&amp;/~+#])?}) do |_match|
157
- m = Regexp.last_match
158
- proto = m[1].nil? ? 'http://' : ''
159
- case opt[:format]
160
- when :html
161
- %(<a href="#{proto}#{m[0]}" title="Link to #{m[0]}">[#{m[3]}]</a>)
162
- when :markdown
163
- "[#{m[0]}](#{proto}#{m[0]})"
164
- else
165
- m[0]
166
- end
167
- end
168
-
169
- # Clean up unlinked <urls>
170
- str.gsub!(/<(\w+:.*?)>/) do |match|
171
- m = Regexp.last_match
172
- if m[1] =~ /<a href/
173
- match
174
- else
175
- %(<a href="#{m[1]}" title="Link to #{m[1]}">[link]</a>)
176
- end
177
- end
178
-
179
- str
180
- end
181
- end
182
-
183
- class ::Symbol
184
- def normalize_bool!
185
- replace normalize_bool
186
- end
187
-
188
- def normalize_bool
189
- to_s.normalize_bool
190
- end
191
- end
@@ -1,16 +0,0 @@
1
- ##
2
- ## @brief Creates Markdown export
3
- ##
4
- class MarkdownExport
5
- attr_accessor :items, :page_title, :totals
6
-
7
- def initialize(page_title, items, totals)
8
- @page_title = page_title
9
- @items = items
10
- @totals = totals
11
- end
12
-
13
- def get_binding
14
- binding()
15
- end
16
- end