rcr-notify 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
data/bin/rcr-notify CHANGED
@@ -8,16 +8,27 @@ OptionParser.new do |opts|
8
8
  opts.banner = "Usage: #{$0} [options]"
9
9
  opts.instance_eval do
10
10
  on("-u", "--user USERNAME", "Runcoderun Username") {|u| notifier.settings[:username] = u }
11
- on("-i", "--interval INTERVAL", Numeric, "Polling interval in seconds (default: 30)") do |i|
11
+ on("-i", "--interval INTERVAL", Numeric, "Polling interval in seconds", " (default: 30)") do |i|
12
12
  notifier.settings[:interval] = i
13
13
  end
14
+ on("-e", "--except x,y,z", Array, "Projects to ignore", " (mutually exclusive to -o)") do |projects|
15
+ notifier.settings[:blacklist] = projects
16
+ end
17
+ on("-o", "--only a,b,c", Array, "Only notify of these build", " (mutually exclusive to -e)") do |projects|
18
+ notifier.settings[:whitelist] = projects
19
+ end
14
20
  on_tail("--help", "This message") {puts opts; exit}
15
21
  end
16
22
  end.parse!
17
23
 
18
24
  unless notifier.settings[:username]
19
25
  puts "at least username is required. see --help"
20
- exit
26
+ exit -1
27
+ end
28
+
29
+ if notifier.settings[:whitelist] && notifier.settings[:blacklist]
30
+ puts "Options --except (-e) and --only (-o) are mutually exclusive.\nSupply one or the other."
31
+ exit -1
21
32
  end
22
33
 
23
34
  loop do
data/lib/rcr-notify.rb CHANGED
@@ -24,7 +24,7 @@ module RcrNotify
24
24
 
25
25
  if last_projects
26
26
  projects.each do |name, this_time|
27
- notify_for name, last_projects[name], this_time
27
+ notify_for name, last_projects[name], this_time if notify_for? name
28
28
  end
29
29
  end
30
30
 
@@ -35,8 +35,18 @@ module RcrNotify
35
35
 
36
36
  private
37
37
 
38
+ def notify_for?(name)
39
+ if settings[:blacklist]
40
+ !settings[:blacklist].include? name
41
+ elsif settings[:whitelist]
42
+ settings[:whitelist].include? name
43
+ else
44
+ true
45
+ end
46
+ end
47
+
38
48
  def notify_for(name, last_time, this_time)
39
- return if this_time['commit'] == last_time['commit']
49
+ # return if this_time['commit'] == last_time['commit']
40
50
 
41
51
  commit_message = "#{this_time['commit_message']}\n" +
42
52
  "\t\t—#{this_time['author_name']}"
data/rcr-notify.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rcr-notify}
8
- s.version = "0.1.5"
8
+ s.version = "0.1.6"
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"]
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.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Rothstein