capistrano-team_notifications 2.0.3 → 3.0.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 +7 -3
- data/capistrano-team_notifications.gemspec +1 -1
- data/lib/capistrano/team_notifications/tasks/team_notifications.rake +43 -0
- data/lib/capistrano/team_notifications/team_notifications.rb +1 -62
- data/lib/capistrano/team_notifications/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e245a5650913a9d16900b18db25ee9f51edbf57
|
4
|
+
data.tar.gz: 0780b77a392d9f45311b4f17adf3ca7f651ebfca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e442ced8f776509aab2f4f290a6aa4babacbacc89e3e0d15228cf1fa7fda157ed52600c37d10b452e710907aa9dc08d088e596e8a8bf00f2a7daa2f815b4378c
|
7
|
+
data.tar.gz: 376153a343765af056c98515fbafc1435a8a1866bcbaee95390476c21dffac2627f04f77c06f760961f03471415e0772c71932f5f2b8d003d6a5161f9b482fdb
|
data/README.md
CHANGED
@@ -20,20 +20,24 @@ And then execute:
|
|
20
20
|
|
21
21
|
First go to [Space notifications](https://space-notice.com/), create project like 'Facebook deploy' and get project token.
|
22
22
|
|
23
|
-
Add to
|
23
|
+
Add to Capfile
|
24
24
|
|
25
25
|
```ruby
|
26
26
|
require 'capistrano/team_notifications'
|
27
|
+
```
|
28
|
+
|
29
|
+
add to deploy.rb file
|
30
|
+
|
31
|
+
```ruby
|
27
32
|
set :team_notifications_token, "HERE_YOUR_SPACE_NOTIFICATIONS_TOKEN"
|
28
33
|
```
|
29
34
|
|
30
35
|
And finally give this link
|
31
36
|
|
32
|
-
https://space-notice.com/
|
37
|
+
https://space-notice.com/auth/github?token=TOKEN
|
33
38
|
|
34
39
|
to your team members and ask them to open it in Safari 7 or above.
|
35
40
|
|
36
|
-
|
37
41
|
## Contributing
|
38
42
|
|
39
43
|
1. Fork it ( https://github.com/[my-github-username]/capistrano-team_notifications/fork )
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "capistrano", "~>
|
21
|
+
spec.add_dependency "capistrano", "~> 3.0"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1"
|
24
24
|
spec.add_development_dependency "rake"
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
namespace :team_notifications do
|
4
|
+
task :started do
|
5
|
+
team_notify "%{deployer} is deploying %{application}#{':'+branch if branch != 'master'}#{' to '+stage if stage != 'production'}"
|
6
|
+
end
|
7
|
+
|
8
|
+
task :finished do
|
9
|
+
team_notify "%{deployer} successfully deployed %{application}#{':'+branch if branch != 'master'}#{' to '+stage if stage != 'production'}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def team_notify(message)
|
13
|
+
deployer = fetch(:deployer, `git config user.name`.chomp)
|
14
|
+
application = fetch(:application)
|
15
|
+
|
16
|
+
message = message % {deployer: deployer, application: application}
|
17
|
+
|
18
|
+
nc_notify(message)
|
19
|
+
end
|
20
|
+
|
21
|
+
def nc_notify(message)
|
22
|
+
team_notifications_token = fetch(:team_notifications_token)
|
23
|
+
raise "Undefined capistrano-team_notifications token" if team_notifications_token.nil? || team_notifications_token.empty?
|
24
|
+
|
25
|
+
http = Net::HTTP.new("space-notice.com", 443)
|
26
|
+
http.use_ssl = true
|
27
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
28
|
+
http.post("/p/#{team_notifications_token}", "message=#{message}")
|
29
|
+
end
|
30
|
+
|
31
|
+
def branch
|
32
|
+
fetch(:branch).to_s
|
33
|
+
end
|
34
|
+
|
35
|
+
def stage
|
36
|
+
fetch(:stage).to_s
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
namespace :deploy do
|
41
|
+
before 'deploy', 'team_notifications:started'
|
42
|
+
after 'finished', 'team_notifications:finished'
|
43
|
+
end
|
@@ -1,62 +1 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
module Capistrano
|
4
|
-
module TeamNotifications
|
5
|
-
def self.load_into(configuration)
|
6
|
-
configuration.load do
|
7
|
-
|
8
|
-
before 'deploy', 'team_notifications:started'
|
9
|
-
before 'deploy:migrations', 'team_notifications:started'
|
10
|
-
|
11
|
-
after 'deploy', 'team_notifications:finished'
|
12
|
-
after 'deploy:migrations', 'team_notifications:finished'
|
13
|
-
|
14
|
-
at_exit do
|
15
|
-
# log = fetch(:full_log)
|
16
|
-
|
17
|
-
# if log.include?("rolling back")
|
18
|
-
# team_notify "%{deployer} FAILED to deploy %{application}#{': '+branch if branch} to %{stage}"
|
19
|
-
# end
|
20
|
-
end
|
21
|
-
|
22
|
-
namespace :team_notifications do
|
23
|
-
task :started do
|
24
|
-
team_notify "%{deployer} is deploying %{application}#{': '+branch if branch} to %{stage}"
|
25
|
-
end
|
26
|
-
|
27
|
-
task :finished do
|
28
|
-
team_notify "%{deployer} successfully deployed %{application}#{': '+branch if branch} to %{stage}"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def team_notify(message)
|
33
|
-
deployer = fetch(:deployer, `git config user.name`.chomp)
|
34
|
-
stage = fetch(:stage, 'production')
|
35
|
-
|
36
|
-
message = message % {deployer: deployer, application: application, stage: stage}
|
37
|
-
|
38
|
-
nc_notify(message)
|
39
|
-
end
|
40
|
-
|
41
|
-
def nc_notify(message)
|
42
|
-
raise "Undefined capistrano-team_notifications token" if team_notifications_token.empty? || team_notifications_token == ''
|
43
|
-
|
44
|
-
http = Net::HTTP.new("space-notice.com", 443)
|
45
|
-
http.use_ssl = true
|
46
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
47
|
-
http.post("/p/#{team_notifications_token}", "message=#{message}")
|
48
|
-
rescue Net::ReadTimeout
|
49
|
-
end
|
50
|
-
|
51
|
-
def branch
|
52
|
-
fetch(:branch, nil)
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
if Capistrano::Configuration.instance
|
61
|
-
Capistrano::TeamNotifications.load_into(Capistrano::Configuration.instance)
|
62
|
-
end
|
1
|
+
load File.expand_path("../tasks/team_notifications.rake", __FILE__)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-team_notifications
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Balashov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- Rakefile
|
67
67
|
- capistrano-team_notifications.gemspec
|
68
68
|
- lib/capistrano/team_notifications.rb
|
69
|
+
- lib/capistrano/team_notifications/tasks/team_notifications.rake
|
69
70
|
- lib/capistrano/team_notifications/team_notifications.rb
|
70
71
|
- lib/capistrano/team_notifications/version.rb
|
71
72
|
homepage: https://github.com/evrone/capistrano-team_notifications
|