ci_slack 0.0.1 → 0.0.2

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: 7dbe8d3568f5028370b10d1325f89ca53e5c202c
4
- data.tar.gz: 17fd30f8ec151788d7fa1056ef88fa5d3c6365d5
3
+ metadata.gz: 8dd6080849e524768a895b23a0de8e9cef4aba5c
4
+ data.tar.gz: 2cb3a574cc6ccf1a6bcc1cc78d45b91e4ca30381
5
5
  SHA512:
6
- metadata.gz: 9d0430962ced5535065d5be9ccd85b48559b3178f3e1a3bd0ede1aae88176dde2b16368bfbbba566c446cfe93ad9d4b9109af4b4ff6feb8c7d2a75c41f47f692
7
- data.tar.gz: 6f544cd2453e9553ed3d0c2bf89305528437792f5657dec16aed30b6f58eb773b2c0ea5e6e670fd243b6fdd1fcab75c9367a22f33a656cabae0de69cd87988b4
6
+ metadata.gz: d770339dfaf4d44be06b5c7fd8020ed58124ea1dd8e9169df8a2f09f335ceae686ca95f8b032b67be551f51fa88cd7e8ba726ea67ab497f4506069a38e49e5cb
7
+ data.tar.gz: 60f3659efadefea3dd298eb800492e57799b3fecebb80d1448fdd3064a828dade54df0acb87d82873856a69abc80581b89b4e2667ef59fa35b32d747200fb209
@@ -1,14 +1,16 @@
1
- class CiSlack::Configuration
2
- attr_accessor :icon, :webhook, :channel, :ci_computer,
3
- :bot_name, :project, :slack_names
1
+ module CiSlack
2
+ class Configuration
3
+ attr_accessor :icon, :webhook, :channel, :ci_computer,
4
+ :bot_name, :project, :slack_names
4
5
 
5
- def initialize
6
- @icon = 'failed'
7
- @webhook = ''
8
- @channel = '#ci'
9
- @bot_name = 'CI BOT'
10
- @project = ''
11
- @slack_names = {}
12
- @ci_computer = 'CI'
6
+ def initialize
7
+ @icon = 'failed'
8
+ @webhook = ''
9
+ @channel = '#ci'
10
+ @bot_name = 'CI BOT'
11
+ @project = ''
12
+ @slack_names = {}
13
+ @ci_computer = 'CI'
14
+ end
13
15
  end
14
16
  end
@@ -1,36 +1,38 @@
1
1
  require 'slack-notifier'
2
2
  require 'ci_slack'
3
3
 
4
- class CiSlack::Messager
5
- attr_reader :client, :project
4
+ module CiSlack
5
+ class Messager
6
+ attr_reader :client, :project
6
7
 
7
- def initialize
8
- @client = ::Slack::Notifier.new(webhook, channel: channel, username: bot_name)
9
- end
8
+ def initialize
9
+ @client = ::Slack::Notifier.new(webhook, channel: channel, username: bot_name)
10
+ end
10
11
 
11
- def send(message)
12
- return unless ENV[ci_computer.to_s]
12
+ def send(message)
13
+ return unless ENV[ci_computer.to_s]
13
14
 
14
- author, commit_message = last_git_log
15
- slack_name = slack_names.select { |key, _| author.downcase =~ key }.values.first || author
15
+ author, commit_message = last_git_log
16
+ slack_name = slack_names.select { |key, _| author.downcase =~ key }.values.first || author
16
17
 
17
- text = "#{ project }. CI FAILED!\n<@#{ slack_name }> : #{ commit_message } \n#{ message }"
18
+ text = "#{ project }. CI FAILED!\n<@#{ slack_name }> : #{ commit_message } \n#{ message }"
18
19
 
19
- client.post(text: text, icon_emoji: ":#{ icon }:")
20
- end
20
+ client.post(text: text, icon_emoji: ":#{ icon }:")
21
+ end
21
22
 
22
- def method_missing(method, *args)
23
- if %i[icon webhook channel ci_computer
24
- bot_name project slack_names].include?(method)
25
- CiSlack.configuration.send(method)
26
- else
27
- super
23
+ def method_missing(method, *args)
24
+ if %i[icon webhook channel ci_computer
25
+ bot_name project slack_names].include?(method)
26
+ CiSlack.configuration.send(method)
27
+ else
28
+ super
29
+ end
28
30
  end
29
- end
30
31
 
31
- private
32
+ private
32
33
 
33
- def last_git_log
34
- `git log -1 --pretty='%an||%s'`.split('||').map(&:strip)
34
+ def last_git_log
35
+ `git log -1 --pretty='%an||%s'`.split('||').map(&:strip)
36
+ end
35
37
  end
36
38
  end
@@ -1,3 +1,3 @@
1
1
  module CiSlack
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci_slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - skrinits
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-26 00:00:00.000000000 Z
11
+ date: 2017-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slack-notifier