doing 2.1.30 → 2.1.31pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.irbrc +1 -0
- data/.yardoc/checksums +9 -8
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/CHANGELOG.md +4923 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/bin/commands/again.rb +1 -1
- data/bin/commands/archive.rb +3 -3
- data/bin/commands/cancel.rb +1 -1
- data/bin/commands/commands.rb +8 -8
- data/bin/commands/completion.rb +61 -19
- data/bin/commands/config.rb +9 -9
- data/bin/commands/done.rb +1 -1
- data/bin/commands/flag.rb +1 -1
- data/bin/commands/grep.rb +5 -5
- data/bin/commands/last.rb +1 -1
- data/bin/commands/meanwhile.rb +1 -1
- data/bin/commands/now.rb +1 -1
- data/bin/commands/on.rb +1 -1
- data/bin/commands/open.rb +1 -1
- data/bin/commands/recent.rb +4 -4
- data/bin/commands/show.rb +8 -8
- data/bin/commands/since.rb +1 -1
- data/bin/commands/today.rb +1 -1
- data/bin/commands/view.rb +3 -3
- data/bin/commands/yesterday.rb +2 -2
- data/bin/doing +22 -133
- data/docs/doc/Array.html +1 -1
- 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 +324 -4
- 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 +125 -1
- data/docs/doc/Doing/Items.html +1 -1
- data/docs/doc/Doing/LogAdapter.html +1 -1
- data/docs/doc/Doing/Note.html +109 -3
- data/docs/doc/Doing/Pager.html +1 -1
- data/docs/doc/Doing/Plugins.html +1 -1
- data/docs/doc/Doing/Prompt.html +1 -1
- data/docs/doc/Doing/Section.html +1 -1
- data/docs/doc/Doing/TemplateString.html +1 -1
- data/docs/doc/Doing/Types.html +1 -1
- data/docs/doc/Doing/Util/Backup.html +1 -1
- data/docs/doc/Doing/Util.html +1 -1
- data/docs/doc/Doing/WWID.html +6 -6
- data/docs/doc/Doing.html +2 -2
- data/docs/doc/FalseClass.html +1 -1
- data/docs/doc/GLI/Commands/Help.html +1 -1
- 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 +1 -1
- data/docs/doc/Object.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 +1 -1
- data/docs/doc/Symbol.html +1 -1
- data/docs/doc/Time.html +1 -1
- data/docs/doc/TrueClass.html +1 -1
- data/docs/doc/_index.html +3 -1
- data/docs/doc/file.README.html +2 -2
- data/docs/doc/index.html +2 -2
- data/docs/doc/method_list.html +337 -241
- data/docs/doc/top-level-namespace.html +105 -1
- data/doing.rdoc +25 -9
- data/example_plugin.rb +7 -5
- data/lib/completion/_doing.zsh +2 -2
- data/lib/completion/doing.bash +2 -2
- data/lib/completion/doing.fish +2 -3
- data/lib/doing/add_options.rb +117 -0
- data/lib/doing/array/array.rb +16 -0
- data/lib/doing/completion/bash_completion.rb +12 -51
- data/lib/doing/completion/fish_completion.rb +16 -52
- data/lib/doing/completion/zsh_completion.rb +12 -56
- data/lib/doing/completion.rb +203 -17
- data/lib/doing/item.rb +21 -3
- data/lib/doing/items.rb +5 -5
- data/lib/doing/note.rb +24 -8
- data/lib/doing/plugins/export/dayone_export.rb +8 -6
- data/lib/doing/plugins/export/html_export.rb +4 -4
- data/lib/doing/plugins/export/json_export.rb +19 -20
- data/lib/doing/plugins/export/markdown_export.rb +2 -2
- data/lib/doing/plugins/export/template_export.rb +4 -4
- data/lib/doing/plugins/import/calendar_import.rb +1 -1
- data/lib/doing/plugins/import/doing_import.rb +1 -1
- data/lib/doing/plugins/import/timing_import.rb +1 -1
- data/lib/doing/string/highlight.rb +3 -4
- data/lib/doing/string/string.rb +8 -0
- data/lib/doing/util.rb +1 -1
- data/lib/doing/util_backup.rb +12 -12
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +76 -77
- data/lib/doing.rb +57 -0
- data/lib/examples/commands/wiki.rb +27 -19
- data/scripts/setting_replace.rb +11 -0
- metadata +6 -4
data/lib/doing.rb
CHANGED
@@ -66,10 +66,67 @@ module Doing
|
|
66
66
|
@logger ||= LogAdapter.new((ENV['DOING_LOG_LEVEL'] || :info).to_sym)
|
67
67
|
end
|
68
68
|
|
69
|
+
##
|
70
|
+
## Holds a Configuration object with methods and a @settings hash
|
71
|
+
##
|
72
|
+
## @return [Configuration] Configuration object
|
73
|
+
##
|
69
74
|
def config
|
70
75
|
@config ||= Configuration.new
|
71
76
|
end
|
72
77
|
|
78
|
+
##
|
79
|
+
## Shortcut for Doing.config.settings
|
80
|
+
##
|
81
|
+
## @return [Hash] Settings hash
|
82
|
+
##
|
83
|
+
def settings
|
84
|
+
config.settings
|
85
|
+
end
|
86
|
+
|
87
|
+
##
|
88
|
+
## Fetch a config setting using a dot-separated keypath
|
89
|
+
## or array of keys
|
90
|
+
##
|
91
|
+
## @param keypath [String|Array] Either a
|
92
|
+
## dot-separated key path
|
93
|
+
## (search.case) or array of keys
|
94
|
+
## (['search', 'case'])
|
95
|
+
## @param default A default value to return if the
|
96
|
+
## provided path returns nil result
|
97
|
+
##
|
98
|
+
def setting(keypath, default = nil)
|
99
|
+
cfg = config.settings
|
100
|
+
case keypath
|
101
|
+
when Array
|
102
|
+
cfg.dig(*keypath) || default
|
103
|
+
when String
|
104
|
+
unless keypath =~ /^[.*]?$/
|
105
|
+
real_path = config.resolve_key_path(keypath, create: false)
|
106
|
+
return default unless real_path&.count&.positive?
|
107
|
+
|
108
|
+
cfg = cfg.dig(*real_path)
|
109
|
+
end
|
110
|
+
|
111
|
+
cfg.nil? ? default : cfg
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def set(keypath, value)
|
116
|
+
real_path = config.resolve_key_path(keypath, create: false)
|
117
|
+
return nil unless real_path&.count&.positive?
|
118
|
+
|
119
|
+
config.settings.deep_set(real_path, value)
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
## Update configuration from specified file
|
124
|
+
##
|
125
|
+
## @param file [String] Path to new config file
|
126
|
+
## @param options [Hash] options
|
127
|
+
##
|
128
|
+
## @option options :ignore_local Ignore local configuration files
|
129
|
+
##
|
73
130
|
def config_with(file, options = {})
|
74
131
|
@config = Configuration.new(file, options: options)
|
75
132
|
end
|
@@ -35,7 +35,7 @@ command :wiki do |c|
|
|
35
35
|
c.desc 'Only show items with recorded time intervals'
|
36
36
|
c.switch [:only_timed], default_value: false, negatable: false
|
37
37
|
|
38
|
-
c.action do |
|
38
|
+
c.action do |_global, options, _args|
|
39
39
|
tags = @wwid.tag_groups([], opt: options)
|
40
40
|
|
41
41
|
wiki = Doing::Plugins.plugins.dig(:export, 'wiki', :class)
|
@@ -43,38 +43,46 @@ command :wiki do |c|
|
|
43
43
|
tags.each do |tag, items|
|
44
44
|
export_options = { page_title: tag, is_single: false, options: options }
|
45
45
|
|
46
|
-
raise
|
46
|
+
raise 'Missing plugin "wiki"' unless wiki
|
47
47
|
|
48
48
|
out = wiki.render(@wwid, items, variables: export_options)
|
49
49
|
|
50
50
|
if out
|
51
51
|
FileUtils.mkdir_p('doing_wiki')
|
52
|
-
File.open(File.join('doing_wiki', tag
|
53
|
-
f.puts out
|
54
|
-
end
|
52
|
+
File.open(File.join('doing_wiki', "#{tag}.html"), 'w') { |f| f.puts out }
|
55
53
|
end
|
56
54
|
end
|
57
55
|
|
58
|
-
|
59
|
-
|
60
|
-
else
|
61
|
-
wiki.template('wiki_index')
|
62
|
-
end
|
63
|
-
style = if @settings['export_templates']['wiki_css'] && File.exist?(File.expand_path(@settings['export_templates']['wiki_css']))
|
64
|
-
IO.read(File.expand_path(@settings['export_templates']['wiki_css']))
|
65
|
-
else
|
66
|
-
wiki.template('wiki_css')
|
67
|
-
end
|
68
|
-
tags_out = tags.map { |t| {url: "#{t}.html"} }
|
69
|
-
engine = Haml::Engine.new(template)
|
56
|
+
engine = Haml::Engine.new(wiki_template(wiki))
|
57
|
+
tag_arr = tags.each_with_object([]) { |(tag, items), arr| arr << { name: tag, count: items.count } }
|
70
58
|
index_out = engine.render(Object.new,
|
71
|
-
|
59
|
+
{ :@tags => tag_arr,
|
60
|
+
:@page_title => 'Tags wiki',
|
61
|
+
:@style => wiki_style(wiki) })
|
72
62
|
|
73
63
|
if index_out
|
74
64
|
File.open(File.join('doing_wiki', 'index.html'), 'w') do |f|
|
75
65
|
f.puts index_out
|
76
66
|
end
|
77
|
-
Doing.logger.warn(
|
67
|
+
Doing.logger.warn('Wiki written to doing_wiki directory')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def wiki_template(wiki)
|
72
|
+
if Doing.setting('export_templates.wiki_index') &&
|
73
|
+
File.exist?(File.expand_path(Doing.setting('export_templates.wiki_index')))
|
74
|
+
IO.read(File.expand_path(Doing.setting('export_templates.wiki_index')))
|
75
|
+
else
|
76
|
+
wiki.template('wiki_index')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def wiki_style(wiki)
|
81
|
+
if Doing.setting('export_templates.wiki_css') &&
|
82
|
+
File.exist?(File.expand_path(Doing.setting('export_templates.wiki_css')))
|
83
|
+
IO.read(File.expand_path(Doing.setting('export_templates.wiki_css')))
|
84
|
+
else
|
85
|
+
wiki.template('wiki_css')
|
78
86
|
end
|
79
87
|
end
|
80
88
|
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.
|
4
|
+
version: 2.1.31pre
|
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-02-
|
11
|
+
date: 2022-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: safe_yaml
|
@@ -602,6 +602,7 @@ files:
|
|
602
602
|
- lib/completion/doing.bash
|
603
603
|
- lib/completion/doing.fish
|
604
604
|
- lib/doing.rb
|
605
|
+
- lib/doing/add_options.rb
|
605
606
|
- lib/doing/array/array.rb
|
606
607
|
- lib/doing/array/nested_hash.rb
|
607
608
|
- lib/doing/array/tags.rb
|
@@ -778,6 +779,7 @@ files:
|
|
778
779
|
- scripts/generate_fish_completions.rb
|
779
780
|
- scripts/generate_zsh_completions.rb
|
780
781
|
- scripts/runtests.sh
|
782
|
+
- scripts/setting_replace.rb
|
781
783
|
- scripts/sort_commands.rb
|
782
784
|
- yard_templates/default/method_details/setup.rb
|
783
785
|
homepage: http://brettterpstra.com/project/doing/
|
@@ -802,9 +804,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
802
804
|
version: '0'
|
803
805
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
804
806
|
requirements:
|
805
|
-
- - "
|
807
|
+
- - ">"
|
806
808
|
- !ruby/object:Gem::Version
|
807
|
-
version:
|
809
|
+
version: 1.3.1
|
808
810
|
requirements: []
|
809
811
|
rubygems_version: 3.2.16
|
810
812
|
signing_key:
|