doing 0.1.7 → 0.1.9
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.
- checksums.yaml +4 -4
- data/README.md +69 -2
- data/bin/doing +22 -4
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +29 -8
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8e66a72fd2de31862fdc6423f9771b4a41ac012
|
4
|
+
data.tar.gz: 1bc3c5ab4be017092e802dba802c1a7c1d1721db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1b2d0a13c32cb31f971f85afe278138bd7ceffae608f801b3640d23a397474efca6f812830d4089b8220f149f2dc688ef80b680626caac6b98529265f68fe17
|
7
|
+
data.tar.gz: 4536f5c497ef9c2510e81faa08b83786f140d85695ceb757e5233988feaa0ea26fb7f72ff83da9b6d042b6bc2df1b68944b381b1e45708c3a6e0294f0b633301
|
data/README.md
CHANGED
@@ -16,7 +16,11 @@ _Side note:_ I actually use the library behind this utility as part of another s
|
|
16
16
|
|
17
17
|
## Installation
|
18
18
|
|
19
|
-
[sudo] gem install doing
|
19
|
+
$ [sudo] gem install doing
|
20
|
+
|
21
|
+
Only use `sudo` if your environment requires it. If you're using the system Ruby on a Mac, for example, it will likely be necessary. If `gem install doing` fails, then run `sudo gem install doing` and provide your administrator password.
|
22
|
+
|
23
|
+
See the [support](#support) section below for troubleshooting details.
|
20
24
|
|
21
25
|
## The "doing" file
|
22
26
|
|
@@ -57,16 +61,32 @@ A basic configuration looks like this:
|
|
57
61
|
|
58
62
|
The config file is stored in "~/.doingrc", and is created on the first run.
|
59
63
|
|
64
|
+
### Doing file location
|
65
|
+
|
60
66
|
The one thing you'll probably want to adjust is the file that the notes are stored in. That's the `doing_file` key:
|
61
67
|
|
62
68
|
doing_file: /Users/username/Dropbox/nvALT2.2/?? What was I doing.md
|
63
69
|
|
64
70
|
I keep mine in my nvALT folder for quick access and syncing between machines. If desired, you can give it a `.taskpaper` extension to make it more recognizable to other applications. (If you do that in nvALT, make sure to add `taskpaper` as a recognized extension in preferences).
|
65
71
|
|
72
|
+
### "Current actions" section
|
73
|
+
|
66
74
|
You can rename the section that holds your current tasks. By default, this is "Currently," but if you have some other bright idea, feel free:
|
67
75
|
|
68
76
|
current_section: Currently
|
69
77
|
|
78
|
+
### Default editors
|
79
|
+
|
80
|
+
The setting `editor_app` only applies to Mac OS X users. It's the default application that the command `doing open` will open your WWID file in. If this is blank, it will be opened by whatever the system default is, or you can use `-a app_name` or `-b bundle_id` to override.
|
81
|
+
|
82
|
+
In the case of the `doing now -e` command, your $EDITOR environment variable will be used to complete the entry text and notes. Set it in your .bash_profile or whatever is appropriate for your system:
|
83
|
+
|
84
|
+
export EDITOR="mate -w"
|
85
|
+
|
86
|
+
The only requirements are that your editor be launchable from the command line and able to "wait." In the case of Sublime Text and TextMate, just use `-w` like this: `export EDITOR="subl -w"`.
|
87
|
+
|
88
|
+
### Templates
|
89
|
+
|
70
90
|
The config also contains templates for various command outputs. Include placeholders by placing a % before the keyword. The available tokens are:
|
71
91
|
|
72
92
|
- `%title`: the "what was I doing" entry line
|
@@ -169,7 +189,7 @@ You can create your own "views" in the `~/.doingrc` file and view them with `doi
|
|
169
189
|
You can add additional custom views, just nest them under the "views" key (indented two spaces from the edge). Multiple views would look like this:
|
170
190
|
|
171
191
|
views:
|
172
|
-
|
192
|
+
later:
|
173
193
|
section: Later
|
174
194
|
count: 5
|
175
195
|
wrap_width: 60
|
@@ -186,6 +206,19 @@ The "section" key is the default section to pull entries from. Count and section
|
|
186
206
|
|
187
207
|
You can add new sections with `done add_section section_name`. You can also create them on the fly by using the `-s section_name` flag when running `doing now`. For example, `doing now -s Misc just a random side note` would create the "just a random side note" entry in a new section called "Misc."
|
188
208
|
|
209
|
+
Regarding colors, you can use them to create very nice displays if you're outputting to a color terminal. Example:
|
210
|
+
|
211
|
+
color:
|
212
|
+
date_format: '%F %_I:%M%P'
|
213
|
+
section: Currently
|
214
|
+
count: 10
|
215
|
+
wrap_width: 0
|
216
|
+
template: '%boldblack%date %boldgreen| %boldwhite%title%default%note'
|
217
|
+
|
218
|
+
Outputs:
|
219
|
+
|
220
|
+

|
221
|
+
|
189
222
|
## Usage:
|
190
223
|
|
191
224
|
doing [global options] command [command options] [arguments...]
|
@@ -223,4 +256,38 @@ You can add new sections with `done add_section section_name`. You can also crea
|
|
223
256
|
archive - Move all but the most recent 5 entries to the Archive section
|
224
257
|
config - Edit the default configuration
|
225
258
|
|
259
|
+
---
|
260
|
+
|
261
|
+
## Troubleshooting
|
262
|
+
|
263
|
+
### Errors after "Successfully installed..."
|
264
|
+
|
265
|
+
If you get errors in the terminal immediately after a message like:
|
266
|
+
|
267
|
+
Successfully installed doing-x.x.x
|
268
|
+
2 gems installed
|
269
|
+
|
270
|
+
...it may just be documentation related. If running `doing` works, you can ignore them. If not, try running the install command again with `--no-document`:
|
271
|
+
|
272
|
+
$ gem install --no-document doing
|
273
|
+
|
274
|
+
### Command not found
|
275
|
+
|
276
|
+
If running `doing` after a successful install gives you a "command not found" error, then your gem path isn't in your $PATH, meaning the system can't find it. To locate the gem and link it into your path, you can try this:
|
277
|
+
|
278
|
+
cd $GEM_PATH/bin
|
279
|
+
ln -s doing /usr/local/bin/
|
280
|
+
|
281
|
+
Then try running `doing` and see if it works.
|
282
|
+
|
283
|
+
### Encoding errors
|
284
|
+
|
285
|
+
Ruby is rife with encoding inconsistencies across platforms and versions. Feel free to file issues (see below).
|
286
|
+
|
287
|
+
### Support
|
288
|
+
|
289
|
+
I'm not making any money on `doing`, and I don't plan to spend a lot of time fixing errors on an array of operating systems and platforms I don't even have access to. You'll probably have to solve some things on your own.
|
290
|
+
|
291
|
+
That said, you can get support from other users (and occasionally me) on GitHub. If you run into a replicatable issue in your environment, please [post an issue](https://github.com/ttscoff/doing/issues) and include your platform, OS version, and the result of `ruby -v`, along with a copy/paste of the error message.
|
226
292
|
|
293
|
+
Please try not to email me directly about GitHub projects.
|
data/bin/doing
CHANGED
@@ -3,6 +3,11 @@ require 'gli'
|
|
3
3
|
require 'doing'
|
4
4
|
require 'tempfile'
|
5
5
|
|
6
|
+
if RUBY_VERSION.to_f > 1.9
|
7
|
+
Encoding.default_external = Encoding::UTF_8
|
8
|
+
Encoding.default_internal = Encoding::UTF_8
|
9
|
+
end
|
10
|
+
|
6
11
|
include GLI::App
|
7
12
|
version Doing::VERSION
|
8
13
|
|
@@ -243,19 +248,32 @@ command :view do |c|
|
|
243
248
|
c.flag [:c,:count], :must_match => /^\d+$/, :type => Integer
|
244
249
|
|
245
250
|
c.action do |global_options,options,args|
|
246
|
-
|
251
|
+
if args.empty?
|
252
|
+
title = wwid.choose_view
|
253
|
+
else
|
254
|
+
title = args[0]
|
255
|
+
end
|
256
|
+
view = wwid.get_view(title)
|
247
257
|
if view
|
248
258
|
template = view.has_key?('template') ? view['template'] : nil
|
249
259
|
format = view.has_key?('date_format') ? view['date_format'] : nil
|
250
260
|
count = options[:c] ? options[:c] : view.has_key?('count') ? view['count'] : 10
|
251
|
-
section = options[:s] ? options[:s] : view.has_key?('section') ? view['section'] : wwid.current_section
|
252
|
-
|
261
|
+
section = options[:s] ? options[:s].cap_first : view.has_key?('section') ? view['section'] : wwid.current_section
|
262
|
+
order = view.has_key?('order') ? view['order'] : "asc"
|
263
|
+
puts wwid.list_section({:section => section, :count => count, :template => template, :format => format, :order => order })
|
253
264
|
else
|
254
|
-
raise "View #{
|
265
|
+
raise "View #{title} not found in config"
|
255
266
|
end
|
256
267
|
end
|
257
268
|
end
|
258
269
|
|
270
|
+
desc 'List available custom views'
|
271
|
+
command :views do |c|
|
272
|
+
c.action do |global_options,options,args|
|
273
|
+
puts wwid.views.join(", ")
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
259
277
|
desc 'Move all but the most recent 5 entries in a section to Archive'
|
260
278
|
arg_name 'section'
|
261
279
|
default_value wwid.current_section
|
data/lib/doing/version.rb
CHANGED
data/lib/doing/wwid.rb
CHANGED
@@ -46,7 +46,8 @@ class WWID
|
|
46
46
|
'template' => '%date | %title%note',
|
47
47
|
'wrap_width' => 0,
|
48
48
|
'section' => 'section_name',
|
49
|
-
'count' => 5
|
49
|
+
'count' => 5,
|
50
|
+
'order' => "desc"
|
50
51
|
},
|
51
52
|
'color' => {
|
52
53
|
'date_format' => '%F %_I:%M%P',
|
@@ -54,6 +55,7 @@ class WWID
|
|
54
55
|
'wrap_width' => 0,
|
55
56
|
'section' => 'Currently',
|
56
57
|
'count' => 10,
|
58
|
+
'order' => "asc"
|
57
59
|
}
|
58
60
|
}
|
59
61
|
|
@@ -82,7 +84,7 @@ class WWID
|
|
82
84
|
@other_content_bottom = []
|
83
85
|
|
84
86
|
section = "Uncategorized"
|
85
|
-
lines = input.split(
|
87
|
+
lines = input.split(/[\n\r]/)
|
86
88
|
current = 0
|
87
89
|
|
88
90
|
lines.each {|line|
|
@@ -141,7 +143,7 @@ class WWID
|
|
141
143
|
f.puts input
|
142
144
|
end
|
143
145
|
|
144
|
-
pid = Process.fork { system(
|
146
|
+
pid = Process.fork { system("$EDITOR #{tmpfile.path}") }
|
145
147
|
|
146
148
|
trap("INT") {
|
147
149
|
Process.kill(9, pid) rescue Errno::ESRCH
|
@@ -153,7 +155,11 @@ class WWID
|
|
153
155
|
Process.wait(pid)
|
154
156
|
|
155
157
|
begin
|
156
|
-
|
158
|
+
if $?.exitstatus == 0
|
159
|
+
input = IO.read(tmpfile.path)
|
160
|
+
else
|
161
|
+
raise "Cancelled"
|
162
|
+
end
|
157
163
|
ensure
|
158
164
|
tmpfile.close
|
159
165
|
tmpfile.unlink
|
@@ -165,8 +171,8 @@ class WWID
|
|
165
171
|
# This takes a multi-line string and formats it as an entry
|
166
172
|
# returns an array of [title(String), note(Array)]
|
167
173
|
def format_input(input)
|
168
|
-
|
169
|
-
input_lines = input.
|
174
|
+
raise "No content in entry" if input.nil? || input.strip.length == 0
|
175
|
+
input_lines = input.split(/[\n\r]+/)
|
170
176
|
title = input_lines[0].strip
|
171
177
|
note = input_lines.length > 1 ? input_lines[1..-1] : []
|
172
178
|
note.map! { |line|
|
@@ -231,6 +237,20 @@ class WWID
|
|
231
237
|
return sections[num.to_i - 1]
|
232
238
|
end
|
233
239
|
|
240
|
+
def views
|
241
|
+
@config.has_key?('views') ? @config['views'].keys : []
|
242
|
+
end
|
243
|
+
|
244
|
+
def choose_view
|
245
|
+
views.each_with_index {|view, i|
|
246
|
+
puts "% 3d: %s" % [i+1, view]
|
247
|
+
}
|
248
|
+
print "> "
|
249
|
+
num = STDIN.gets
|
250
|
+
return false if num =~ /^[a-z ]*$/i
|
251
|
+
return views[num.to_i - 1]
|
252
|
+
end
|
253
|
+
|
234
254
|
def get_view(title)
|
235
255
|
if @config['views'].has_key?(title)
|
236
256
|
return @config['views'][title]
|
@@ -336,10 +356,11 @@ class WWID
|
|
336
356
|
|
337
357
|
def archive(section=nil,count=10)
|
338
358
|
section = choose_section if section.nil? || section =~ /choose/i
|
359
|
+
section = section.cap_first
|
339
360
|
if sections.include?(section)
|
340
361
|
items = @content[section]['items']
|
341
|
-
return if items.length <
|
342
|
-
@content[section]['items'] = items[0..
|
362
|
+
return if items.length < count
|
363
|
+
@content[section]['items'] = items[0..count-1]
|
343
364
|
add_section('Archive') unless sections.include?('Archive')
|
344
365
|
@content['Archive']['items'] += items[count..-1]
|
345
366
|
write(@doing_file)
|
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: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -87,7 +87,7 @@ files:
|
|
87
87
|
- lib/doing.rb
|
88
88
|
- lib/doing/version.rb
|
89
89
|
- lib/doing/wwid.rb
|
90
|
-
homepage: http://brettterpstra.com
|
90
|
+
homepage: http://brettterpstra.com/project/doing/
|
91
91
|
licenses:
|
92
92
|
- MIT
|
93
93
|
metadata: {}
|