mutx 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/templates/mutx.conf.tt +2 -1
- data/lib/mutx/background_jobs/workers/notificator.rb +1 -3
- data/lib/mutx/routes.rb +4 -1
- data/lib/mutx/support/bundle.rb +1 -0
- data/lib/mutx/support/configuration.rb +4 -0
- data/lib/mutx/support/telegram_sender.rb +40 -0
- data/lib/mutx/version.rb +1 -1
- 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: f41948713cc0c2ab88b659a0acfccef31685804f
|
4
|
+
data.tar.gz: 866f09627bb94a865d037880282c1f76128df502
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e58c8804ca6e125362a4005b59a78f83e9d4e1a5b2ce66da2911ebbae23ee3b7e1241081fa7cf40c3f5e5a4f660b1c47d07916afb0fde9a07dcf90bfeaaa4cbd
|
7
|
+
data.tar.gz: 8b556913a4cf8e004a6578fe75c461d24f312952904ac360dbf91027c7d2acf1d11c388744af51aabb83f9a3f30c63d0c8479f36b91e683ead1e6aa210eaa0fd
|
@@ -1,6 +1,4 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
require 'telegramsender'
|
3
|
-
|
4
2
|
module Mutx
|
5
3
|
module Workers
|
6
4
|
class Notificator
|
@@ -12,7 +10,7 @@ module Mutx
|
|
12
10
|
end
|
13
11
|
|
14
12
|
def telegram(group_id, message: '')
|
15
|
-
TelegramSender.send_message(group_id, message)
|
13
|
+
Support::TelegramSender.send_message(group_id, message)
|
16
14
|
end
|
17
15
|
|
18
16
|
def email(mail_to, subject: '', body: '', attachment: nil)
|
data/lib/mutx/routes.rb
CHANGED
@@ -52,7 +52,10 @@ module Mutx
|
|
52
52
|
on "pull" do
|
53
53
|
#Check for updates on the branch and make a pull if its outdated
|
54
54
|
##Mutx::Support::Git.pull unless Mutx::Support::Git.up_to_date?
|
55
|
-
|
55
|
+
data_json = JSON.parse req.body.read
|
56
|
+
Mutx::Support::ChangeInspector.is_there_a_change?
|
57
|
+
Mutx::Support::Log.debug "#{data_json}" if Mutx::Support::Log
|
58
|
+
Mutx::Support::Bundle.new.bundle_update if data_json["repository"]["language"].eql? "Ruby"
|
56
59
|
res.status = 200
|
57
60
|
res.write "status 200"
|
58
61
|
end
|
data/lib/mutx/support/bundle.rb
CHANGED
@@ -168,6 +168,10 @@ module Mutx
|
|
168
168
|
@@input['notification']['smtp_enable_start_tls_auto']
|
169
169
|
end
|
170
170
|
|
171
|
+
def self.telegram_token
|
172
|
+
@@input['notification']['telegram_token']
|
173
|
+
end
|
174
|
+
|
171
175
|
def self.notification?
|
172
176
|
self.notification_username and self.notification_password and self.use_gmail?
|
173
177
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'telegram/bot'
|
2
|
+
|
3
|
+
module Mutx
|
4
|
+
module Support
|
5
|
+
class TelegramSender
|
6
|
+
|
7
|
+
def initialize token=nil, chat_id
|
8
|
+
@token = token || Configuration.telegram_token
|
9
|
+
@chat_id = chat_id
|
10
|
+
end
|
11
|
+
|
12
|
+
# Send a message to the given group
|
13
|
+
# @param [Fixnum] chat_id = the id of the telegram group
|
14
|
+
# @param [String] message = the message to be sent
|
15
|
+
# @param [String] type of message [Markdown, HTML]
|
16
|
+
def send_message message
|
17
|
+
Telegram::Bot::Client.run(@token) do |bot|
|
18
|
+
bot.api.send_message(chat_id: @chat_id, text: message)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Send a message to the given group
|
23
|
+
# @param [Fixnum] chat_id = the id of the telegram group
|
24
|
+
# @param [String] message = the message to be sent
|
25
|
+
# @param [String] type of message [Markdown, HTML]
|
26
|
+
def self.send_message chat_id, message, parse_mode=nil
|
27
|
+
Telegram::Bot::Client.run(Configuration.telegram_token) do |bot|
|
28
|
+
bot.api.send_message(chat_id: chat_id, text: message, parse_mode:parse_mode)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.run_client
|
33
|
+
Telegram::Bot::Client.run(Configuration.telegram_token) do |bot|
|
34
|
+
yield bot
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/mutx/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mutx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Rodriguez
|
@@ -514,6 +514,7 @@ files:
|
|
514
514
|
- lib/mutx/support/query_string.rb
|
515
515
|
- lib/mutx/support/request.rb
|
516
516
|
- lib/mutx/support/risk.rb
|
517
|
+
- lib/mutx/support/telegram_sender.rb
|
517
518
|
- lib/mutx/support/time_helper.rb
|
518
519
|
- lib/mutx/support/update.rb
|
519
520
|
- lib/mutx/tasks/.DS_Store
|