todo-notify 0.1

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 (5) hide show
  1. data/.gemtest +0 -0
  2. data/README.md +51 -0
  3. data/bin/todo-notify +88 -0
  4. data/todo-notify.gemspec +22 -0
  5. metadata +64 -0
File without changes
@@ -0,0 +1,51 @@
1
+ # Todo.notify
2
+
3
+ todo-notify is a command line program designed to work with Gina Trapani's
4
+ [todo.txt](github.com/ginatrapani/todo.txt-cli). It takes your todo.txt and
5
+ notifies you of a random task. If you set this up with cron, you can have
6
+ a periodic reminder of tasks that are on your todo list. Neat, right? :)
7
+
8
+ # Installation
9
+
10
+ gem install todo-notify
11
+
12
+ # Usage
13
+
14
+ todo-notify --path ~/Dropbox/todo/todo.txt
15
+
16
+ # Output of the --help
17
+
18
+ Usage: todo-notify [options]
19
+
20
+ ## Placeholders
21
+
22
+ todo-notify uses a placeholder system for generating its titles and content.
23
+ The placeholders are as following:
24
+
25
+ %t - The text content of the task.
26
+ %P - The task priority.
27
+ %p - The task +projects.
28
+ %c - The task @contexts.
29
+
30
+ Example task: "(A) My task, woot. +project @context"
31
+ Example title: "Todo: %P %p %c"
32
+ Example content: "%t"
33
+
34
+ The notification will then look like this:
35
+
36
+ Todo: A +project @context
37
+ My task, woot.
38
+
39
+ ## Notifications
40
+
41
+ todo-notify uses the "notify-send" command to show its notifications. If your
42
+ operating system doesn't have a "notify-send" program then todo-notify will not
43
+ work.
44
+
45
+ ## Available arguments
46
+
47
+ -p, --path FILE Path to your todo.txt FILE.
48
+ -t, --title TITLE Title of the notification.
49
+ -c, --content CONTENT The content of the notification.
50
+ -h, --help Display this screen.
51
+
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'todo-txt'
4
+ require 'optparse'
5
+
6
+ # Configuration variables
7
+ $todo_file = File.expand_path "~/Dropbox/todo/todo.txt"
8
+ $title = "Todo: %P %p %c"
9
+ $content = "%t"
10
+
11
+ # Parse command line options
12
+ OptionParser.new do |o|
13
+ # Set some introductory text that explains the placeholders etc.
14
+ o.separator %(
15
+ # Placeholders
16
+
17
+ todo-notify uses a placeholder system for generating its titles and content.
18
+ The placeholders are as following:
19
+
20
+ %t - The text content of the task.
21
+ %P - The task priority.
22
+ %p - The task +projects.
23
+ %c - The task @contexts.
24
+
25
+ Example task: "(A) My task, woot. +project @context"
26
+ Example title: "Todo: %P %p %c"
27
+ Example content: "%t"
28
+
29
+ The notification will then look like this:
30
+
31
+ Todo: A +project @context
32
+ My task, woot.
33
+
34
+ # Notifications
35
+
36
+ todo-notify uses the "notify-send" command to show its notifications. If your
37
+ operating system doesn't have a "notify-send" program then todo-notify will not
38
+ work.
39
+
40
+ # Available arguments
41
+ )
42
+
43
+ # Path to your todo.txt file.
44
+ o.on('-p',
45
+ '--path FILE',
46
+ 'Path to your todo.txt FILE. Defaults to
47
+ "~/Dropbox/todo/todo.txt".') do |file|
48
+ $todo_file = File.expand_path file
49
+ end
50
+
51
+ # Notification title.
52
+ o.on('-t',
53
+ '--title TITLE',
54
+ 'Title of the notification. Defaults to
55
+ "Todo: %P %p %c".') do |title|
56
+ $title = title
57
+ end
58
+
59
+ # Notification content.
60
+ o.on('-c',
61
+ '--content CONTENT',
62
+ 'The content of the notification. Defaults to
63
+ "%t".') do |content|
64
+ $content = content
65
+ end
66
+
67
+ # Display help.
68
+ o.on('-h', '--help', 'Display this screen.') do
69
+ puts o
70
+ exit
71
+ end
72
+ end.parse!
73
+
74
+ def parse_placeholders string, task
75
+ string.gsub('%c', task.contexts.join(', ')).
76
+ gsub('%p', task.projects.join(', ')).
77
+ gsub('%P', task.priority).
78
+ gsub('%t', task.text).
79
+ gsub(/\s+/, ' ')
80
+ end
81
+
82
+ list = Todo::List.new $todo_file
83
+ task = list.sample
84
+
85
+ title = parse_placeholders $title, task
86
+ content = parse_placeholders $content, task
87
+
88
+ `notify-send "#{title}" "#{content}"`
@@ -0,0 +1,22 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{todo-notify}
3
+ s.version = "0.1"
4
+ s.date = %q{2011-08-21}
5
+ s.authors = ["Sam Rose"]
6
+ s.email = %q{samwho@lbak.co.uk}
7
+ s.summary = %q{A command line program for reminding you of items on your todo list.}
8
+ s.description = %q{A command line program for reminding you of items on your todo list.}
9
+ s.homepage = %q{http://github.com/samwho/todo-notify-gem}
10
+ s.required_ruby_version = '>= 1.9.2'
11
+ s.license = 'GPL-2'
12
+ s.bindir = 'bin'
13
+ s.executables = ["todo-notify"]
14
+ s.add_dependency 'todo-txt'
15
+ s.requirements << 'The "notify-send" command line program.'
16
+ s.requirements << 'A "todo.txt" file in Gina Trapani\'s todo.txt format.'
17
+
18
+ # Add all files to the files parameter.
19
+ s.files = []
20
+ Dir["**/*.*"].each { |path| s.files.push path }
21
+ s.files.push ".gemtest"
22
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: todo-notify
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sam Rose
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-08-21 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: todo-txt
16
+ requirement: &79079580 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *79079580
25
+ description: A command line program for reminding you of items on your todo list.
26
+ email: samwho@lbak.co.uk
27
+ executables:
28
+ - todo-notify
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - bin/todo-notify
33
+ - README.md
34
+ - todo-notify-0.1.gem
35
+ - todo-notify.gemspec
36
+ - .gemtest
37
+ homepage: http://github.com/samwho/todo-notify-gem
38
+ licenses:
39
+ - GPL-2
40
+ post_install_message:
41
+ rdoc_options: []
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: 1.9.2
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements:
57
+ - The "notify-send" command line program.
58
+ - A "todo.txt" file in Gina Trapani's todo.txt format.
59
+ rubyforge_project:
60
+ rubygems_version: 1.8.8
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: A command line program for reminding you of items on your todo list.
64
+ test_files: []