doing 1.0.26 → 1.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/doing +18 -5
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +69 -57
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6b820922f541c1841b9e3cd6613fcdf20e39f726c455a289b035cd46adad4be
|
4
|
+
data.tar.gz: 03b371b4badb689f42c2132d252b69a592456efd00c26c94c78cde8ebd0091c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a37aa02c0d7b72c9a3ee7fc920b14a90ac930b7b52e0b18aa5669850a5b84e9f99b6ceeda5e0e058d6a4de65d10736a3f4ea803869629617781daeb581b95460
|
7
|
+
data.tar.gz: 54ddce825edf7a8aa32b898c86ae698b29e3dd71b443d2154816b3c40714be8a7d0af35f8010640bab76dd135380779cf0598fcacab8deedab9841878e66b3c0
|
data/README.md
CHANGED
@@ -390,7 +390,7 @@ Note that you can include a tag with synonyms in the whitelist as well to tag it
|
|
390
390
|
|
391
391
|
#### Adding entries:
|
392
392
|
|
393
|
-
now
|
393
|
+
now, did - Add an entry
|
394
394
|
later - Add an item to the Later section
|
395
395
|
done - Add a completed item with @done(date). No argument finishes last entry.
|
396
396
|
meanwhile - Finish any @meanwhile tasks and optionally create a new one
|
data/bin/doing
CHANGED
@@ -3,6 +3,7 @@ $LOAD_PATH.unshift File.join(__dir__, '..', 'lib')
|
|
3
3
|
require 'gli'
|
4
4
|
require 'doing'
|
5
5
|
require 'tempfile'
|
6
|
+
require 'pp'
|
6
7
|
|
7
8
|
def class_exists?(class_name)
|
8
9
|
klass = Module.const_get(class_name)
|
@@ -42,6 +43,10 @@ desc 'Send results report to STDOUT instead of STDERR'
|
|
42
43
|
default_value false
|
43
44
|
switch [:stdout], :default_value => false, :negatable => false
|
44
45
|
|
46
|
+
desc 'Use a specific configuration file'
|
47
|
+
default_value false
|
48
|
+
flag [:config_file]
|
49
|
+
|
45
50
|
# desc 'Wrap notes at X chars (0 for no wrap)'
|
46
51
|
# flag [:w,:wrapwidth], :must_match => /^\d+$/, :type => Integer
|
47
52
|
|
@@ -1077,22 +1082,22 @@ command :config do |c|
|
|
1077
1082
|
c.action do |global_options,options,args|
|
1078
1083
|
if `uname` =~ /Darwins/
|
1079
1084
|
if options[:x]
|
1080
|
-
%x{open -a "#{wwid.config['editor_app']}" "#{
|
1085
|
+
%x{open -a "#{wwid.config['editor_app']}" "#{wwid.config_file}"}
|
1081
1086
|
elsif options[:a] || options[:b]
|
1082
1087
|
if options[:a]
|
1083
|
-
%x{open -a "#{options[:a]}" "#{
|
1088
|
+
%x{open -a "#{options[:a]}" "#{wwid.config_file}"}
|
1084
1089
|
elsif options[:b]
|
1085
|
-
%x{open -b #{options[:b]} "#{
|
1090
|
+
%x{open -b #{options[:b]} "#{wwid.config_file}"}
|
1086
1091
|
end
|
1087
1092
|
else
|
1088
1093
|
raise "No EDITOR variable defined in environment" if options[:e].nil? && ENV['EDITOR'].nil?
|
1089
1094
|
editor = options[:e].nil? ? ENV['EDITOR'] : options[:e]
|
1090
|
-
system %Q{#{editor} "#{
|
1095
|
+
system %Q{#{editor} "#{wwid.config_file}"}
|
1091
1096
|
end
|
1092
1097
|
else
|
1093
1098
|
raise "No EDITOR variable defined in environment" if options[:e].nil? && ENV['EDITOR'].nil?
|
1094
1099
|
editor = options[:e].nil? ? ENV['EDITOR'] : options[:e]
|
1095
|
-
system %Q{#{editor} "#{
|
1100
|
+
system %Q{#{editor} "#{wwid.config_file}"}
|
1096
1101
|
end
|
1097
1102
|
end
|
1098
1103
|
end
|
@@ -1111,12 +1116,20 @@ end
|
|
1111
1116
|
|
1112
1117
|
|
1113
1118
|
pre do |global,command,options,args|
|
1119
|
+
if global[:config_file]
|
1120
|
+
wwid.config_file = global[:config_file]
|
1121
|
+
wwid.configure({:ignore_local => true})
|
1122
|
+
# wwid.results.push("Override config file #{wwid.config_file}")
|
1123
|
+
end
|
1124
|
+
|
1114
1125
|
if global[:doing_file]
|
1115
1126
|
wwid.init_doing_file(global[:doing_file])
|
1116
1127
|
else
|
1117
1128
|
wwid.init_doing_file
|
1118
1129
|
end
|
1130
|
+
|
1119
1131
|
wwid.config[:include_notes] = false unless global[:notes]
|
1132
|
+
|
1120
1133
|
if global[:version]
|
1121
1134
|
$stdout.puts "doing v" + Doing::VERSION
|
1122
1135
|
end
|
data/lib/doing/version.rb
CHANGED
data/lib/doing/wwid.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
3
|
require 'deep_merge'
|
4
|
-
require 'pp'
|
5
4
|
|
6
5
|
##
|
7
6
|
## @brief String helpers
|
@@ -43,7 +42,7 @@ end
|
|
43
42
|
## @brief Main "What Was I Doing" methods
|
44
43
|
##
|
45
44
|
class WWID
|
46
|
-
attr_accessor :content, :sections, :current_section, :doing_file, :config, :user_home, :default_config_file, :results
|
45
|
+
attr_accessor :content, :sections, :current_section, :doing_file, :config, :user_home, :default_config_file, :config_file, :results
|
47
46
|
|
48
47
|
##
|
49
48
|
## @brief Initializes the object.
|
@@ -53,6 +52,65 @@ class WWID
|
|
53
52
|
@doingrc_needs_update = false
|
54
53
|
@default_config_file = '.doingrc'
|
55
54
|
@interval_cache = {}
|
55
|
+
@results = []
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
## @brief Finds a project-specific configuration file
|
60
|
+
##
|
61
|
+
## @return (String) A file path
|
62
|
+
##
|
63
|
+
def find_local_config
|
64
|
+
|
65
|
+
config = {}
|
66
|
+
dir = Dir.pwd
|
67
|
+
|
68
|
+
local_config_files = []
|
69
|
+
|
70
|
+
while (dir != '/' && (dir =~ /[A-Z]:\//) == nil)
|
71
|
+
if File.exists? File.join(dir, @default_config_file)
|
72
|
+
local_config_files.push(File.join(dir, @default_config_file))
|
73
|
+
end
|
74
|
+
|
75
|
+
dir = File.dirname(dir)
|
76
|
+
end
|
77
|
+
|
78
|
+
local_config_files
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
## @brief Reads a configuration.
|
83
|
+
##
|
84
|
+
def read_config(opt={})
|
85
|
+
unless @config_file
|
86
|
+
if Dir.respond_to?('home')
|
87
|
+
@config_file = File.join(Dir.home, @default_config_file)
|
88
|
+
else
|
89
|
+
@config_file = File.join(File.expand_path("~"), @default_config_file)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
if opt[:ignore_local]
|
94
|
+
additional_configs = []
|
95
|
+
else
|
96
|
+
additional_configs = find_local_config
|
97
|
+
end
|
98
|
+
|
99
|
+
begin
|
100
|
+
@local_config = {}
|
101
|
+
|
102
|
+
@config = YAML.load_file(@config_file) || {} if File.exists?(@config_file)
|
103
|
+
additional_configs.each { |cfg|
|
104
|
+
new_config = YAML.load_file(cfg) || {} if cfg
|
105
|
+
@local_config = @local_config.deep_merge(new_config)
|
106
|
+
}
|
107
|
+
|
108
|
+
# @config.deep_merge(@local_config)
|
109
|
+
rescue
|
110
|
+
@config = {}
|
111
|
+
@local_config = {}
|
112
|
+
# raise "error reading config"
|
113
|
+
end
|
56
114
|
end
|
57
115
|
|
58
116
|
##
|
@@ -62,12 +120,17 @@ class WWID
|
|
62
120
|
##
|
63
121
|
def configure(opt={})
|
64
122
|
@timers = {}
|
65
|
-
|
123
|
+
opt[:ignore_local] ||= false
|
66
124
|
|
67
|
-
|
125
|
+
unless @config_file
|
126
|
+
@config_file = File.join(@user_home, @default_config_file)
|
127
|
+
end
|
128
|
+
|
129
|
+
read_config({:ignore_local => opt[:ignore_local]})
|
68
130
|
|
69
131
|
user_config = @config.dup
|
70
|
-
|
132
|
+
|
133
|
+
@config = {} if @config.nil?
|
71
134
|
|
72
135
|
@config['autotag'] ||= {}
|
73
136
|
@config['autotag']['whitelist'] ||= []
|
@@ -145,6 +208,7 @@ class WWID
|
|
145
208
|
@default_template = @config['templates']['default']['template']
|
146
209
|
@default_date_format = @config['templates']['default']['date_format']
|
147
210
|
|
211
|
+
|
148
212
|
end
|
149
213
|
|
150
214
|
##
|
@@ -243,58 +307,6 @@ class WWID
|
|
243
307
|
end
|
244
308
|
end
|
245
309
|
|
246
|
-
##
|
247
|
-
## @brief Finds a project-specific configuration file
|
248
|
-
##
|
249
|
-
## @return (String) A file path
|
250
|
-
##
|
251
|
-
def find_local_config
|
252
|
-
|
253
|
-
config = {}
|
254
|
-
dir = Dir.pwd
|
255
|
-
|
256
|
-
local_config_files = []
|
257
|
-
|
258
|
-
while (dir != '/' && (dir =~ /[A-Z]:\//) == nil)
|
259
|
-
if File.exists? File.join(dir, @default_config_file)
|
260
|
-
local_config_files.push(File.join(dir, @default_config_file))
|
261
|
-
end
|
262
|
-
|
263
|
-
dir = File.dirname(dir)
|
264
|
-
end
|
265
|
-
|
266
|
-
local_config_files
|
267
|
-
end
|
268
|
-
|
269
|
-
##
|
270
|
-
## @brief Reads a configuration.
|
271
|
-
##
|
272
|
-
def read_config
|
273
|
-
if Dir.respond_to?('home')
|
274
|
-
@config_file = File.join(Dir.home, @default_config_file)
|
275
|
-
else
|
276
|
-
@config_file = File.join(File.expand_path("~"), @default_config_file)
|
277
|
-
end
|
278
|
-
# @doingrc_needs_update = true if File.exists? @config_file
|
279
|
-
additional_configs = find_local_config
|
280
|
-
|
281
|
-
begin
|
282
|
-
@local_config = {}
|
283
|
-
|
284
|
-
@config = YAML.load_file(@config_file) || {} if File.exists?(@config_file)
|
285
|
-
additional_configs.each { |cfg|
|
286
|
-
new_config = YAML.load_file(cfg) || {} if cfg
|
287
|
-
@local_config = @local_config.deep_merge(new_config)
|
288
|
-
}
|
289
|
-
|
290
|
-
# @config.deep_merge(@local_config)
|
291
|
-
rescue
|
292
|
-
@config = {}
|
293
|
-
@local_config = {}
|
294
|
-
# raise "error reading config"
|
295
|
-
end
|
296
|
-
end
|
297
|
-
|
298
310
|
##
|
299
311
|
## @brief Create a process for an editor and wait for the file handle to return
|
300
312
|
##
|