slacked 0.8.0 → 0.9.0
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 +13 -0
- data/lib/slacked/slack_post.rb +11 -1
- data/lib/slacked/version.rb +1 -1
- data/slacked.gemspec +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a1a1d2a0342dcc169bf1ea68a8a93e93a7e1466
|
4
|
+
data.tar.gz: 462e6bde658b0f7ac277c5895a36620f5d20050e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6a590fd1678e841b587a61ff394fb273864a4a481482494d157278aa92b89aa940c0f69d0fe928265ebaff7280008d9aa2276172bb1fd05afd88027ca0d2538
|
7
|
+
data.tar.gz: 5bea4f9d061cf488066fb590860e9aa3c61eca9fd62c32a22451d3452429c5210acd8015d31c649310205d9fe60df83d88dfd37460ede31fcee49cc12e041a97
|
data/README.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
+
[](https://badge.fury.io/rb/slacked) [](https://circleci.com/gh/codelittinc/slacked)
|
2
|
+
|
1
3
|
# Slacked
|
2
4
|
|
3
5
|
This is a super simple Slack integration for Rails. A use case for this would be to post a notification in Slack when a new User is created or a certain action has been taken in your application.
|
4
6
|
|
5
7
|
Are there other gems that provide similar functionality? Yes. Do some of them provide more flexibility? Yes. The point of this was to make installing and integrating a 30 second process.
|
6
8
|
|
9
|
+
This gem can be used with a rails application and enabled/disabled based on the environment config as you may see below
|
10
|
+
|
7
11
|
## Getting Started
|
8
12
|
|
9
13
|
Add this line to your application's Gemfile:
|
@@ -73,6 +77,15 @@ class Post < ActiveRecord::Base
|
|
73
77
|
end
|
74
78
|
```
|
75
79
|
|
80
|
+
## Using with rails
|
81
|
+
If you are using this gem inside a rails application you can enable or disable it based on your environment, to do it you only need to add the code below in your config file.
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
config.slacked_disabled = true
|
85
|
+
```
|
86
|
+
|
87
|
+
The default value is false
|
88
|
+
|
76
89
|
## Contributors
|
77
90
|
|
78
91
|
- [Sean H.](https://github.com/seathony)
|
data/lib/slacked/slack_post.rb
CHANGED
@@ -8,7 +8,7 @@ module Slacked
|
|
8
8
|
|
9
9
|
class << self
|
10
10
|
def post message = ENV[SLACK_DEFAULT_MESSAGE_KEY]
|
11
|
-
return false if message.nil? || message.empty?
|
11
|
+
return false if message.nil? || message.empty? || disabled?
|
12
12
|
notifier = slack_notifier
|
13
13
|
notifier.ping message, SLACK_CONFIG
|
14
14
|
end
|
@@ -21,9 +21,19 @@ module Slacked
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def disabled?
|
25
|
+
return false unless rails?
|
26
|
+
rails_config = Rails.application.config
|
27
|
+
rails_config.respond_to?(:slacked_disabled) && rails_config.slacked_disabled
|
28
|
+
end
|
29
|
+
|
24
30
|
private
|
25
31
|
def slack_notifier webhook_url = ENV[SLACK_WEBHOOK_URL_KEY]
|
26
32
|
Slack::Notifier.new webhook_url
|
27
33
|
end
|
34
|
+
|
35
|
+
def rails?
|
36
|
+
defined?(Rails)
|
37
|
+
end
|
28
38
|
end
|
29
39
|
end
|
data/lib/slacked/version.rb
CHANGED
data/slacked.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'slacked/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "slacked"
|
8
8
|
spec.version = Slacked::VERSION
|
9
|
-
spec.authors = ["
|
9
|
+
spec.authors = ["Sean", "Kaio Magalhães", "Locky"]
|
10
10
|
spec.email = ["seathony@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{A super simple and easy way to send notifications to Slack from your Rails application.}
|
metadata
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slacked
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Sean
|
8
|
+
- Kaio Magalhães
|
9
|
+
- Locky
|
8
10
|
autorequire:
|
9
11
|
bindir: exe
|
10
12
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
13
|
+
date: 2015-12-08 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
13
15
|
- !ruby/object:Gem::Dependency
|
14
16
|
name: bundler
|