capistrano-telegram_notification 0.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 +7 -0
- data/.gitignore +14 -0
- data/.vscode/temp.sql +0 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +54 -0
- data/Rakefile +1 -0
- data/capistrano-telegram_notification.gemspec +24 -0
- data/lib/capistrano-telegram_notification.rb +0 -0
- data/lib/capistrano/tasks/telegram_notification.rake +65 -0
- data/lib/capistrano/telegram_notification.rb +1 -0
- data/lib/capistrano/telegram_notification/version.rb +5 -0
- data/misc/capistrano-icon.png +0 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: eb611e742876da7149eb62e8056aa553278f1fbe
|
4
|
+
data.tar.gz: 81ef0f0ee2260df81cf8d78a93270f3ac02bde12
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 126a247aa99cc4dd7dead3979c9b72acffc6ef481494696195ed0242ee141a960a9f1f82b577baabd72cfbce53399a5da835b581d79acd1e8544423cd096a00c
|
7
|
+
data.tar.gz: 2801b6d5db3388b5a1eb98844f10a084438112c99f2bb48bee7a61b60d53733bdfc523a1410d93f5ea535c372f52fc88d64a55f546613ffc37f211735a3ba1e0
|
data/.gitignore
ADDED
data/.vscode/temp.sql
ADDED
File without changes
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2018 Nithin Saji
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
Capistrano - Telegram Notification
|
2
|
+
===============================
|
3
|
+
|
4
|
+
Notify Capistrano ver3 deployment to Telegram, forked from the slack version by linyows
|
5
|
+
|
6
|
+
|
7
|
+
Installation
|
8
|
+
------------
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'capistrano-telegram_notification'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
```sh
|
19
|
+
$ bundle
|
20
|
+
```
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
```sh
|
25
|
+
$ gem install capistrano-telegram_notification
|
26
|
+
```
|
27
|
+
|
28
|
+
Usage
|
29
|
+
-----
|
30
|
+
|
31
|
+
### Capfile
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
require 'capistrano/telegram_notification'
|
35
|
+
```
|
36
|
+
|
37
|
+
### config/deploy.rb
|
38
|
+
|
39
|
+
if use webhook
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
set :telegram_bot_token, '4223:dfsdaf..'
|
43
|
+
set :telegram_chat_id, '-4234123'
|
44
|
+
|
45
|
+
after 'deploy:started', 'telegram:deploy:start'
|
46
|
+
after 'deploy:finishing', 'telegram:deploy:finish'
|
47
|
+
after 'deploy:finishing_rollback', 'telegram:deploy:rollback'
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
License
|
52
|
+
-------
|
53
|
+
|
54
|
+
The MIT License (MIT)
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'capistrano/telegram_notification/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "capistrano-telegram_notification"
|
8
|
+
spec.version = Capistrano::TelegramNotification::VERSION
|
9
|
+
spec.authors = ["Nithin Saji"]
|
10
|
+
spec.email = ["nithin111@gmail.com"]
|
11
|
+
spec.summary = %q{Notify Capistrano deployment to Telegram.}
|
12
|
+
spec.description = %q{Notify Capistrano deployment to Telegram.}
|
13
|
+
spec.homepage = "https://github.com/diadara/capistrano-telegram_notification"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "telegram-bot-ruby", "~> 0.8"
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
end
|
File without changes
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'telegram/bot'
|
2
|
+
|
3
|
+
namespace :telegram do
|
4
|
+
set :telegram_bot_key, nil
|
5
|
+
set :telegram_chat_id, nil
|
6
|
+
|
7
|
+
set :telegram_deployer, -> {
|
8
|
+
username = `git config --get user.name`.strip
|
9
|
+
username = `whoami`.strip unless username
|
10
|
+
username
|
11
|
+
}
|
12
|
+
|
13
|
+
set :telegram_stage, -> {
|
14
|
+
stage = fetch(:stage)
|
15
|
+
stage.to_s == 'production' ? ":warning: #{stage}" : stage
|
16
|
+
}
|
17
|
+
|
18
|
+
def send_to_telegram(message)
|
19
|
+
puts "sending message"
|
20
|
+
Telegram::Bot::Client.run(fetch(:telegram_bot_key)) do |bot|
|
21
|
+
bot.api.send_message(chat_id: fetch(:telegram_chat_id), text: message)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def telegram_start
|
26
|
+
text = "Started deploying to #{fetch(:telegram_stage)} by #{fetch(:telegram_deployer)}" +
|
27
|
+
" (branch #{fetch(:branch)}) at #{Time.now}"
|
28
|
+
send_to_telegram(text)
|
29
|
+
end
|
30
|
+
|
31
|
+
def telegram_failure
|
32
|
+
time = elapsed_time()
|
33
|
+
text = "Failed deploying to #{fetch(:telegram_stage)} by #{fetch(:telegram_deployer)}" +
|
34
|
+
" (branch #{fetch(:branch)} at #{fetch(:current_revision)} / #{Time.now} )"
|
35
|
+
send_to_telegram(text)
|
36
|
+
end
|
37
|
+
|
38
|
+
def telegram_success
|
39
|
+
task = fetch(:deploying) ? 'deployment' : '*rollback*'
|
40
|
+
text = "Successful #{task} to #{fetch(:telegram_stage)} by @#{fetch(:telegram_deployer)}" +
|
41
|
+
" (branch #{fetch(:branch)} at #{fetch(:current_revision)} / #{Time.now} )"
|
42
|
+
send_to_telegram(text)
|
43
|
+
end
|
44
|
+
|
45
|
+
namespace :deploy do
|
46
|
+
desc 'Notify a deploy starting to Telegram'
|
47
|
+
task :start do
|
48
|
+
telegram_start
|
49
|
+
end
|
50
|
+
|
51
|
+
desc 'Notify a deploy finish to Telegram'
|
52
|
+
task :finish do
|
53
|
+
telegram_success
|
54
|
+
end
|
55
|
+
|
56
|
+
desc 'Notify a deploy rollback to Telegram'
|
57
|
+
task :rollback do
|
58
|
+
if (fetch(:deploying))
|
59
|
+
telegram_success
|
60
|
+
else
|
61
|
+
telegram_failure
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path('../tasks/telegram_notification.rake', __FILE__)
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-telegram_notification
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nithin Saji
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: telegram-bot-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.8'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: Notify Capistrano deployment to Telegram.
|
56
|
+
email:
|
57
|
+
- nithin111@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".vscode/temp.sql"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- capistrano-telegram_notification.gemspec
|
69
|
+
- lib/capistrano-telegram_notification.rb
|
70
|
+
- lib/capistrano/tasks/telegram_notification.rake
|
71
|
+
- lib/capistrano/telegram_notification.rb
|
72
|
+
- lib/capistrano/telegram_notification/version.rb
|
73
|
+
- misc/capistrano-icon.png
|
74
|
+
homepage: https://github.com/diadara/capistrano-telegram_notification
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.5.2
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Notify Capistrano deployment to Telegram.
|
98
|
+
test_files: []
|