dnotify 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -18,3 +18,8 @@ Add your reminders to ~/.dnotifyrc
18
18
  :time: 10:28 in the evening
19
19
 
20
20
  Enjoy!
21
+
22
+ TODO
23
+ ====
24
+ - add a few tests
25
+ - allow listing of reminders
@@ -1,3 +1,3 @@
1
1
  module Dnotify
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/dnotify.rb CHANGED
@@ -22,7 +22,7 @@ module Dnotify
22
22
  puts 'setting up cron'
23
23
  tmp_cron_file = Tempfile.new('dnotify_tmp_cron').path
24
24
  File.open(tmp_cron_file, File::WRONLY | File::APPEND) do |file|
25
- file << existing_crontab << "* * * * * /bin/bash -l -c 'dnotify' >> /tmp/dnotify.log\n"
25
+ file << existing_crontab << "* * * * * /bin/bash -i -l -c 'dnotify' > /tmp/dnotify.log 2>&1" << '\n'
26
26
  end
27
27
  puts `crontab #{tmp_cron_file}`
28
28
  end
@@ -46,6 +46,10 @@ module Dnotify
46
46
 
47
47
  DefaultNotification = {:body => "Alarm", :summary => "Alarm", :timeout => 2.5, :icon_path => File.join(File.dirname(__FILE__),'../resources/clock.png') }
48
48
 
49
+ def initialize
50
+ ENV['DISPLAY'] = config[:display]
51
+ end
52
+
49
53
  def run
50
54
  return unless Setup.check
51
55
  #check if a reminder aligns with the current time
@@ -65,7 +69,11 @@ module Dnotify
65
69
  end
66
70
 
67
71
  def reminders
68
- @reminders ||= YAML::load_file(Setup::ConfigPath)
72
+ config[:reminders]
73
+ end
74
+
75
+ def config
76
+ @config ||= YAML::load_file(Setup::ConfigPath)
69
77
  end
70
78
  end
71
79
  end
@@ -1,4 +1,6 @@
1
1
  ---
2
+ :display: ':1.0'
3
+ :reminders:
2
4
  - :summary: Time to play badminton
3
5
  :time: 10:27 in the evening
4
6
  - :summary: Call it a day
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dnotify
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Khaja Minhajuddin
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-12 00:00:00 +05:30
13
+ date: 2011-06-13 00:00:00 +05:30
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency