capistrano-helpers 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e919629f0254d5b38e98dd1079343db96cf0a741
4
- data.tar.gz: dc493a9a207622092b848d6d591566664e8edf32
3
+ metadata.gz: 09b064243388dc7224f89f9da15db06930263e16
4
+ data.tar.gz: f8defc2b8f64f566543bdff7ed0a0836b5c78d4b
5
5
  SHA512:
6
- metadata.gz: 42df7101463fcbfae1cbbc7624e42035cfca5d9a8142b5f3d1675a5af7cf5e9383500bac6dcc8e3b71094712d779463f43b28f8f538f8dbe07b0a75dc395ad56
7
- data.tar.gz: db32a7adf116b840d107bc9cf96405f19b0496f020fdca631df926c7f4b3bf89ef3cffcde3f34cf22e0bfe7687c1e8b2b3380a8eb12ef8f0d6f75eec74a8d7b1
6
+ metadata.gz: 4672b2f2f55e7a5715ef410960471c190f68c45e8f734aa39e1d1823284d8a4dd0abd259d8e140f4adef81390f67b3ab26e623835f874c00a1343fe6ebba2fd4
7
+ data.tar.gz: f7c2cc2abe36d9b2b85957719a100d980d311a8c3dba1f95af8d1ae98c13608d216c36f6b285a37827e555354263a1798cee94912f5ef963c9289b8e7dedc133
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.0
1
+ 0.11.1
@@ -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.0 ruby lib
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.0"
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.0
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