capistrano-slack-notify 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 433098b8888f2bf24b9b31062062a0bd2e883f83
4
- data.tar.gz: 6301e42d877a905da38a72cd9fa887d4315d9ac3
3
+ metadata.gz: dcd05a29bff6366c6eba507d2c491df5809ea39c
4
+ data.tar.gz: 62fbc194ae3fc389203a451f7427975a89f6b9b9
5
5
  SHA512:
6
- metadata.gz: a349ecaa60fa8f1b2b1881f27414a3d956cbf765e34282b878f45b8e54379fa0c45fe3b3fcfce5f3ea72591f9a3b4b01aa102a7391fd4e184706f18391f46351
7
- data.tar.gz: 76a77934629fcf2f2fd8a6c7558b90c41a6bbe89ff26a3b6240b391529c5796b2db77442fc29881bfaa9183c5d3d19879dfebc4b9f9f5f25bb927a740c1c2c18
6
+ metadata.gz: 1ce6698903ff89f0a9f2602304a6454a74409ebd0da2c3fa4b8978f8038462e4bfbb28c2404d37dacb0246fb5f90354104cbe5b54b3e17aa375f7fcfe4475bb7
7
+ data.tar.gz: 7cb96ebc8c94152c0618c81871b9554a2eba9ffff6661471de1b28fba0e9ecd35ec0b6779d1e7babe0e852e9f71150f8a7da81e45c59ac1c41bc4ce3fd8be5fe
@@ -17,10 +17,6 @@ module Capistrano
17
17
  end
18
18
 
19
19
  def slack_defaults
20
- if fetch(:slack_deploy_defaults, true)
21
- before 'deploy', 'slack:starting'
22
- after 'deploy', 'slack:finished'
23
- end
24
20
  end
25
21
 
26
22
  def payload(announcement)
@@ -36,9 +32,17 @@ module Capistrano
36
32
  fetch(:slack_webhook_url)
37
33
  end
38
34
 
35
+ def slack_app_name
36
+ fetch(:slack_app_name, fetch(:application))
37
+ end
38
+
39
39
  def self.extended(configuration)
40
40
  configuration.load do
41
- slack_defaults
41
+ # Add the default hooks by default.
42
+ if fetch(:slack_deploy_defaults, true)
43
+ before 'deploy', 'slack:starting'
44
+ after 'deploy', 'slack:finished'
45
+ end
42
46
 
43
47
  set :deployer do
44
48
  ENV['USER'] || ENV['GIT_AUTHOR_NAME'] || `git config user.name`.chomp
@@ -48,9 +52,9 @@ module Capistrano
48
52
  desc "Notify Slack that the deploy has started."
49
53
  task :starting do
50
54
  msg = if branch = fetch(:branch, nil)
51
- "#{fetch(:deployer)} is deploying #{fetch(:application)}/#{branch} to #{fetch(:stage, 'production')}"
55
+ "#{fetch(:deployer)} is deploying #{slack_app_name}/#{branch} to #{fetch(:stage, 'production')}"
52
56
  else
53
- "#{fetch(:deployer)} is deploying #{fetch(:application)} to #{fetch(:stage, 'production')}"
57
+ "#{fetch(:deployer)} is deploying #{slack_app_name} to #{fetch(:stage, 'production')}"
54
58
  end
55
59
  call_slack_api(msg)
56
60
  set(:start_time, Time.now)
@@ -58,7 +62,7 @@ module Capistrano
58
62
 
59
63
  desc "Notify Slack that the deploy has completed successfully."
60
64
  task :finished do
61
- msg = "#{fetch(:deployer)} deployed to #{fetch(:application)} successfully"
65
+ msg = "#{fetch(:deployer)} deployed to #{slack_app_name} successfully"
62
66
  if start_time = fetch(:start_time, nil)
63
67
  elapsed = Time.now.to_i - start_time.to_i
64
68
  msg << " in #{elapsed} seconds."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-slack-notify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Parker Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-07 00:00:00.000000000 Z
11
+ date: 2015-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano