notifaction 0.3.0.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77df94c1102f5000ccf7ed328b995f6b00959421
4
- data.tar.gz: d4cafdd7d6cd7282e158c6e5759bc7e605e70699
3
+ metadata.gz: a9c48372819fc5caf672f85d8771cc8133c6db6f
4
+ data.tar.gz: 904d9e2f65ba36b8b7cc7630b6b1d9d2cbc9893d
5
5
  SHA512:
6
- metadata.gz: 595feaf6b98cea3fb016df821b678800db211e5b69b7b1995ea724a8bacb0018549d17810c7a36c82c735e0691242f9ccfa6b6fc61b295cbec8ecc0f72558c72
7
- data.tar.gz: a47f2a2474241f442f88193b34ac53c9f3fa269a26379b32493b4e2a20bdc98e319c2a1ad4ebc8ecfe3f198a0b1354fb4c3b4d11296ad91be179e4fb21314193
6
+ metadata.gz: f6cbf68833817f4f0d58bcf49e4f723ad3ed997425f8b587760ce3a84402dd4432fb3ebf6e93b2a066b5afe66e3d0d69e8b842298a6bff046e0184a927a9d937
7
+ data.tar.gz: 86eb64d5339ff7af1dddab00f9a2d962cfb498a9f4a6a7ae785551aa9f9e8174e962a1e36cfb4708a4a0a8f711930aba76ee655aeb9b91ff9c3aab97741181e9
data/README.md CHANGED
@@ -14,9 +14,9 @@ require 'notifaction'
14
14
  # Other methods:
15
15
  # - success (green)
16
16
  # - info (blue)
17
- # - sinfo (light blue)
17
+ # - note (light blue)
18
18
  # - warning (yellow)
19
- # - spit (white)
19
+ # - spit (no colour/white)
20
20
  begin
21
21
  call_method
22
22
  rescue => e
@@ -27,11 +27,15 @@ end
27
27
  if install_successful
28
28
  Notify.bubble("You can now proceed to use our software...", "Install Successful")
29
29
  end
30
+ ```
30
31
 
31
- # Plugins extend the base notification functionality, sending messages to
32
- # online services
33
- # This example updates your status on https://www.workingon.co/
34
- if task.complete
35
- Notify.wo("Task complete: #{task}")
36
- end
37
- ```
32
+ Plugins extend the base notification functionality, sending messages to online services. This example will show you how to send log information to a 3rd party service.
33
+
34
+ ```ruby
35
+ # ~/.notifaction.yml
36
+
37
+ hooks:
38
+ - "https://api.yourwebsite.com/messages/receive?token=1am4t0k3n"
39
+ ```
40
+
41
+ That's it. You will start receiving POST requests at the URL(s) listed in the `hooks` section of the configuration file.
@@ -2,7 +2,7 @@ require "yaml"
2
2
 
3
3
  module Notifaction
4
4
  class Cfg
5
- attr_accessor :hooks, :conf
5
+ attr_reader :hooks, :conf
6
6
 
7
7
  def initialize
8
8
  conf = YAML::load(File.open(Dir.home + '/.notifaction.yml'))
@@ -4,7 +4,7 @@ require "uri"
4
4
  module Notifaction
5
5
  module Type
6
6
  class Base
7
- attr_accessor :user_conf
7
+ attr_reader :user_conf
8
8
 
9
9
  #
10
10
  # @since 0.3.0.1
@@ -27,16 +27,24 @@ module Notifaction
27
27
  #
28
28
  # @since 0.3.0
29
29
  def fire_hooks(payload)
30
- hooks = @user_conf.hooks
30
+ mux = Mutex.new
31
31
 
32
- return if hooks.nil?
32
+ th = Thread.new do
33
+ mux.synchronize do
34
+ hooks = @user_conf.hooks
33
35
 
34
- hooks.each do |uri|
35
- uri = URI.parse(uri)
36
+ return if hooks.nil?
36
37
 
37
- response = Net::HTTP.post_form(uri, payload)
38
- response.code.to_i < 300
39
- end
38
+ hooks.each do |uri|
39
+ uri = URI.parse(uri)
40
+
41
+ response = Net::HTTP.post_form(uri, payload)
42
+ response.code.to_i < 300
43
+ end
44
+ end
45
+ end.join.exit
46
+
47
+ th.status == false
40
48
  end
41
49
  end
42
50
  end
@@ -1,3 +1,3 @@
1
1
  module Notifaction
2
- VERSION = "0.3.0.1".freeze
2
+ VERSION = "0.4.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notifaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Яyan Priebe