rcr-notify 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/{README.rdoc → README.textile} +18 -4
- data/VERSION +1 -1
- data/bin/rcr-notify +10 -4
- data/lib/rcr-notify.rb +4 -2
- data/rcr-notify.gemspec +4 -4
- metadata +4 -4
@@ -1,8 +1,22 @@
|
|
1
|
-
|
1
|
+
h1. rcr-notify: Growl notification for run>code>run
|
2
2
|
|
3
|
-
|
3
|
+
h2. Installation
|
4
4
|
|
5
|
-
|
5
|
+
* Install "Growl":http://growl.info/
|
6
|
+
* In the network tab of growl settings, check
|
7
|
+
** Listen for incoming notifications AND
|
8
|
+
** Allow remote application registration
|
9
|
+
* Install the gem: @sudo gem install rcr-notify@
|
10
|
+
|
11
|
+
h2. Running
|
12
|
+
|
13
|
+
@rcr-notify -u <rcr username>&@
|
14
|
+
|
15
|
+
See @rcr-notify --help@ for more options.
|
16
|
+
|
17
|
+
h3. That's it!
|
18
|
+
|
19
|
+
h2. Note on Patches/Pull Requests
|
6
20
|
|
7
21
|
* Fork the project.
|
8
22
|
* Make your feature addition or bug fix.
|
@@ -13,6 +27,6 @@ Description goes here.
|
|
13
27
|
bump version in a commit by itself I can ignore when I pull)
|
14
28
|
* Send me a pull request. Bonus points for topic branches.
|
15
29
|
|
16
|
-
|
30
|
+
h2. Copyright
|
17
31
|
|
18
32
|
Copyright (c) 2009 Jacob Rothstein. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/bin/rcr-notify
CHANGED
@@ -2,13 +2,14 @@
|
|
2
2
|
require File.instance_eval{expand_path(join(dirname(__FILE__), '..', 'lib', 'rcr-notify'))}
|
3
3
|
|
4
4
|
notifier = RcrNotify::Notifier.new
|
5
|
+
STDOUT.sync = true
|
5
6
|
|
6
7
|
OptionParser.new do |opts|
|
7
8
|
opts.banner = "Usage: #{$0} [options]"
|
8
9
|
opts.instance_eval do
|
9
10
|
on("-u", "--user USERNAME", "Runcoderun Username") {|u| notifier.settings[:username] = u }
|
10
|
-
on("-i", "--interval INTERVAL", "Polling interval in seconds (default: 30)") do |i|
|
11
|
-
notifier.settings[:interval] = i
|
11
|
+
on("-i", "--interval INTERVAL", Numeric, "Polling interval in seconds (default: 30)") do |i|
|
12
|
+
notifier.settings[:interval] = i
|
12
13
|
end
|
13
14
|
on_tail("--help", "This message") {puts opts; exit}
|
14
15
|
end
|
@@ -20,6 +21,11 @@ unless notifier.settings[:username]
|
|
20
21
|
end
|
21
22
|
|
22
23
|
loop do
|
23
|
-
|
24
|
-
|
24
|
+
begin
|
25
|
+
notifier.poll
|
26
|
+
sleep notifier.settings[:interval]
|
27
|
+
rescue Interrupt
|
28
|
+
puts "\nTerminated #{Time.now}"
|
29
|
+
exit
|
30
|
+
end
|
25
31
|
end
|
data/lib/rcr-notify.rb
CHANGED
@@ -14,6 +14,7 @@ module RcrNotify
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def poll
|
17
|
+
print '.'
|
17
18
|
data = JSON::parse open(url).read
|
18
19
|
|
19
20
|
projects = data["user"]["projects"].inject({}) do |hash, project|
|
@@ -34,7 +35,7 @@ module RcrNotify
|
|
34
35
|
def notify_for(name, last_time, this_time)
|
35
36
|
return if this_time['commit'] == last_time['commit']
|
36
37
|
|
37
|
-
commit_message = "
|
38
|
+
commit_message = "#{this_time['commit_message']}\n" +
|
38
39
|
"\t\t—#{this_time['author_name']}"
|
39
40
|
|
40
41
|
title = if success?(this_time)
|
@@ -47,7 +48,7 @@ module RcrNotify
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def success?(hash)
|
50
|
-
hash["status"] == "success"
|
51
|
+
hash && hash["status"] == "success"
|
51
52
|
end
|
52
53
|
|
53
54
|
def url
|
@@ -56,6 +57,7 @@ module RcrNotify
|
|
56
57
|
|
57
58
|
def notify(title, body, success)
|
58
59
|
type = success ? 'success' : 'failure'
|
60
|
+
puts "\n\n#{title} (#{type})\n#{body}\n\n"
|
59
61
|
@growl.notify type, title, body
|
60
62
|
end
|
61
63
|
end
|
data/rcr-notify.gemspec
CHANGED
@@ -5,24 +5,24 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rcr-notify}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jacob Rothstein"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-30}
|
13
13
|
s.default_executable = %q{rcr-notify}
|
14
14
|
s.description = %q{Simple json poller with ruby-growl notification}
|
15
15
|
s.email = %q{github@jacobrothstein.com}
|
16
16
|
s.executables = ["rcr-notify"]
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE",
|
19
|
-
"README.
|
19
|
+
"README.textile"
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
23
|
".gitignore",
|
24
24
|
"LICENSE",
|
25
|
-
"README.
|
25
|
+
"README.textile",
|
26
26
|
"Rakefile",
|
27
27
|
"VERSION",
|
28
28
|
"bin/rcr-notify",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rcr-notify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jacob Rothstein
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-30 00:00:00 -08:00
|
13
13
|
default_executable: rcr-notify
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -40,12 +40,12 @@ extensions: []
|
|
40
40
|
|
41
41
|
extra_rdoc_files:
|
42
42
|
- LICENSE
|
43
|
-
- README.
|
43
|
+
- README.textile
|
44
44
|
files:
|
45
45
|
- .document
|
46
46
|
- .gitignore
|
47
47
|
- LICENSE
|
48
|
-
- README.
|
48
|
+
- README.textile
|
49
49
|
- Rakefile
|
50
50
|
- VERSION
|
51
51
|
- bin/rcr-notify
|