todoNotifier 1.2
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 +7 -0
- data/bin/todonotifier +10 -0
- data/lib/todoNotifier/Task.rb +18 -0
- data/lib/todoNotifier/TaskList.rb +26 -0
- data/lib/todoNotifier.rb +28 -0
- metadata +48 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a9e7d7642f6e9e6b90a45092c4d7fe733cd55ecc
|
4
|
+
data.tar.gz: 64a1f67dc254fad0afa47f7e3e9f86ef0eb91193
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d968b13c97550833a0e545f9809a69b91206f8af399344ba57ad98a254178d2cf9ca11adb24ab25a8173ad3e66fc0f8b96942981d8a983cc52d33f86bdafe876
|
7
|
+
data.tar.gz: fcb0bf1cb60a571e5b1f2eb329e47909b66b6b44baa6c2f6c4968eacf0806d41339f347137aed1b5e5555de2ec676a326997bf9d2d565e21e3769dc60798be70
|
data/bin/todonotifier
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
class Task
|
2
|
+
attr_accessor :_d
|
3
|
+
attr_accessor :text
|
4
|
+
include SmarterDates
|
5
|
+
|
6
|
+
def initialize(text)
|
7
|
+
self._d = text
|
8
|
+
self.text = text.strip
|
9
|
+
end
|
10
|
+
|
11
|
+
def notify()
|
12
|
+
TerminalNotifier.notify(self.text, :title => 'TODO', :group => Process.pid)
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_s()
|
16
|
+
self.text
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class TaskList
|
2
|
+
attr_accessor :tasks
|
3
|
+
|
4
|
+
def parseLine(l)
|
5
|
+
# Capitals denote a title, so block them (2 or more)
|
6
|
+
if l =~ /^[:upper:]+$/
|
7
|
+
return
|
8
|
+
end
|
9
|
+
# Matches '-', '*', '#', tabs or 2 or more spaces as the beginning of a task
|
10
|
+
if l =~ /^(-|\*|\#|\t|\s{2,})(.*)/
|
11
|
+
return $2 # Return the message
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize()
|
16
|
+
self.tasks = []
|
17
|
+
f = File.open(File.expand_path("~/.todo"), "r")
|
18
|
+
f.each do |l|
|
19
|
+
m = parseLine(l)
|
20
|
+
if m
|
21
|
+
tasks << Task.new(m)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
f.close
|
25
|
+
end
|
26
|
+
end
|
data/lib/todoNotifier.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'smarter_dates'
|
2
|
+
require 'terminal-notifier'
|
3
|
+
|
4
|
+
%w(
|
5
|
+
Task
|
6
|
+
TaskList
|
7
|
+
).each { |name| require File.expand_path("../todoNotifier/#{name}", __FILE__) }
|
8
|
+
|
9
|
+
class TodoNotifier
|
10
|
+
attr_accessor :tl
|
11
|
+
def inRange(a, b, r)
|
12
|
+
(((a.to_time - r).to_datetime < b) && ((a.to_time + r).to_datetime > b))
|
13
|
+
end
|
14
|
+
|
15
|
+
def initialize()
|
16
|
+
self.tl = TaskList.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def update()
|
20
|
+
if self.tl.tasks[0]._d != nil
|
21
|
+
if inRange(self.tl.tasks[0]._d, DateTime.now, 60)
|
22
|
+
self.tl.tasks[0].notify()
|
23
|
+
self.tl.tasks.shift
|
24
|
+
end
|
25
|
+
end
|
26
|
+
sleep 60
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: todoNotifier
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.2'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- '@TheNinjaCharlie'
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Notifies you about parsed tasks from a ToDo file. For OS X.
|
14
|
+
email:
|
15
|
+
executables:
|
16
|
+
- todonotifier
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- bin/todonotifier
|
21
|
+
- lib/todoNotifier.rb
|
22
|
+
- lib/todoNotifier/Task.rb
|
23
|
+
- lib/todoNotifier/TaskList.rb
|
24
|
+
homepage: https://github.com/charles-l/todoNotifier
|
25
|
+
licenses:
|
26
|
+
- MIT
|
27
|
+
metadata: {}
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
require_paths:
|
31
|
+
- lib
|
32
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 2.3.0
|
45
|
+
signing_key:
|
46
|
+
specification_version: 4
|
47
|
+
summary: Notifies you about parsed tasks from a ToDo file. For OS X.
|
48
|
+
test_files: []
|