capistrano-helpers 0.11.0 → 0.11.1
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/VERSION +1 -1
- data/capistrano-helpers.gemspec +3 -2
- data/lib/capistrano-helpers/slack.rb +44 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 09b064243388dc7224f89f9da15db06930263e16
|
|
4
|
+
data.tar.gz: f8defc2b8f64f566543bdff7ed0a0836b5c78d4b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4672b2f2f55e7a5715ef410960471c190f68c45e8f734aa39e1d1823284d8a4dd0abd259d8e140f4adef81390f67b3ab26e623835f874c00a1343fe6ebba2fd4
|
|
7
|
+
data.tar.gz: f7c2cc2abe36d9b2b85957719a100d980d311a8c3dba1f95af8d1ae98c13608d216c36f6b285a37827e555354263a1798cee94912f5ef963c9289b8e7dedc133
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.11.
|
|
1
|
+
0.11.1
|
data/capistrano-helpers.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: capistrano-helpers 0.11.
|
|
5
|
+
# stub: capistrano-helpers 0.11.1 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "capistrano-helpers"
|
|
9
|
-
s.version = "0.11.
|
|
9
|
+
s.version = "0.11.1"
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.require_paths = ["lib"]
|
|
@@ -44,6 +44,7 @@ Gem::Specification.new do |s|
|
|
|
44
44
|
"lib/capistrano-helpers/robots.rb",
|
|
45
45
|
"lib/capistrano-helpers/shared.rb",
|
|
46
46
|
"lib/capistrano-helpers/skylinecms.rb",
|
|
47
|
+
"lib/capistrano-helpers/slack.rb",
|
|
47
48
|
"lib/capistrano-helpers/specs.rb",
|
|
48
49
|
"lib/capistrano-helpers/unicorn.rb",
|
|
49
50
|
"lib/capistrano-helpers/version.rb",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../capistrano-helpers' if ! defined?(CapistranoHelpers)
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
require 'slack-notifier'
|
|
5
|
+
rescue LoadError
|
|
6
|
+
raise RuntimeError, "The slack-notifier gem is required for Slack deploy notifications. Add it to your Gemfile."
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
require 'git'
|
|
10
|
+
|
|
11
|
+
CapistranoHelpers.with_configuration do
|
|
12
|
+
|
|
13
|
+
namespace :deploy do
|
|
14
|
+
desc "Post to Slack that this deployment is complete"
|
|
15
|
+
task :post_to_slack do
|
|
16
|
+
config_file = fetch(:slack_config, 'config/slack.yml')
|
|
17
|
+
if config_file.nil? || ! File.readable?(config_file)
|
|
18
|
+
puts "Could not find a slack configuration. Skipping slack notification."
|
|
19
|
+
elsif fetch(:slack_notifications, true) == false
|
|
20
|
+
# slack notifications are disabled, nothing to do
|
|
21
|
+
else
|
|
22
|
+
git_config = Git.open('.').config rescue {}
|
|
23
|
+
person = ENV['GIT_AUTHOR_NAME'] || git_config['user.name'] || `whoami`.strip
|
|
24
|
+
app = fetch(:application, nil)
|
|
25
|
+
# If the :branch reference is a full SHA1, display it in its abbreviated form
|
|
26
|
+
version = fetch(:branch).sub(/\b([a-f0-9]{7})[a-f0-9]{33}\b/, '\1')
|
|
27
|
+
environment = fetch(:stage, 'production')
|
|
28
|
+
|
|
29
|
+
config = YAML::load_file(config_file)
|
|
30
|
+
slack_options = {}
|
|
31
|
+
slack_options[:channel] = config['channel'] if config['channel']
|
|
32
|
+
slack_options[:username] = config['username'] || 'capistrano'
|
|
33
|
+
slack_options[:icon_emoji] = config['icon_emoji'] if config['icon_emoji']
|
|
34
|
+
slack_options[:icon_url] = config['icon_url'] if config['icon_url']
|
|
35
|
+
|
|
36
|
+
notifier = Slack::Notifier.new(config['webhook_url'], slack_options)
|
|
37
|
+
notifier.ping "#{person} just deployed #{app} #{version} to #{environment}"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
after "deploy:restart", "deploy:post_to_slack"
|
|
43
|
+
|
|
44
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capistrano-helpers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Scott Woods
|
|
@@ -85,6 +85,7 @@ files:
|
|
|
85
85
|
- lib/capistrano-helpers/robots.rb
|
|
86
86
|
- lib/capistrano-helpers/shared.rb
|
|
87
87
|
- lib/capistrano-helpers/skylinecms.rb
|
|
88
|
+
- lib/capistrano-helpers/slack.rb
|
|
88
89
|
- lib/capistrano-helpers/specs.rb
|
|
89
90
|
- lib/capistrano-helpers/unicorn.rb
|
|
90
91
|
- lib/capistrano-helpers/version.rb
|