boppers 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa7603aeba00e7f11cba75e12f37cca989829f76
4
- data.tar.gz: 414a3d4ead4c1e10ff9529e698db061b28eb7cbb
3
+ metadata.gz: d57b01f4de1f2472c5b6ee6c84c698aad3f6a302
4
+ data.tar.gz: 6cdeb3cb8e621ad6e218bae54f7b6448ce861739
5
5
  SHA512:
6
- metadata.gz: 47bead4a40ac0e6fa9a400e29a3063cc8f4d07b5bd41bb2289b284689f887aebbc12f210ad72aa912e6339c3ffcda12d6497c1f2632802ce53d98cf6b00b7917
7
- data.tar.gz: 6c049868564e9c6b303ae86de396035ab01b72cc62b40503207e91bc376df08d8551a91d82aeb71e09a287957218c48efc2a10729f467bf0c8bf51ea2294797f
6
+ metadata.gz: 6b136924d3bc70057a24d7ad093615dfd8a6d3264758128ffd1faec58d63f2c4a2dd83d7af56b626665c23adc812f53560e980bd4f23f2d0c29d9bf7f54d0db2
7
+ data.tar.gz: 8d830fe8c126c43ced453346dcc3261fbb88b7cbe8ac9bd651d37e58f3bc9a635d012a06cd2a721a0c9796f64e9d6bf195ff90e835d0bbdb8784fe690392ed8e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- boppers (0.0.2)
4
+ boppers (0.0.3)
5
5
  aitch
6
6
  thor
7
7
 
@@ -31,9 +31,12 @@ module Boppers
31
31
  end
32
32
 
33
33
  def self.subscribed?(notifier, name)
34
- subscriptions = [notifier.subscribe] if notifier.respond_to?(:subscribe)
35
- subscriptions ||= [name]
36
- subscriptions = subscriptions.flatten.map(&:to_sym)
34
+ subscriptions = if notifier.respond_to?(:subscribe)
35
+ [notifier.subscribe || name]
36
+ else
37
+ [name]
38
+ end
39
+ subscriptions = subscriptions.flatten.compact.map(&:to_sym)
37
40
 
38
41
  subscriptions.include?(name)
39
42
  end
@@ -3,6 +3,11 @@
3
3
  module Boppers
4
4
  module Notifier
5
5
  class Slack
6
+ COLORS = {
7
+ green: "good",
8
+ red: "danger"
9
+ }.freeze
10
+
6
11
  attr_reader :api_token, :channel, :subscribe
7
12
 
8
13
  def initialize(api_token:, channel:, subscribe: nil)
@@ -22,7 +27,7 @@ module Boppers
22
27
  fallback: message,
23
28
  title: subject,
24
29
  text: message,
25
- color: options[:color]
30
+ color: COLORS.fetch(options[:color])
26
31
  }
27
32
  ]
28
33
  )
@@ -3,17 +3,24 @@
3
3
  module Boppers
4
4
  module Notifier
5
5
  class Stdout
6
+ COLORS = {
7
+ green: "\e[32m",
8
+ red: "\e[31m"
9
+ }.freeze
10
+
6
11
  attr_reader :subscribe
7
12
 
8
13
  def initialize(subscribe: nil)
9
14
  @subscribe = subscribe
10
15
  end
11
16
 
12
- def call(title, message, *)
17
+ def call(title, message, options)
18
+ color = COLORS.fetch(options[:color], "\e[0m")
19
+
13
20
  puts [
14
- "## #{title}",
21
+ "#{color}## #{title}",
15
22
  message.gsub(/^/m, " "),
16
- "\n"
23
+ "\e[0m\n"
17
24
  ].join("\n")
18
25
  end
19
26
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Boppers
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boppers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira