HornsAndHooves-slackiq 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -15
- data/lib/slackiq/version.rb +1 -1
- data/lib/slackiq.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6be2c0415ea2952f65a89e6730c6ad4106574f5334144ca9787df8f9a42414fb
|
4
|
+
data.tar.gz: bae386ccff64e20dfe68cbd4dc1817a93c891d34b138d5e6083770323661a57e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1696e9a0f2c26a528163a1955f84967a90ed06500446afeb07e5aa01722fe1b40f386e1f544adc38ec23875d966c4dbfb5521bcfee3e715b229ad7b8764d0dd8
|
7
|
+
data.tar.gz: 515305b5906a2c5a9d9edf63044806d1a58da14406db87084f0a589f7bdd368f8638cd9ec9ab97e70f6ac8be08baf6ee94ff68fa08103de587cacaf7ff4d5bca
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Slackiq
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/slackiq.svg)](
|
1
|
+
# Slackiq
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/HornsAndHooves-slackiq.svg)](https://badge.fury.io/rb/HornsAndHooves-slackiq)
|
3
3
|
|
4
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.
|
5
5
|
|
@@ -26,7 +26,7 @@ First, set up any number of Slack Incoming Webhooks [from your Slack](https://sl
|
|
26
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:
|
27
27
|
|
28
28
|
```ruby
|
29
|
-
Slackiq.configure( web_scrapes: 'https://hooks.slack.com/services/HA298HF2/ALSKF2451/lknsaHHA2323KKDKND',
|
29
|
+
Slackiq.configure( web_scrapes: 'https://hooks.slack.com/services/HA298HF2/ALSKF2451/lknsaHHA2323KKDKND',
|
30
30
|
data_processing: 'https://hooks.slack.com/services/HA298HF2/ALSKF2451/H24dLKAHD22423')
|
31
31
|
```
|
32
32
|
|
@@ -51,32 +51,32 @@ Here's an example showing how you would use Slackiq to send a notification to yo
|
|
51
51
|
|
52
52
|
```ruby
|
53
53
|
class WebScraper
|
54
|
-
|
54
|
+
|
55
55
|
class << self
|
56
|
-
|
56
|
+
|
57
57
|
# Scrape the first 100 URLs in the database
|
58
58
|
def scrape_100
|
59
59
|
batch = Sidekiq::Batch.new
|
60
|
-
batch.description = 'Scrape the first 100 URLs!'
|
60
|
+
batch.description = 'Scrape the first 100 URLs!'
|
61
61
|
batch.on(:complete, self)
|
62
|
-
|
62
|
+
|
63
63
|
batch.jobs do
|
64
|
-
|
64
|
+
|
65
65
|
urls = Url.limit(100) # Url is a Rails model in this case
|
66
|
-
|
66
|
+
|
67
67
|
urls.each do |url|
|
68
68
|
ScraperWorker.perform_async(url.id)
|
69
69
|
end
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
def on_complete(status, options)
|
75
|
-
Slackiq.notify(webhook_name: :web_scrapes, status: status, title: 'Scrape Completed!',
|
76
|
-
'Total URLs in DB' => URL.count.to_s,
|
75
|
+
Slackiq.notify(webhook_name: :web_scrapes, status: status, title: 'Scrape Completed!',
|
76
|
+
'Total URLs in DB' => URL.count.to_s,
|
77
77
|
'Servers' => "#{Server.active_count} active, #{Server.inactive_count} inactive")
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
end
|
81
81
|
```
|
82
82
|
|
@@ -84,7 +84,7 @@ Note that in this case, `'Total URLs in DB'` and `'Servers'` are custom fields t
|
|
84
84
|
|
85
85
|
### Want to send a message to Slack that isn't Sidekiq-related?
|
86
86
|
|
87
|
-
No prob. Just:
|
87
|
+
No prob. Just:
|
88
88
|
|
89
89
|
```ruby
|
90
90
|
Slackiq.message('Server 5 is overloaded!', webhook_name: :data_processing)
|
data/lib/slackiq/version.rb
CHANGED
data/lib/slackiq.rb
CHANGED
@@ -25,8 +25,8 @@ module Slackiq
|
|
25
25
|
url = @@webhook_urls[options[:webhook_name]]
|
26
26
|
title = options[:title]
|
27
27
|
# description = options[:description]
|
28
|
-
color = options[:color] || color_for(status)
|
29
28
|
status = options[:status]
|
29
|
+
color = options[:color] || color_for(status)
|
30
30
|
|
31
31
|
if (bid = options[:bid]) && status.nil?
|
32
32
|
raise "Sidekiq::Batch::Status is not defined. Are you sure Sidekiq Pro is set up correctly?" unless defined?(Sidekiq::Batch::Status)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: HornsAndHooves-slackiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HornsAndHooves
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-03-
|
12
|
+
date: 2020-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|