slackiq 1.1.1 → 1.1.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 +4 -4
- data/README.md +16 -7
- data/lib/slackiq.rb +6 -2
- data/lib/slackiq/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5092c615b9fbbf774293b758e3c2a560a2c261e2
|
|
4
|
+
data.tar.gz: de6828473cb0164687851d79ce2a05fe9e34346c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3d4310fec4738dc931b043484fd1c694de6e7be2c34fb21e9c849155a0afb57d3052e10d782ca8e676f9f275a5b715ccc7503d45dd62113a4c211fdbca1a4d77
|
|
7
|
+
data.tar.gz: 45ffdcf4ab9c35e7a5048296d883ac74349064cd11168b7d66f6f383a1f13a5a799cfdc5131a37b54c822d3585648fc32ee3488d32b266254bf9abf5355dfc0d
|
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
# Slackiq
|
|
1
|
+
# Slackiq
|
|
2
|
+
[](http://badge.fury.io/rb/slackiq)
|
|
2
3
|
|
|
3
|
-
Slackiq integrates [Slack](https://slack.com/) and [Sidekiq](http://sidekiq.org) so that you can have vital information about your Sidekiq jobs sent directly to your team's Slack.
|
|
4
|
+
Slackiq (pronounced *slack-kick*) integrates [Slack](https://slack.com/) and [Sidekiq](http://sidekiq.org) so that you can have vital information about your Sidekiq jobs sent directly to your team's Slack.
|
|
4
5
|
|
|
5
6
|

|
|
6
7
|
|
|
@@ -8,11 +9,15 @@ Slackiq integrates [Slack](https://slack.com/) and [Sidekiq](http://sidekiq.org)
|
|
|
8
9
|
|
|
9
10
|
Add this line to your Gemfile:
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
```ruby
|
|
13
|
+
gem 'slackiq'
|
|
14
|
+
```
|
|
12
15
|
|
|
13
16
|
Then run:
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
```
|
|
19
|
+
bundle install
|
|
20
|
+
```
|
|
16
21
|
|
|
17
22
|
## Configuration
|
|
18
23
|
|
|
@@ -20,7 +25,7 @@ First, set up any number of Slack Incoming Webhooks [from your Slack](https://sl
|
|
|
20
25
|
|
|
21
26
|
Then, you only need to call the `configure` method when your application launches to configure all of the webhooks to which you want to post. If you're using Rails, create an initializer at `config/initializers/slackiq.rb`. Here's an example:
|
|
22
27
|
|
|
23
|
-
```
|
|
28
|
+
```ruby
|
|
24
29
|
Slackiq.configure( web_scrapes: 'https://hooks.slack.com/services/HA298HF2/ALSKF2451/lknsaHHA2323KKDKND',
|
|
25
30
|
data_processing: 'https://hooks.slack.com/services/HA298HF2/ALSKF2451/H24dLKAHD22423')
|
|
26
31
|
```
|
|
@@ -44,7 +49,7 @@ If you haven't used batches with Sidekiq Pro before, [read this first](https://g
|
|
|
44
49
|
|
|
45
50
|
Here's an example showing how you would use Slackiq to send a notification to your Slack when your Sidekiq batch completes:
|
|
46
51
|
|
|
47
|
-
```
|
|
52
|
+
```ruby
|
|
48
53
|
class WebScraper
|
|
49
54
|
|
|
50
55
|
class << self
|
|
@@ -81,7 +86,7 @@ Note that in this case, `'Total URLs in DB'` and `'Servers'` are custom fields t
|
|
|
81
86
|
|
|
82
87
|
No prob. Just:
|
|
83
88
|
|
|
84
|
-
```
|
|
89
|
+
```ruby
|
|
85
90
|
Slackiq.message('Server 5 is overloaded!', webhook_name: :data_processing)
|
|
86
91
|
```
|
|
87
92
|
|
|
@@ -98,3 +103,7 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
|
98
103
|
|
|
99
104
|
https://medium.com/@MightySignal/slackiq-a-ruby-gem-that-connects-slack-and-sidekiq-a2308c1974b7
|
|
100
105
|
|
|
106
|
+
## More Open Source Projects
|
|
107
|
+
|
|
108
|
+
* [Slacktivity](https://github.com/MightySignal/slacktivity)
|
|
109
|
+
|
data/lib/slackiq.rb
CHANGED
|
@@ -47,10 +47,14 @@ module Slackiq
|
|
|
47
47
|
total_jobs = status.total
|
|
48
48
|
failures = status.failures
|
|
49
49
|
jobs_run = total_jobs - status.pending
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
completion_percentage = (jobs_run/total_jobs.to_f)*100
|
|
52
|
-
|
|
53
52
|
failure_percentage = (failures/total_jobs.to_f)*100 if total_jobs && failures
|
|
53
|
+
|
|
54
|
+
# round to two decimal places
|
|
55
|
+
decimal_places = 2
|
|
56
|
+
completion_percentage = completion_percentage.round(decimal_places)
|
|
57
|
+
failure_percentage = failure_percentage.round(decimal_places)
|
|
54
58
|
|
|
55
59
|
description = status.description
|
|
56
60
|
end
|
data/lib/slackiq/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: slackiq
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jason Lew
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-01-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httparty
|