reminder 0.0.1rc

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in reminder.gemspec
4
+ gemspec
data/README ADDED
@@ -0,0 +1,66 @@
1
+ Reminder
2
+ ========
3
+
4
+ This is a simple gem that will throw a Growl notification every certain time. That way, you'll be reminded of something.
5
+
6
+ For example, I normally make a lot of stuff before I commit my changes, which I know is really bad (and it's what pushed me to write this), so I just set a reminder to commit every 10 minutes.
7
+
8
+ This is how it looks like
9
+
10
+ ![Please Commit](http://s3.amazonaws.com/hock-personal-bucket/commit_please.png "Please Commit")
11
+
12
+ That way, the Growl notification will notice (bother) me and remind (make) me commit.
13
+
14
+
15
+ Options
16
+ =======
17
+
18
+ **Reminder** has some cool options (thanks to [Choise](https://github.com/defunkt/choice)) so you can easily set up your notifications and start working.
19
+
20
+ To use **Reminder**, just write
21
+
22
+ $ reminder -m 'Keep Growling Growling ...' -t 10
23
+
24
+ and you'll get this every 10 _**minutes**_:
25
+
26
+ ![Keep Rolling](http://s3.amazonaws.com/hock-personal-bucket/keep_rolling.png "Keep Rolling")
27
+
28
+
29
+ To change the notification title, just add the ` -T ` option.
30
+
31
+
32
+ All **Reminder**'s options are:
33
+
34
+ Usage: reminder [-mtT]
35
+
36
+ Notification Options:
37
+ -m, --message=MESSAGE The notification message...
38
+ -T, --title=TITLE The title of the notification...
39
+ -t, --time=TIME Number of minutes...
40
+
41
+ Other options:
42
+ -v, --version Show version
43
+
44
+ You can list all options at any time by running `reminder --help`
45
+
46
+ TODO
47
+ ====
48
+
49
+ * Find a better way to run the notification.
50
+ * Clean up code. May be a little messy.
51
+ * Add a `--for` option (remind me every 10 minutes for 3 hours)
52
+ * Add documentation inside the source code.
53
+
54
+
55
+ Issues
56
+ ======
57
+
58
+ Please use the Github Issues Tracker above.
59
+
60
+
61
+ Thank you for reading :-)
62
+ -------------------------
63
+ Released under the MIT License
64
+
65
+ Nicolás Hock Isaza. nhocki@gmail.com. Zinergia
66
+
@@ -0,0 +1,8 @@
1
+ require 'bundler'
2
+ require 'pamela'
3
+
4
+ Bundler::GemHelper.install_tasks
5
+ Pamela.load :spec, :console
6
+
7
+ desc 'Default: run specs.'
8
+ task :default => 'spec'
Binary file
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
3
+ require 'reminder'
4
+ require 'growl'
5
+ require 'choice'
6
+
7
+ Choice.options do
8
+ banner "Usage: #{File.basename(__FILE__)} [-mtT]"
9
+ header ''
10
+ header 'Notification Options:'
11
+
12
+ option :message do
13
+ d = "How's it going you awesome person?"
14
+ short '-m'
15
+ long '--message=MESSAGE'
16
+ desc "The notification message. The reminder! (default #{d})"
17
+ default d
18
+ end
19
+
20
+ option :title do
21
+ d = "Just remember..."
22
+ short '-T'
23
+ long '--title=TITLE'
24
+ desc "The title of the notification. (default #{d})"
25
+ default d
26
+ end
27
+
28
+ option :time do
29
+ d = 10
30
+ short '-t'
31
+ long '--time=TIME'
32
+ desc "Number of minutes between each notification (default #{d})"
33
+ cast Integer
34
+ default d
35
+ end
36
+
37
+ separator ''
38
+ separator 'Other options: '
39
+
40
+ option :version do
41
+ short '-v'
42
+ long '--version'
43
+ desc 'Show version'
44
+ action do
45
+ puts "#{File.basename(__FILE__)} v#{Reminder::VERSION}"
46
+ exit
47
+ end
48
+ end
49
+ end
50
+
51
+ options = Choice.choices
52
+
53
+ Reminder::Notifier.new(options).run
@@ -0,0 +1,2 @@
1
+ require 'reminder/notifier'
2
+ require 'reminder/exceptions'
@@ -0,0 +1,19 @@
1
+ module Reminder
2
+ class Error < StandardError ; end
3
+
4
+
5
+ # This exception will be raised if Growl is not installed
6
+ # You'll need to install Growl to use this gem
7
+ class GrowlNotInstalled < Error
8
+ attr_writer :default_message
9
+ def initialize(message = nil)
10
+ @message = message
11
+ @default_message = "Growl is not installed. Download it at http://growl.info"
12
+ end
13
+ def to_s
14
+ @message || @default_message
15
+ end
16
+ end
17
+
18
+
19
+ end
@@ -0,0 +1,26 @@
1
+
2
+ module Reminder
3
+ class Notifier
4
+
5
+ def initialize options, output = STDOUT
6
+ @message = options[:message]
7
+ @title = options[:title]
8
+ @time = options[:time]
9
+ end
10
+
11
+ def run
12
+ raise GrowlNotInstalled and return unless Growl.installed?
13
+ notification = Growl.new
14
+ notification.message = @message
15
+ notification.title = @title
16
+ notification.icon = nil
17
+
18
+ while true
19
+ notification.run
20
+ sleep(@time * 60)
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module Reminder
2
+ VERSION = "0.0.1rc"
3
+ end
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "reminder/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "reminder"
7
+ s.version = Reminder::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Nicolás Hock Isaza"]
10
+ s.email = ["nhocki@gmail.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{Simple Growl reminders. Just work, set a timer, and get reminded!}
13
+ s.description = %q{This gem will allow you to create simple, repeating reminders with growl}
14
+
15
+ s.rubyforge_project = "reminder"
16
+
17
+ s.add_dependency('growl')
18
+ s.add_dependency('choice')
19
+ s.add_development_dependency('rspec')
20
+ s.add_development_dependency('pamela')
21
+
22
+
23
+ s.files = `git ls-files`.split("\n")
24
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
+ s.require_paths = ["lib"]
27
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ module Reminder
4
+ describe Notifier do
5
+ let(:output) {double('output').as_null_object}
6
+ context "Growl is not installed" do
7
+ it "raises an exception" do
8
+ Growl.stub!(:installed?).and_return(false)
9
+ expect{
10
+ Notifier.new(default_options, output).run
11
+ }.to raise_error(
12
+ Reminder::GrowlNotInstalled, /Growl is not installed/
13
+ )
14
+ end
15
+ end
16
+
17
+ context "Growl is happily installed" do
18
+
19
+ it "should show notifications instantly" do
20
+ notifier = Notifier.new(default_options, output)
21
+ notifier.run
22
+ end
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,10 @@
1
+ require 'reminder'
2
+ require 'growl'
3
+
4
+ def default_options
5
+ {
6
+ :message => "How's it going you awesome person?",
7
+ :title => "Just remember...",
8
+ :time => 10
9
+ }
10
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: reminder
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: 5
5
+ version: 0.0.1rc
6
+ platform: ruby
7
+ authors:
8
+ - "Nicol\xC3\xA1s Hock Isaza"
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-03-11 00:00:00 -05:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: growl
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: choice
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: "0"
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: rspec
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: pamela
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ type: :development
59
+ version_requirements: *id004
60
+ description: This gem will allow you to create simple, repeating reminders with growl
61
+ email:
62
+ - nhocki@gmail.com
63
+ executables:
64
+ - reminder
65
+ extensions: []
66
+
67
+ extra_rdoc_files: []
68
+
69
+ files:
70
+ - .gitignore
71
+ - Gemfile
72
+ - README
73
+ - Rakefile
74
+ - assets/images/growl.png
75
+ - bin/reminder
76
+ - lib/reminder.rb
77
+ - lib/reminder/exceptions.rb
78
+ - lib/reminder/notifier.rb
79
+ - lib/reminder/version.rb
80
+ - reminder.gemspec
81
+ - spec/reminder/notifier_spec.rb
82
+ - spec/spec_helper.rb
83
+ has_rdoc: true
84
+ homepage: ""
85
+ licenses: []
86
+
87
+ post_install_message:
88
+ rdoc_options: []
89
+
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "0"
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.3.1
104
+ requirements: []
105
+
106
+ rubyforge_project: reminder
107
+ rubygems_version: 1.5.2
108
+ signing_key:
109
+ specification_version: 3
110
+ summary: Simple Growl reminders. Just work, set a timer, and get reminded!
111
+ test_files:
112
+ - spec/reminder/notifier_spec.rb
113
+ - spec/spec_helper.rb