checkzilla 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/checkzilla/model.rb +7 -2
- data/lib/checkzilla/notifier/notify_send.rb +25 -0
- metadata +4 -2
data/lib/checkzilla/model.rb
CHANGED
@@ -20,11 +20,16 @@ module CheckZilla
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def check_updates klass, &block
|
23
|
-
@checkers << CheckZilla::Check.const_get(klass.to_s
|
23
|
+
@checkers << CheckZilla::Check.const_get(camelize(klass.to_s)).new(&block)
|
24
24
|
end
|
25
25
|
|
26
26
|
def notify_by klass, &block
|
27
|
-
@notifiers << CheckZilla::Notifier.const_get(klass.to_s
|
27
|
+
@notifiers << CheckZilla::Notifier.const_get(camelize(klass.to_s)).new(&block)
|
28
28
|
end
|
29
|
+
|
30
|
+
private
|
31
|
+
def camelize(term)
|
32
|
+
term.split(/[^a-z0-9]/i).map{|w| w.capitalize}.join
|
33
|
+
end
|
29
34
|
end
|
30
35
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module CheckZilla
|
2
|
+
module Notifier
|
3
|
+
class NotifySend
|
4
|
+
|
5
|
+
def initialize &block
|
6
|
+
self
|
7
|
+
end
|
8
|
+
|
9
|
+
def perform! checkers
|
10
|
+
checkers.each do |checker|
|
11
|
+
checker_name = checker.class.name.split("::").last
|
12
|
+
title = "CheckZilla: #{checker_name}"
|
13
|
+
|
14
|
+
body = []
|
15
|
+
checker.results.each do |name, versions|
|
16
|
+
local_version = versions[0]
|
17
|
+
newer_version = versions[1]
|
18
|
+
body << "#{name} (#{local_version} -> #{newer_version})"
|
19
|
+
end
|
20
|
+
`notify-send -u normal "#{title}" "#{body.join(', ')}"` if body.size > 0
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: checkzilla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: clamp
|
@@ -86,6 +86,7 @@ extra_rdoc_files: []
|
|
86
86
|
files:
|
87
87
|
- ./lib/checkzilla.rb
|
88
88
|
- ./lib/checkzilla/notifier/email.rb
|
89
|
+
- ./lib/checkzilla/notifier/notify_send.rb
|
89
90
|
- ./lib/checkzilla/notifier/console.rb
|
90
91
|
- ./lib/checkzilla/notifier/hipchat.rb
|
91
92
|
- ./lib/checkzilla/check/npm.rb
|
@@ -120,3 +121,4 @@ signing_key:
|
|
120
121
|
specification_version: 3
|
121
122
|
summary: CLI allowing to check and be notified of outdated software
|
122
123
|
test_files: []
|
124
|
+
has_rdoc:
|