mina_slack 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +88 -0
- data/LICENSE +21 -0
- data/MIT-LICENSE +20 -0
- data/README.md +57 -0
- data/README.rdoc +3 -0
- data/Rakefile +21 -0
- data/lib/mina_slack.rb +4 -0
- data/lib/mina_slack/tasks.rb +68 -0
- data/lib/mina_slack/version.rb +3 -0
- data/mina_slack.gemspec +22 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 20f6870dd617727f1fe75965a4faefc79ec22467
|
4
|
+
data.tar.gz: 58ebe59ad0ed8dd6f866c0c6f4179c18002f8bf5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d03754cc58849445c37526c1d315a51753d8403d9a024e7e789d0569b4b70c2c77609f0c70d0cdb78459dd8a5cd69feb6ae193555546b5602b5c3a773e410944
|
7
|
+
data.tar.gz: 3145fefd7c43b2991b74fbf91d42792aa9a7259d5c32b26d4e4b296d1e1c49b53caafbc651c4e43ffb322d3210f890f5c22ab9b8623d8946b767bfb818e4fb7d
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in mina_slack.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use debugger
|
14
|
+
# gem 'debugger'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mina_slack (0.0.1)
|
5
|
+
rails (~> 4.0.3)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (4.0.4)
|
11
|
+
actionpack (= 4.0.4)
|
12
|
+
mail (~> 2.5.4)
|
13
|
+
actionpack (4.0.4)
|
14
|
+
activesupport (= 4.0.4)
|
15
|
+
builder (~> 3.1.0)
|
16
|
+
erubis (~> 2.7.0)
|
17
|
+
rack (~> 1.5.2)
|
18
|
+
rack-test (~> 0.6.2)
|
19
|
+
activemodel (4.0.4)
|
20
|
+
activesupport (= 4.0.4)
|
21
|
+
builder (~> 3.1.0)
|
22
|
+
activerecord (4.0.4)
|
23
|
+
activemodel (= 4.0.4)
|
24
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
25
|
+
activesupport (= 4.0.4)
|
26
|
+
arel (~> 4.0.0)
|
27
|
+
activerecord-deprecated_finders (1.0.3)
|
28
|
+
activesupport (4.0.4)
|
29
|
+
i18n (~> 0.6, >= 0.6.9)
|
30
|
+
minitest (~> 4.2)
|
31
|
+
multi_json (~> 1.3)
|
32
|
+
thread_safe (~> 0.1)
|
33
|
+
tzinfo (~> 0.3.37)
|
34
|
+
arel (4.0.2)
|
35
|
+
atomic (1.1.16)
|
36
|
+
builder (3.1.4)
|
37
|
+
erubis (2.7.0)
|
38
|
+
hike (1.2.3)
|
39
|
+
i18n (0.6.9)
|
40
|
+
mail (2.5.4)
|
41
|
+
mime-types (~> 1.16)
|
42
|
+
treetop (~> 1.4.8)
|
43
|
+
mime-types (1.25.1)
|
44
|
+
minitest (4.7.5)
|
45
|
+
multi_json (1.9.2)
|
46
|
+
polyglot (0.3.4)
|
47
|
+
rack (1.5.2)
|
48
|
+
rack-test (0.6.2)
|
49
|
+
rack (>= 1.0)
|
50
|
+
rails (4.0.4)
|
51
|
+
actionmailer (= 4.0.4)
|
52
|
+
actionpack (= 4.0.4)
|
53
|
+
activerecord (= 4.0.4)
|
54
|
+
activesupport (= 4.0.4)
|
55
|
+
bundler (>= 1.3.0, < 2.0)
|
56
|
+
railties (= 4.0.4)
|
57
|
+
sprockets-rails (~> 2.0.0)
|
58
|
+
railties (4.0.4)
|
59
|
+
actionpack (= 4.0.4)
|
60
|
+
activesupport (= 4.0.4)
|
61
|
+
rake (>= 0.8.7)
|
62
|
+
thor (>= 0.18.1, < 2.0)
|
63
|
+
rake (10.2.2)
|
64
|
+
sprockets (2.12.0)
|
65
|
+
hike (~> 1.2)
|
66
|
+
multi_json (~> 1.0)
|
67
|
+
rack (~> 1.0)
|
68
|
+
tilt (~> 1.1, != 1.3.0)
|
69
|
+
sprockets-rails (2.0.1)
|
70
|
+
actionpack (>= 3.0)
|
71
|
+
activesupport (>= 3.0)
|
72
|
+
sprockets (~> 2.8)
|
73
|
+
sqlite3 (1.3.9)
|
74
|
+
thor (0.19.1)
|
75
|
+
thread_safe (0.3.1)
|
76
|
+
atomic (>= 1.1.7, < 2)
|
77
|
+
tilt (1.4.1)
|
78
|
+
treetop (1.4.15)
|
79
|
+
polyglot
|
80
|
+
polyglot (>= 0.3.1)
|
81
|
+
tzinfo (0.3.39)
|
82
|
+
|
83
|
+
PLATFORMS
|
84
|
+
ruby
|
85
|
+
|
86
|
+
DEPENDENCIES
|
87
|
+
mina_slack!
|
88
|
+
sqlite3
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Mike Bajur
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
mina_slack
|
2
|
+
============
|
3
|
+
|
4
|
+
mina_slack is a gem that adds tasks for sending notifications to [Slack] (http://slack.com)
|
5
|
+
using [Mina] (http://nadarei.co/mina).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
gem install mina_slack
|
10
|
+
|
11
|
+
## Usage example
|
12
|
+
|
13
|
+
require 'mina_slack/tasks'
|
14
|
+
...
|
15
|
+
# Required mina_slack options
|
16
|
+
set :slack_api_token, 'xxxyyyzzz'
|
17
|
+
set :slack_channels, ['#general']
|
18
|
+
|
19
|
+
task :deploy do
|
20
|
+
deploy do
|
21
|
+
invoke :'slack:notify_deploy_started'
|
22
|
+
...
|
23
|
+
|
24
|
+
to :launch do
|
25
|
+
...
|
26
|
+
invoke :'slack:notify_deploy_finished'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
## Available Tasks
|
32
|
+
|
33
|
+
* `slack:notify_deploy_started`
|
34
|
+
* `slack:notify_deploy_finished`
|
35
|
+
|
36
|
+
## Available Options
|
37
|
+
|
38
|
+
| Option | Description |
|
39
|
+
| ------------------------- | ------------------------------------------------------------------------------------ |
|
40
|
+
| *__slack_api_token__** | API auth token. |
|
41
|
+
| *__slack_channels__** | Channels where notifications will be sent to. |
|
42
|
+
| *slack_username* | Name of bot. |
|
43
|
+
| *slack_author* | Author of a deploy displayed in deploy messages. |
|
44
|
+
| *slack_link_names* | Find and link channel names and usernames. |
|
45
|
+
| *slack_parse* | Change how messages are treated. [Read more] (https://api.slack.com/docs/formatting) |
|
46
|
+
|
47
|
+
__* required options__
|
48
|
+
|
49
|
+
## Todo
|
50
|
+
|
51
|
+
* Write some tests
|
52
|
+
|
53
|
+
## Copyright
|
54
|
+
|
55
|
+
Copyright (c) 2014 Mike Bajur http://github.com/mbajur
|
56
|
+
|
57
|
+
See LICENSE for further details.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'MinaSlack'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
data/lib/mina_slack.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
# ## Settings
|
4
|
+
# Any and all of these settings can be overriden in your `deploy.rb`.
|
5
|
+
|
6
|
+
# ### slack_api_token
|
7
|
+
# API auth token.
|
8
|
+
set_default :slack_api_token, ''
|
9
|
+
|
10
|
+
# ### slack_channels
|
11
|
+
# Channels where notifications will be sent to.
|
12
|
+
set_default :slack_channels, []
|
13
|
+
|
14
|
+
# ### slack_username
|
15
|
+
# Name of bot.
|
16
|
+
set_default :slack_username, 'Deploy'
|
17
|
+
|
18
|
+
# ### slack_author
|
19
|
+
# Author of a deploy displayed in deploy messages.
|
20
|
+
set_default :slack_author, 'Someone'
|
21
|
+
|
22
|
+
# ### slack_link_names
|
23
|
+
# Find and link channel names and usernames.
|
24
|
+
set_default :slack_link_names, 1
|
25
|
+
|
26
|
+
# ### slack_parse
|
27
|
+
# Change how messages are treated. [Read more] (https://api.slack.com/docs/formatting)
|
28
|
+
set_default :slack_parse, 'full'
|
29
|
+
|
30
|
+
# ## Control Tasks
|
31
|
+
namespace :slack do
|
32
|
+
|
33
|
+
# ## slack:notify_deploy_started
|
34
|
+
desc "Send slack notification about new deploy start"
|
35
|
+
task :notify_deploy_started => :environment do
|
36
|
+
queue %[echo "-----> Sending start notification to Slack"]
|
37
|
+
text = "#{slack_author} is deploying #{application}..."
|
38
|
+
|
39
|
+
for channel in slack_channels
|
40
|
+
send_message(
|
41
|
+
channel: channel,
|
42
|
+
text: text
|
43
|
+
)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# ## slack:notify_deploy_finished
|
48
|
+
desc "Send slack notification about deploy finish"
|
49
|
+
task :notify_deploy_finished => :environment do
|
50
|
+
queue %[echo "-----> Sending finish notification to Slack"]
|
51
|
+
|
52
|
+
text = "#{slack_author} finished deploying #{application}."
|
53
|
+
text += " See it here: http://#{domain}" if domain != nil
|
54
|
+
|
55
|
+
for channel in slack_channels
|
56
|
+
send_message(
|
57
|
+
channel: channel,
|
58
|
+
text: text,
|
59
|
+
attachments: attachments
|
60
|
+
)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def send_message(params = {})
|
65
|
+
queue %[curl -X POST https://slack.com/api/chat.postMessage -d "token=#{slack_api_token}&channel=#{params[:channel]}&username=#{slack_username}&text=#{params[:text]}&attachments='[{"fields": [{"value": "Value"}]}]'&parse=#{slack_parse}&link_names=#{link_names}" --silent > /dev/null]
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
data/mina_slack.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "mina_slack/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "mina_slack"
|
9
|
+
s.version = MinaSlack::VERSION
|
10
|
+
s.authors = ["Mike Bajur"]
|
11
|
+
s.email = ["mbajur@gmail.com"]
|
12
|
+
s.homepage = "https://github.com/mbajur/mina_slack"
|
13
|
+
s.summary = "Mina bindings for Slack"
|
14
|
+
s.description = "Adds tasks to aid in the Slack notifications."
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_runtime_dependency "mina"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mina_slack
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mike Bajur
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mina
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Adds tasks to aid in the Slack notifications.
|
28
|
+
email:
|
29
|
+
- mbajur@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- Gemfile
|
36
|
+
- Gemfile.lock
|
37
|
+
- LICENSE
|
38
|
+
- MIT-LICENSE
|
39
|
+
- README.md
|
40
|
+
- README.rdoc
|
41
|
+
- Rakefile
|
42
|
+
- lib/mina_slack.rb
|
43
|
+
- lib/mina_slack/tasks.rb
|
44
|
+
- lib/mina_slack/version.rb
|
45
|
+
- mina_slack.gemspec
|
46
|
+
homepage: https://github.com/mbajur/mina_slack
|
47
|
+
licenses: []
|
48
|
+
metadata: {}
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options: []
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements: []
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 2.2.2
|
66
|
+
signing_key:
|
67
|
+
specification_version: 4
|
68
|
+
summary: Mina bindings for Slack
|
69
|
+
test_files: []
|
70
|
+
has_rdoc:
|