remindmeto 0.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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +26 -0
- data/Rakefile +22 -0
- data/bin/remindmeto +18 -0
- data/lib/remindmeto.rb +8 -0
- data/lib/remindmeto/cli.rb +23 -0
- data/lib/remindmeto/normalizer.rb +66 -0
- data/lib/remindmeto/notifier.rb +18 -0
- data/lib/remindmeto/notifier/libnotify_notifier.rb +12 -0
- data/lib/remindmeto/notifier/notification_center_notifier.rb +11 -0
- data/lib/remindmeto/os.rb +28 -0
- data/lib/remindmeto/runner.rb +18 -0
- data/lib/remindmeto/version.rb +3 -0
- data/remindmeto.gemspec +33 -0
- data/spec/remindmeto/normalizer_spec.rb +12 -0
- metadata +120 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ec6896f8f6f03b9fefa5ea2f7db1752ced94d901
|
4
|
+
data.tar.gz: dcaa0f6ba1e71653328926a34d823a4ad2a88457
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7aaba7132df7b5af8e350db4493904ee6390d8fab1fdaaafac990070b639d7cc250c773a64c25293f81fd6a72082aaf41b46d8abfdc54378e59249c809a12059
|
7
|
+
data.tar.gz: 19e88da6cdb07a43b6dbcade37fefd72c4c30912f69de4e94cd627cf9c46aec7f16ad0b5f368c992dab622cbe61aef6ee33c3f995ff39b4e98f22507b677d780
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Hunter Clarke
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Remindmeto
|
2
|
+
|
3
|
+
A simple, intuitive reminder tool for the command line.
|
4
|
+
|
5
|
+
Current supported UI elements include libnotify for Ubuntu and the Notification Center for Mac.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
$ gem install remindmeto
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
$ remindmeto task {in/every} {time} {second(s)/minutes(s)/hour(s)}
|
14
|
+
|
15
|
+
Examples:
|
16
|
+
|
17
|
+
$ remindmeto relax every 5 minutes
|
18
|
+
$ remindmeto turn over the laundry in an hour
|
19
|
+
|
20
|
+
## Contributing
|
21
|
+
|
22
|
+
1. Fork it
|
23
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
24
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
25
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
26
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "rspec/core/rake_task"
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require "remindmeto/version"
|
4
|
+
|
5
|
+
task :default => :test
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
desc 'Run RSpec tests'
|
9
|
+
task :test => [:spec]
|
10
|
+
|
11
|
+
task :build do
|
12
|
+
`gem build remindmeto.gemspec`
|
13
|
+
end
|
14
|
+
|
15
|
+
task :install do
|
16
|
+
`gem install remindmeto-#{RemindMeTo::VERSION}.gem`
|
17
|
+
end
|
18
|
+
|
19
|
+
task :dev do
|
20
|
+
Rake::Task["build"].invoke
|
21
|
+
Rake::Task["install"].invoke
|
22
|
+
end
|
data/bin/remindmeto
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'remindmeto'
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'remindmeto/cli'
|
10
|
+
cli = RemindMeTo::CLI.new
|
11
|
+
cli.run
|
12
|
+
rescue Interrupt => e
|
13
|
+
puts '\nQuitting RemindMeTo...'
|
14
|
+
exit 1
|
15
|
+
rescue SystemExit => e
|
16
|
+
exit e.status
|
17
|
+
end
|
18
|
+
|
data/lib/remindmeto.rb
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'remindmeto/version'
|
2
|
+
require 'remindmeto/os'
|
3
|
+
require 'remindmeto/cli'
|
4
|
+
require 'remindmeto/normalizer'
|
5
|
+
require 'remindmeto/notifier'
|
6
|
+
require 'remindmeto/runner'
|
7
|
+
require 'remindmeto/notifier/notification_center_notifier'
|
8
|
+
require 'remindmeto/notifier/libnotify_notifier'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RemindMeTo
|
2
|
+
class CLI
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
@options = {}
|
6
|
+
end
|
7
|
+
|
8
|
+
def run(args = ARGV)
|
9
|
+
trap_interrupt
|
10
|
+
|
11
|
+
@options = Normalizer.new(args).process
|
12
|
+
Runner.new(@options).run
|
13
|
+
end
|
14
|
+
|
15
|
+
def trap_interrupt
|
16
|
+
Signal.trap('INT') do
|
17
|
+
exit!(1)
|
18
|
+
$stderr.puts
|
19
|
+
$stderr.puts 'Stopping remindmeto'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module RemindMeTo
|
2
|
+
class Normalizer
|
3
|
+
def initialize(args)
|
4
|
+
@args = args
|
5
|
+
@single_interval_keywords = %w{in after}
|
6
|
+
@rolling_interval_keywords = %w{every}
|
7
|
+
end
|
8
|
+
|
9
|
+
def process()
|
10
|
+
@keyword_idx = split_by_interval_keyword
|
11
|
+
|
12
|
+
options = {}
|
13
|
+
options[:message] = get_message
|
14
|
+
options[:interval] = get_interval
|
15
|
+
options[:repeat] = get_repeat
|
16
|
+
|
17
|
+
options
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def split_by_interval_keyword()
|
23
|
+
keyword_idx = 0
|
24
|
+
interval_keywords = [@single_interval_keywords, @rolling_interval_keywords].flatten
|
25
|
+
interval_keywords.each do |word|
|
26
|
+
idx = @args.rindex(word)
|
27
|
+
keyword_idx = idx unless (idx == nil || idx < keyword_idx)
|
28
|
+
end
|
29
|
+
|
30
|
+
abort_with_usage_message if keyword_idx == 0
|
31
|
+
keyword_idx
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_message
|
35
|
+
@args[0..@keyword_idx-1].join(' ')
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_interval
|
39
|
+
return 1 if @args.last.eql?('second')
|
40
|
+
return 60 if @args.last.eql?('minute')
|
41
|
+
return 3600 if @args.last.eql?('hour')
|
42
|
+
|
43
|
+
multiplier = @args[-2].to_i
|
44
|
+
abort_with_usage_message if multiplier == 0
|
45
|
+
|
46
|
+
interval = multiplier if @args.include?('seconds')
|
47
|
+
interval = 60*multiplier if @args.include?('minutes')
|
48
|
+
interval = 3600*multiplier if @args.include?('hours')
|
49
|
+
|
50
|
+
interval
|
51
|
+
end
|
52
|
+
|
53
|
+
def get_repeat
|
54
|
+
if @single_interval_keywords.include?(@args[@keyword_idx])
|
55
|
+
false
|
56
|
+
else
|
57
|
+
true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def abort_with_usage_message
|
62
|
+
abort("Usage: remindmeto { task } { every/in } { a(n)/time } { second(s)/minute(s)/hour(s) }")
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'remindmeto/notifier/notification_center_notifier'
|
2
|
+
require 'remindmeto/notifier/libnotify_notifier'
|
3
|
+
|
4
|
+
module RemindMeTo
|
5
|
+
class Notifier
|
6
|
+
def initialize()
|
7
|
+
if RemindMeTo::OS.mac?
|
8
|
+
@notifier = NotificationCenterNotifier.new
|
9
|
+
else RemindMeTo::OS.linux?
|
10
|
+
@notifier = LibnotifyNotifier.new
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def notify(message, opts = {})
|
15
|
+
@notifier.notify(message, opts)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'terminal-notifier' if RemindMeTo::OS.mac?
|
2
|
+
|
3
|
+
module RemindMeTo
|
4
|
+
class Notifier
|
5
|
+
class NotificationCenterNotifier
|
6
|
+
def notify(message, opts = {})
|
7
|
+
TerminalNotifier.notify('RemindMeTo', :title => message, :group => Process.pid)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
module RemindMeTo
|
4
|
+
module OS
|
5
|
+
module_function
|
6
|
+
|
7
|
+
def linux?
|
8
|
+
(/linux/ =~ RbConfig::CONFIG['host_os']) !=nil
|
9
|
+
end
|
10
|
+
|
11
|
+
def mac?
|
12
|
+
(/mac|darwin/ =~ RbConfig::CONFIG['host_os']) != nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def windows?
|
16
|
+
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RbConfig::CONFIG['host_os']) != nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def has_notification_center?
|
20
|
+
return false unless OS.mac?
|
21
|
+
|
22
|
+
full_version = `/usr/bin/sw_vers -productVersion`.to_s.chomp
|
23
|
+
version = /(10\.\d+)(\.\d+)?/.match(full_version).captures.first.to_f
|
24
|
+
return (version >= 10.8)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module RemindMeTo
|
2
|
+
class Runner
|
3
|
+
def initialize(options)
|
4
|
+
@options = options
|
5
|
+
@notifier = Notifier.new
|
6
|
+
@running = true
|
7
|
+
end
|
8
|
+
|
9
|
+
# The main run loop for displaying the notifications
|
10
|
+
def run
|
11
|
+
while(@running)
|
12
|
+
sleep(@options[:interval])
|
13
|
+
@notifier.notify(@options[:message], {})
|
14
|
+
@running = false unless @options[:repeat]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/remindmeto.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require 'remindmeto/os'
|
6
|
+
require 'remindmeto/version'
|
7
|
+
|
8
|
+
post_install_message = "\e[32mThis gem requires the libnotify1 package on Ubuntu. Install with:\e[0m\n"
|
9
|
+
post_install_message += "\t\e[31msudo apt-get install libnotify1\e[0m"
|
10
|
+
|
11
|
+
Gem::Specification.new do |spec|
|
12
|
+
spec.name = "remindmeto"
|
13
|
+
spec.version = RemindMeTo::VERSION
|
14
|
+
spec.authors = ["Hunter Clarke"]
|
15
|
+
spec.email = ["hunter@hunterc.com"]
|
16
|
+
spec.description = %q{A simple Ruby client for ubuntu notification reminders}
|
17
|
+
spec.summary = %q{Intuitive command-line reminders}
|
18
|
+
spec.homepage = "https://github.com/hclarke3/remindmeto"
|
19
|
+
spec.license = "MIT"
|
20
|
+
|
21
|
+
spec.files = `git ls-files`.split($/)
|
22
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
23
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
24
|
+
spec.require_paths = %w[lib]
|
25
|
+
spec.post_install_message = post_install_message
|
26
|
+
|
27
|
+
spec.add_runtime_dependency('terminal-notifier', '~> 1.5') if RemindMeTo::OS.mac?
|
28
|
+
spec.add_runtime_dependency('growl', '~> 1.0') if RemindMeTo::OS.mac? || RemindMeTo::OS.windows?
|
29
|
+
spec.add_runtime_dependency('libnotify', '~> 0.8') if RemindMeTo::OS.linux?
|
30
|
+
|
31
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
32
|
+
spec.add_development_dependency "rake", "~> 10.1"
|
33
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'remindmeto'
|
2
|
+
|
3
|
+
describe RemindMeTo::Normalizer do
|
4
|
+
describe '.split_by_interval_keyword' do
|
5
|
+
context 'given an interval keyword to split on' do
|
6
|
+
it 'returns the index of the interval keyword' do
|
7
|
+
arg = %w{remindmeto test in 10 seconds}
|
8
|
+
expect(RemindMeTo::Normalizer.split_by_interval_keyword(arg)).to eq 2
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: remindmeto
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hunter Clarke
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: terminal-notifier
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: growl
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.1'
|
69
|
+
description: A simple Ruby client for ubuntu notification reminders
|
70
|
+
email:
|
71
|
+
- hunter@hunterc.com
|
72
|
+
executables:
|
73
|
+
- remindmeto
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/remindmeto
|
83
|
+
- lib/remindmeto.rb
|
84
|
+
- lib/remindmeto/cli.rb
|
85
|
+
- lib/remindmeto/normalizer.rb
|
86
|
+
- lib/remindmeto/notifier.rb
|
87
|
+
- lib/remindmeto/notifier/libnotify_notifier.rb
|
88
|
+
- lib/remindmeto/notifier/notification_center_notifier.rb
|
89
|
+
- lib/remindmeto/os.rb
|
90
|
+
- lib/remindmeto/runner.rb
|
91
|
+
- lib/remindmeto/version.rb
|
92
|
+
- remindmeto.gemspec
|
93
|
+
- spec/remindmeto/normalizer_spec.rb
|
94
|
+
homepage: https://github.com/hclarke3/remindmeto
|
95
|
+
licenses:
|
96
|
+
- MIT
|
97
|
+
metadata: {}
|
98
|
+
post_install_message: "\e[32mThis gem requires the libnotify1 package on Ubuntu. Install
|
99
|
+
with:\e[0m\n\t\e[31msudo apt-get install libnotify1\e[0m"
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 2.2.0
|
116
|
+
signing_key:
|
117
|
+
specification_version: 4
|
118
|
+
summary: Intuitive command-line reminders
|
119
|
+
test_files:
|
120
|
+
- spec/remindmeto/normalizer_spec.rb
|