integrity-notifyio 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{integrity-notifyio}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew Kalek"]
12
- s.date = %q{2010-07-14}
12
+ s.date = %q{2010-07-15}
13
13
  s.description = %q{Let Integrity post notifications to your Notifiy.io account after each build}
14
14
  s.email = %q{andrew.kalek@anlek.com}
15
15
  s.extra_rdoc_files = [
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
  "Rakefile",
26
26
  "VERSION",
27
27
  "integrity-notifyio.gemspec",
28
- "lib/integrity/notifier/config.haml",
28
+ "lib/integrity/notifier/notifyio.haml",
29
29
  "lib/integrity/notifier/notifyio.rb",
30
30
  "test/integrity-notifyio_test.rb",
31
31
  "test/test_helper.rb"
@@ -6,3 +6,7 @@
6
6
  %p.normal
7
7
  %label{ :for => "notifyio_notifier_api_key" } API key
8
8
  %input.text#notifyio_notifier_api_key{ :name => "notifiers[Notifyio][api_key]", :value => config['api_key'], :type => 'text' }
9
+
10
+ %p.normal
11
+ %label{ :for => "notifyio_notifier_announce_success" } Notify on success?
12
+ %input#notifyio_notifier_announce_success{ :name => "notifiers[Notifyio][announce_success]", :type => "checkbox", :checked => config['announce_success'], :value => "1" }
@@ -7,23 +7,38 @@ module Integrity
7
7
  attr_reader :config
8
8
 
9
9
  def self.to_haml
10
- @haml ||= File.read(File.dirname(__FILE__) + "/config.haml")
10
+ @haml ||= File.read(File.dirname(__FILE__) + "/notifyio.haml")
11
11
  end
12
12
 
13
13
  def deliver!
14
- post(config['email'], config['api_key'], short_message, full_message)
14
+ post(config['email'], config['api_key'], short_message, full_message) if announce_build?
15
15
  end
16
16
 
17
17
  def to_s
18
18
  'Notifyio'
19
19
  end
20
20
 
21
+ #######
21
22
  private
23
+ #######
24
+
25
+ def full_message
26
+ <<-EOM
27
+ == #{short_message}
28
+
29
+ Commit Message: #{build.commit.message}
30
+ Commit Date: #{build.commit.committed_at}
31
+ Commit Author: #{build.commit.author.name}
32
+
33
+ Link: #{build_url}
34
+
35
+ EOM
36
+ end
22
37
 
23
38
  def post(emails, api_key, title, body)
24
- return if emails.nil? || email.empty? || api_key.nil? || api_key.empty?
39
+ return if emails.nil? || emails.empty? || api_key.nil? || api_key.empty?
25
40
  emails.split(',').each do |email|
26
- email_hash = MD5.hexdigest(email.strip!)
41
+ email_hash = MD5.hexdigest(email.strip)
27
42
  HTTParty.post "http://api.notify.io/v1/notify/#{email_hash}", :headers => {'content-type' => 'application/x-www-form-urlencoded'},
28
43
  :body => {:api_key => api_key},
29
44
  :query => {
@@ -35,6 +50,10 @@ module Integrity
35
50
  end
36
51
  end
37
52
 
53
+ def announce_build?
54
+ build.failed? || config["announce_success"]
55
+ end
56
+
38
57
  end
39
58
 
40
59
  register Notifyio
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: integrity-notifyio
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Kalek
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-14 00:00:00 -04:00
18
+ date: 2010-07-15 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -64,7 +64,7 @@ files:
64
64
  - Rakefile
65
65
  - VERSION
66
66
  - integrity-notifyio.gemspec
67
- - lib/integrity/notifier/config.haml
67
+ - lib/integrity/notifier/notifyio.haml
68
68
  - lib/integrity/notifier/notifyio.rb
69
69
  - test/integrity-notifyio_test.rb
70
70
  - test/test_helper.rb