cruisecontrolrb-to-slack 0.0.2 → 0.2.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: 65a82491694a02f9af02772f49dab68ea23305ee
4
- data.tar.gz: 57bb0f0857ab28738502cb72b448e6f1c5c39e55
3
+ metadata.gz: 09e6788b23cc2d349cb43f80d44ce77910973baf
4
+ data.tar.gz: 30cf3f748b51cb3dea72eb01ceb17a22f7ae0ede
5
5
  SHA512:
6
- metadata.gz: 4445067d5ab28c6d39e9e43030971cab1b8e2e23c435b7cc67ae83eec365abf5b9bdfe86119fe5fbfaa57b9662d10326606350b43737a3f1d5fd2f298d6f6f50
7
- data.tar.gz: b48076ff09375e02d7ec1b342008c23737108cef75befdddf7932453a9572e599ec99ccff5eca3f725fb4359eadf3016e82d4db2b4a8cfe12a495f8d7a0c392c
6
+ metadata.gz: e0909c8d54417f8fcf900a9abf7f7915905f2d7c1481363f083f94c5bc403e1d89acc8366cc88ad5326da7154480a38e525c9cc295069685a5f2c3186d675d2f
7
+ data.tar.gz: 605e4dee72e0ed40e8d85e3c1a6d46c3870cbc25bb8f283c41a725a03d2a42e8a79be18c67a83fa913a46ec0eba5485a0aba675e2bda53a4c146cf0a21e25cb4
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .idea
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## 0.2.0
2
+ Switch to webhook for slack
3
+
4
+ ## 0.1.0
5
+ Initial Release
data/Gemfile.lock CHANGED
@@ -1,30 +1,37 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cruisecontrolrb-to-slack (0.0.1)
4
+ cruisecontrolrb-to-slack (0.1.0)
5
5
  dante (~> 0.2.0)
6
6
  httparty (~> 0.13.1)
7
7
  nokogiri (~> 1.6.2)
8
8
  rufus-scheduler
9
- slack-notifier (~> 0.6.0)
9
+ slack-notifier (~> 1.0.0)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
+ coderay (1.1.0)
14
15
  dante (0.2.0)
15
- httparty (0.13.1)
16
+ httparty (0.13.3)
16
17
  json (~> 1.8)
17
18
  multi_xml (>= 0.5.2)
18
- json (1.8.1)
19
- mini_portile (0.6.0)
20
- minitest (4.7.5)
19
+ json (1.8.2)
20
+ method_source (0.8.2)
21
+ mini_portile (0.6.2)
22
+ minitest (5.5.1)
21
23
  multi_xml (0.5.5)
22
- nokogiri (1.6.3.1)
23
- mini_portile (= 0.6.0)
24
- rake (10.3.2)
24
+ nokogiri (1.6.5)
25
+ mini_portile (~> 0.6.0)
26
+ pry (0.10.1)
27
+ coderay (~> 1.1.0)
28
+ method_source (~> 0.8.1)
29
+ slop (~> 3.4)
30
+ rake (10.4.2)
25
31
  rufus-scheduler (3.0.9)
26
32
  tzinfo
27
- slack-notifier (0.6.0)
33
+ slack-notifier (1.0.0)
34
+ slop (3.6.0)
28
35
  thread_safe (0.3.4)
29
36
  tzinfo (1.2.2)
30
37
  thread_safe (~> 0.1)
@@ -36,4 +43,5 @@ DEPENDENCIES
36
43
  bundler (~> 1.6)
37
44
  cruisecontrolrb-to-slack!
38
45
  minitest
46
+ pry
39
47
  rake
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ Now supports the new Webhook method of interacting with Slack.
2
+
1
3
  This is a little app notifies Slack of any changes in the build status on your CruiseControl.rb install.
2
4
  It also support github as a source code repository to link to a commit. Other can easily be extended if needed
3
5
 
@@ -33,8 +35,7 @@ Make sure to define the following environment variable as they are required in e
33
35
  you `.profile` or `/etc/profile.d/cruisecontrolrc-to-slack.sh` (for all users)
34
36
 
35
37
  ```
36
- SLACK_TEAM=team # the team name (first part of the host in the incoming hook url)
37
- SLACK_HOOK_TOKEN=your_auth_token # the incoming web_hook token
38
+ SLACK_WEBHOOK_URL=webhook_url # the webhook url you received from Slack
38
39
  CC_URL=your_cruise_control_url
39
40
  ```
40
41
 
@@ -76,4 +77,4 @@ cruisecontrolrb-to-slack -l /var/log/myapp.log
76
77
  cruisecontrolrb-to-slack -d -P /var/run/myapp.pid -l /var/log/myapp.log
77
78
  ```
78
79
 
79
- <img width="100px" src="http://1.bp.blogspot.com/-VYkLIx6dPTE/TapmnuECsJI/AAAAAAAAALY/L3c1FY4v--w/s1600/looney_tunes_thats_all_folks.jpg" />
80
+ <img width="100px" src="http://1.bp.blogspot.com/-VYkLIx6dPTE/TapmnuECsJI/AAAAAAAAALY/L3c1FY4v--w/s1600/looney_tunes_thats_all_folks.jpg" />
@@ -4,19 +4,17 @@ require 'cruisecontrolrb-to-slack'
4
4
 
5
5
  Dante.run('myapp') do |opts|
6
6
  raise 'Missing required Cruisecontrol host: export CC_HOST=<your_cc_host>' unless host = ENV["CC_HOST"]
7
- raise 'Missing required Slack api token, export SLACK_HOOK_TOKEN=<token>' unless token = ENV["SLACK_HOOK_TOKEN"]
8
- raise 'Missing required Slack api token, export SLACK_TEAM=<team>' unless team = ENV["SLACK_TEAM"]
9
- user = ENV["SLACK_USERNAME"]
7
+ raise 'Missing required Slack webhook url, export SLACK_WEBHOOK_URL=<webhook url>' unless webhook = ENV["SLACK_WEBHOOK_URL"]
8
+ user = ENV["SLACK_USERNAME"]
10
9
  channel = ENV["SLACK_CHANNEL"]
11
10
 
12
11
  options = {cc_host: host,
13
12
  cc_username: ENV["CC_USERNAME"] || "",
14
13
  cc_password: ENV["CC_PASSWORD"] || "",
15
- slack_team: team,
16
- slack_hook_token: token,
14
+ slack_webhook_url: webhook,
17
15
  slack_channel: channel ,
18
- slack_user: user,
16
+ slack_user: user,
19
17
  polling_interval: ENV["POLLING_INTERVAL"] || 5}
20
18
 
21
19
  CruisecontrolrbToSlack::Runner.run(options)
22
- end
20
+ end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_dependency "dante", "~> 0.2.0"
23
- spec.add_dependency "slack-notifier", "~> 0.6.0"
23
+ spec.add_dependency "slack-notifier", "~> 1.0.0"
24
24
  spec.add_dependency "nokogiri", "~> 1.6.2"
25
25
  spec.add_dependency "httparty", "~> 0.13.1"
26
26
  spec.add_dependency "rufus-scheduler"
@@ -28,5 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "bundler", "~> 1.6"
29
29
  spec.add_development_dependency "rake"
30
30
  spec.add_development_dependency "minitest"
31
+ spec.add_development_dependency "pry"
31
32
 
32
33
  end
@@ -2,11 +2,11 @@ module CruisecontrolrbToSlack
2
2
  class SlackClient
3
3
  attr_reader :client
4
4
 
5
- def initialize(team, token, options = {})
5
+ def initialize(webhook, options = {})
6
6
  user = options[:user] || 'cruisecontrol'
7
7
  channel = options[:channel] || '#general'
8
8
 
9
- @client = Slack::Notifier.new team, token, channel: channel, username: user
9
+ @client = Slack::Notifier.new webhook, channel: channel, username: user
10
10
  end
11
11
 
12
12
  #
@@ -17,4 +17,4 @@ module CruisecontrolrbToSlack
17
17
  end
18
18
 
19
19
  end
20
- end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module CruisecontrolrbToSlack
2
- VERSION = "0.0.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -36,7 +36,6 @@ module CruisecontrolrbToSlack
36
36
 
37
37
  def check_statuses
38
38
  statuses = cc_client.fetch_statuses
39
-
40
39
  unless statuses.empty?
41
40
 
42
41
  statuses.each do |status_hash|
@@ -98,7 +97,7 @@ module CruisecontrolrbToSlack
98
97
  end
99
98
 
100
99
  def slack_client
101
- @slack_client ||= SlackClient.new(config[:slack_team], config[:slack_hook_token],
100
+ @slack_client ||= SlackClient.new(config[:slack_webhook_url],
102
101
  channel: config[:slack_channel], user: config[:slack_user])
103
102
  end
104
103
 
@@ -1,19 +1,17 @@
1
1
  require 'test_helper'
2
+ require 'pry'
2
3
 
3
4
  describe CruisecontrolrbToSlack::SlackClient do
4
- subject{CruisecontrolrbToSlack::SlackClient.new('team', 'token')}
5
+ subject{CruisecontrolrbToSlack::SlackClient.new('http://url.to/webhook')}
5
6
 
6
7
  it 'should use the default a new instance' do
7
8
  subject.client.must_be_kind_of Slack::Notifier
8
9
  end
9
10
 
10
11
  it 'should set the team properly' do
11
- subject.client.team.must_equal 'team'
12
+ subject.client.endpoint.to_s.must_equal 'http://url.to/webhook'
12
13
  end
13
14
 
14
- it 'should set the token properly' do
15
- subject.client.token.must_equal 'token'
16
- end
17
15
 
18
16
  it 'should set the default channel to #general' do
19
17
  subject.client.channel.must_equal '#general'
@@ -24,12 +22,12 @@ describe CruisecontrolrbToSlack::SlackClient do
24
22
  end
25
23
 
26
24
  it 'should override the default channel ' do
27
- slack_client = CruisecontrolrbToSlack::SlackClient.new('team', 'token', channel: 'channel')
25
+ slack_client = CruisecontrolrbToSlack::SlackClient.new('webhook', channel: 'channel')
28
26
  slack_client.client.channel.must_equal 'channel'
29
27
  end
30
28
 
31
29
  it 'should override the default user ' do
32
- slack_client = CruisecontrolrbToSlack::SlackClient.new('team', 'token', user: 'user')
30
+ slack_client = CruisecontrolrbToSlack::SlackClient.new('webhook', user: 'user')
33
31
  slack_client.client.default_payload[:username].must_equal 'user'
34
32
  end
35
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cruisecontrolrb-to-slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - epinault
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-05 00:00:00.000000000 Z
11
+ date: 2015-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dante
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.6.0
33
+ version: 1.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.6.0
40
+ version: 1.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  description: A simple daemon to report last build status of projects and activities
126
140
  from cruisecontrol into the awesome Slack (http://slack.com). It support multiple
127
141
  projects
@@ -132,6 +146,8 @@ executables:
132
146
  extensions: []
133
147
  extra_rdoc_files: []
134
148
  files:
149
+ - ".gitignore"
150
+ - CHANGELOG.md
135
151
  - Gemfile
136
152
  - Gemfile.lock
137
153
  - LICENSE.txt