konsierge-notifier 0.1.3 → 0.1.4
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/.rubocop.yml +3 -0
- data/Rakefile +2 -4
- data/konsierge-notifier.gemspec +9 -18
- data/lib/generators/install/konsierge_notifier.rb +1 -1
- data/lib/generators/install/templates/{konsierge_notifier_telegram.rb → konsierge_notifier.rb} +1 -1
- data/lib/konsierge/notifier/adapters/base_adapter.rb +17 -0
- data/lib/konsierge/notifier/adapters/telegram.rb +108 -0
- data/lib/konsierge/notifier/configuration.rb +15 -3
- data/lib/konsierge/notifier/rails_report_subscriber.rb +13 -0
- data/lib/konsierge/notifier/templates/telegram/error.html.erb +14 -0
- data/lib/konsierge/notifier/version.rb +1 -1
- data/lib/konsierge/notifier.rb +14 -65
- metadata +14 -98
- data/lib/generators/konsierge/notifier/mailer/install_generator.rb +0 -15
- data/lib/generators/konsierge/notifier/mailer/templates/README +0 -18
- data/lib/generators/konsierge/notifier/mailer/templates/initializer.rb +0 -8
- data/lib/konsierge/notifier/error_template.html.erb +0 -8
- /data/lib/konsierge/notifier/{template.html.erb → templates/telegram/message.html.erb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a93ee3c22745d24690a2e49fb7a68967a71e21de56a59a36db188fbd8d6939b
|
4
|
+
data.tar.gz: 93f25d25fcef4eccebbace9db5739498cd6d9da2c8cc66718eae800c12b789e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9f8ebefb28f9d14d3c2e9e8db1e96532ae45887d7efbed26fb6840cf1d18e9dd9616ebb2d23525a7f2ebf3fba56fd493c49542cb247309f554671c8f8a42328
|
7
|
+
data.tar.gz: 6c382b95e199108845f9e763cc27c5c142ffbd49dec73fd93e147dbd5aa7350f35315e5b73446f4f14969df81ef00eabad16273e79f4b91796f4faa5f7d35f36
|
data/.rubocop.yml
CHANGED
data/Rakefile
CHANGED
@@ -2,11 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
4
|
require 'rspec/core/rake_task'
|
5
|
-
|
6
|
-
RSpec::Core::RakeTask.new(:spec)
|
7
|
-
|
8
5
|
require 'rubocop/rake_task'
|
9
6
|
|
10
7
|
RuboCop::RakeTask.new
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
11
9
|
|
12
|
-
task default: %i[spec
|
10
|
+
task default: %i[rubocop spec]
|
data/konsierge-notifier.gemspec
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
require_relative 'lib/konsierge/notifier/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
6
|
+
spec.name = 'konsierge-notifier'
|
7
7
|
spec.version = Konsierge::Notifier::VERSION
|
8
|
-
spec.author
|
9
|
-
spec.email
|
8
|
+
spec.author = 'David Rybolovlev'
|
9
|
+
spec.email = ['golifox911@gmail.com']
|
10
10
|
|
11
|
-
spec.summary
|
12
|
-
spec.description
|
11
|
+
spec.summary = 'Notifier for Konsierge.'
|
12
|
+
spec.description = spec.summary
|
13
13
|
spec.required_ruby_version = '>= 2.7.4'
|
14
14
|
|
15
15
|
spec.metadata['source_code_uri'] = 'https://gitlab.konsierge.com/digitalbox/gem/konsierge-notifier'
|
@@ -20,23 +20,14 @@ Gem::Specification.new do |spec|
|
|
20
20
|
f.start_with?(*%w[bin/ spec/ features/ .git .circleci appveyor Gemfile])
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
24
|
-
spec.
|
23
|
+
|
24
|
+
spec.bindir = 'exe'
|
25
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
25
26
|
spec.require_paths = ['lib']
|
26
27
|
|
27
28
|
spec.add_dependency 'dotenv', '~> 2.7'
|
28
|
-
|
29
|
-
# Telegram notifier
|
29
|
+
spec.add_dependency 'erb', '~> 2.0'
|
30
30
|
spec.add_dependency 'telegram-bot', '~> 0.16.1'
|
31
31
|
|
32
|
-
# Development and test dependencies
|
33
|
-
spec.add_development_dependency 'bundler', '~> 2.0'
|
34
|
-
spec.add_development_dependency 'rspec', '~> 3.10'
|
35
|
-
spec.add_development_dependency 'rspec-mocks', '~> 3.10'
|
36
|
-
spec.add_development_dependency 'rubocop', '~> 1.60'
|
37
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.11'
|
38
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 2.11'
|
39
|
-
spec.add_development_dependency 'simplecov', '~> 0.22'
|
40
|
-
|
41
32
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
42
33
|
end
|
@@ -14,7 +14,7 @@ module Generators
|
|
14
14
|
desc 'Creates a Konsierge::Notifier initializer for your application'
|
15
15
|
|
16
16
|
def copy_initializer
|
17
|
-
template '
|
17
|
+
template 'konsierge_notifier.rb', 'config/initializers/konsierge_notifier.rb'
|
18
18
|
|
19
19
|
# Code to copy the message and error_message erb templates
|
20
20
|
copy_file 'message_template.html.erb', 'lib/templates/konsierge_notifier/message.html.erb'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Konsierge
|
4
|
+
module Notifier
|
5
|
+
module Adapters
|
6
|
+
class BaseAdapter
|
7
|
+
def send_message(message, context: {}, **options)
|
8
|
+
raise NotImplementedError
|
9
|
+
end
|
10
|
+
|
11
|
+
def send_error(error, context: {}, source: nil, **options)
|
12
|
+
raise NotImplementedError
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'erb'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
require_relative 'base_adapter'
|
7
|
+
|
8
|
+
module Konsierge
|
9
|
+
module Notifier
|
10
|
+
module Adapters
|
11
|
+
class Telegram < BaseAdapter
|
12
|
+
TELEGRAM_CHAT_ID_NOT_SET = 'Telegram Chat ID is not set'
|
13
|
+
TELEGRAM_BOT_ERROR = 'TelegramBot Error: %s'
|
14
|
+
TELEGRAM_BOT_DISABLED = 'TelegramBot is disabled! Message not sent.'
|
15
|
+
PATH_OR_CHAT_ID_NOT_PROVIDED = 'Please, provide path and chat_id'
|
16
|
+
|
17
|
+
def send_message(message, context: {}, **options)
|
18
|
+
chat_id = options.delete(:chat_id)
|
19
|
+
|
20
|
+
template_params = {
|
21
|
+
app_name: Notifier.config.app_name,
|
22
|
+
message: message,
|
23
|
+
context: context
|
24
|
+
}
|
25
|
+
|
26
|
+
send_with_message_template(
|
27
|
+
path: Notifier.config.message_template_path,
|
28
|
+
chat_id: chat_id,
|
29
|
+
template_params: template_params
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def send_error(error, context: {}, source: nil, **options)
|
34
|
+
chat_id = options.delete(:chat_id)
|
35
|
+
|
36
|
+
template_params = {
|
37
|
+
app_name: Notifier.config.app_name,
|
38
|
+
error: error,
|
39
|
+
source: source,
|
40
|
+
context: context
|
41
|
+
}
|
42
|
+
|
43
|
+
send_with_message_template(
|
44
|
+
path: Notifier.config.error_template_path,
|
45
|
+
chat_id: chat_id,
|
46
|
+
template_params: template_params
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def send_with_message_template(**options)
|
53
|
+
return log_disabled_bot_warning unless bot_enabled?
|
54
|
+
|
55
|
+
opts = sanitize_template_options!(options)
|
56
|
+
|
57
|
+
provided_chat_id = opts.delete(:chat_id)
|
58
|
+
chat_id = check_chat_id!(provided_chat_id)
|
59
|
+
|
60
|
+
provided_path = opts.delete(:path)
|
61
|
+
template = ::ERB.new(File.read(provided_path))
|
62
|
+
|
63
|
+
template_params = opts.delete(:template_params)
|
64
|
+
message = template.result_with_hash(template_params)
|
65
|
+
|
66
|
+
send_to_telegram(message, chat_id: chat_id)
|
67
|
+
end
|
68
|
+
|
69
|
+
def send_to_telegram(text, chat_id:)
|
70
|
+
::Telegram.bot.send_message(chat_id: chat_id, text: text, parse_mode: Notifier.config.parse_mode)
|
71
|
+
|
72
|
+
true
|
73
|
+
rescue StandardError => e
|
74
|
+
Notifier.config.logger.error(TELEGRAM_BOT_ERROR % e.message)
|
75
|
+
false
|
76
|
+
end
|
77
|
+
|
78
|
+
def sanitize_template_options!(options)
|
79
|
+
opts = options.dup
|
80
|
+
|
81
|
+
unless %i[path chat_id template_params].all? { |key| opts.key?(key) }
|
82
|
+
raise ArgumentError, PATH_OR_CHAT_ID_NOT_PROVIDED
|
83
|
+
end
|
84
|
+
|
85
|
+
opts
|
86
|
+
end
|
87
|
+
|
88
|
+
def check_chat_id!(chat_id)
|
89
|
+
chat_id ||= Notifier.config.chat_id
|
90
|
+
|
91
|
+
raise TELEGRAM_CHAT_ID_NOT_SET unless chat_id
|
92
|
+
|
93
|
+
chat_id
|
94
|
+
end
|
95
|
+
|
96
|
+
def bot_enabled?
|
97
|
+
Notifier.config.bot_enabled
|
98
|
+
end
|
99
|
+
|
100
|
+
def log_disabled_bot_warning # rubocop:disable Naming/PredicateMethod
|
101
|
+
Notifier.config.logger.warn(TELEGRAM_BOT_DISABLED)
|
102
|
+
|
103
|
+
false
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -1,17 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'adapters/telegram'
|
4
|
+
|
3
5
|
module Konsierge
|
4
6
|
module Notifier
|
5
7
|
class Configuration
|
6
|
-
|
8
|
+
ADAPTER_IMPLEMENTATIONS = {
|
9
|
+
telegram: Adapters::Telegram
|
10
|
+
}.freeze
|
11
|
+
|
12
|
+
attr_accessor :app_name, :adapter, :chat_id, :bot_enabled, :message_template_path, :error_template_path, :logger,
|
7
13
|
:parse_mode
|
8
14
|
|
9
15
|
def initialize
|
10
16
|
@app_name = nil
|
17
|
+
@adapter = :telegram
|
18
|
+
@adapter_class = ADAPTER_IMPLEMENTATIONS[@adapter.to_s.to_sym]
|
11
19
|
@chat_id = ENV.fetch('TELEGRAM_CHANNEL_ID', nil)
|
12
20
|
@bot_enabled = ENV.fetch('TELEGRAM_BOT_ENABLED', false)
|
13
|
-
@message_template_path = File.expand_path('
|
14
|
-
@error_template_path = File.expand_path('
|
21
|
+
@message_template_path = File.expand_path('templates/telegram/message.html.erb', __dir__)
|
22
|
+
@error_template_path = File.expand_path('templates/telegram/error.html.erb', __dir__)
|
15
23
|
@logger = Logger.new($stdout)
|
16
24
|
@parse_mode = 'HTML'
|
17
25
|
end
|
@@ -21,6 +29,10 @@ module Konsierge
|
|
21
29
|
hash[var.to_s.delete('@').to_sym] = instance_variable_get(var)
|
22
30
|
end
|
23
31
|
end
|
32
|
+
|
33
|
+
def adapter_instance
|
34
|
+
@adapter_instance ||= @adapter_class.new
|
35
|
+
end
|
24
36
|
end
|
25
37
|
end
|
26
38
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Konsierge
|
4
|
+
module Notifier
|
5
|
+
class RailsReportSubscriber
|
6
|
+
# rubocop:disable Lint/UnusedMethodArgument
|
7
|
+
def report(error, handled:, severity:, context:, source: nil)
|
8
|
+
Notifier.send_error(error, source: source, context: context)
|
9
|
+
end
|
10
|
+
# rubocop:enable Lint/UnusedMethodArgument
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<b><%= CGI.escape_html(app_name.to_s) %></b>
|
2
|
+
<% "\n" %>
|
3
|
+
<b>Error</b>: <%= CGI.escape_html(error.class.to_s) %> - <%= CGI.escape_html(error.message.to_s) %>
|
4
|
+
<% "\n" %>
|
5
|
+
<b>Source</b>: <%= CGI.escape_html(source.to_s) %>
|
6
|
+
<% if context %>
|
7
|
+
<b>Context</b>: <%= CGI.escape_html(JSON.pretty_generate(context)) %>
|
8
|
+
<% end %>
|
9
|
+
<% if error&.backtrace && error.backtrace.any? %>
|
10
|
+
<b>Trace:</b>
|
11
|
+
<%= error.backtrace[0..2].map { |trace| "===> #{CGI.escape_html(trace.to_s)}" }.join("\n") %>
|
12
|
+
<% else %>
|
13
|
+
<b>No backtrace available</b>
|
14
|
+
<% end %>
|
data/lib/konsierge/notifier.rb
CHANGED
@@ -2,92 +2,41 @@
|
|
2
2
|
|
3
3
|
require 'logger'
|
4
4
|
require 'telegram/bot'
|
5
|
+
|
5
6
|
require_relative 'notifier/configuration'
|
7
|
+
require_relative 'notifier/adapters/telegram'
|
8
|
+
require_relative 'notifier/rails_report_subscriber'
|
6
9
|
|
7
10
|
module Konsierge
|
8
11
|
module Notifier
|
9
|
-
TELEGRAM_CHAT_ID_NOT_SET = 'Telegram Chat ID is not set'
|
10
|
-
TELEGRAM_BOT_ERROR = 'TelegramBot Error: %s'
|
11
|
-
TELEGRAM_BOT_DISABLED = 'TelegramBot is disabled! Message not sent.'
|
12
|
-
PATH_OR_CHAT_ID_NOT_PROVIDED = 'Please, provide path and chat_id'
|
13
|
-
|
14
12
|
class << self
|
15
13
|
def config
|
16
14
|
@config ||= Configuration.new
|
17
15
|
end
|
18
16
|
|
19
17
|
def configure
|
18
|
+
subscribe_on_reporter
|
19
|
+
|
20
20
|
yield(config)
|
21
21
|
end
|
22
22
|
|
23
|
-
def send_message(
|
24
|
-
|
25
|
-
path: config.message_template_path,
|
26
|
-
chat_id: chat_id,
|
27
|
-
app_name: config.app_name,
|
28
|
-
message: text
|
29
|
-
)
|
23
|
+
def send_message(...)
|
24
|
+
config.adapter_instance.send_message(...)
|
30
25
|
end
|
31
26
|
|
32
|
-
def
|
33
|
-
|
34
|
-
path: config.error_template_path,
|
35
|
-
chat_id: chat_id,
|
36
|
-
app_name: config.app_name,
|
37
|
-
error: error,
|
38
|
-
source: source
|
39
|
-
)
|
27
|
+
def send_error(...)
|
28
|
+
config.adapter_instance.send_error(...)
|
40
29
|
end
|
41
30
|
|
42
|
-
alias send_error
|
31
|
+
alias report_error send_error
|
43
32
|
|
44
33
|
private
|
45
34
|
|
46
|
-
def
|
47
|
-
return
|
48
|
-
|
49
|
-
opts = sanitize_template_options!(options)
|
50
|
-
chat_id = check_chat_id!(opts[:chat_id])
|
51
|
-
|
52
|
-
template = ERB.new(File.read(opts[:path]))
|
53
|
-
|
54
|
-
template_params = opts.except(:path, :chat_id)
|
55
|
-
message = template.result_with_hash(template_params)
|
56
|
-
|
57
|
-
send_to_telegram(message, chat_id: chat_id)
|
58
|
-
end
|
59
|
-
|
60
|
-
def send_to_telegram(text, chat_id:)
|
61
|
-
::Telegram.bot.send_message(chat_id: chat_id, text: text, parse_mode: config.parse_mode)
|
62
|
-
|
63
|
-
true
|
64
|
-
rescue StandardError => e
|
65
|
-
config.logger.error(TELEGRAM_BOT_ERROR % e.message)
|
66
|
-
false
|
67
|
-
end
|
68
|
-
|
69
|
-
def sanitize_template_options!(options)
|
70
|
-
opts = options.dup
|
71
|
-
raise ArgumentError, PATH_OR_CHAT_ID_NOT_PROVIDED unless %i[path chat_id].all? { |key| opts.key?(key) }
|
72
|
-
|
73
|
-
opts
|
74
|
-
end
|
75
|
-
|
76
|
-
def check_chat_id!(chat_id)
|
77
|
-
chat_id ||= config.chat_id
|
78
|
-
|
79
|
-
raise TELEGRAM_CHAT_ID_NOT_SET unless chat_id
|
80
|
-
|
81
|
-
chat_id
|
82
|
-
end
|
83
|
-
|
84
|
-
def bot_enabled?
|
85
|
-
config.bot_enabled
|
86
|
-
end
|
35
|
+
def subscribe_on_reporter
|
36
|
+
return unless defined?(Rails) && VERSION > '0.1.3' && Gem::Version.new(Rails.version).segments.first
|
87
37
|
|
88
|
-
|
89
|
-
|
90
|
-
false
|
38
|
+
config.logger.debug { 'Konsierge notifier is subscribing to Rails error reporter...' }
|
39
|
+
Rails.error.subscribe(RailsReportSubscriber.new)
|
91
40
|
end
|
92
41
|
end
|
93
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: konsierge-notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Rybolovlev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -25,27 +25,13 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.16.1
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.16.1
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
28
|
+
name: erb
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
33
|
version: '2.0'
|
48
|
-
type: :
|
34
|
+
type: :runtime
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
@@ -53,89 +39,19 @@ dependencies:
|
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '2.0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.10'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.10'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec-mocks
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '3.10'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '3.10'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '1.60'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '1.60'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-performance
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '1.11'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '1.11'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop-rspec
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '2.11'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '2.11'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: simplecov
|
42
|
+
name: telegram-bot
|
127
43
|
requirement: !ruby/object:Gem::Requirement
|
128
44
|
requirements:
|
129
45
|
- - "~>"
|
130
46
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
132
|
-
type: :
|
47
|
+
version: 0.16.1
|
48
|
+
type: :runtime
|
133
49
|
prerelease: false
|
134
50
|
version_requirements: !ruby/object:Gem::Requirement
|
135
51
|
requirements:
|
136
52
|
- - "~>"
|
137
53
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
54
|
+
version: 0.16.1
|
139
55
|
description: Notifier for Konsierge.
|
140
56
|
email:
|
141
57
|
- golifox911@gmail.com
|
@@ -154,15 +70,15 @@ files:
|
|
154
70
|
- konsierge-notifier.gemspec
|
155
71
|
- lib/generators/install/konsierge_notifier.rb
|
156
72
|
- lib/generators/install/templates/error_template.html.erb
|
157
|
-
- lib/generators/install/templates/
|
73
|
+
- lib/generators/install/templates/konsierge_notifier.rb
|
158
74
|
- lib/generators/install/templates/template.html.erb
|
159
|
-
- lib/generators/konsierge/notifier/mailer/install_generator.rb
|
160
|
-
- lib/generators/konsierge/notifier/mailer/templates/README
|
161
|
-
- lib/generators/konsierge/notifier/mailer/templates/initializer.rb
|
162
75
|
- lib/konsierge/notifier.rb
|
76
|
+
- lib/konsierge/notifier/adapters/base_adapter.rb
|
77
|
+
- lib/konsierge/notifier/adapters/telegram.rb
|
163
78
|
- lib/konsierge/notifier/configuration.rb
|
164
|
-
- lib/konsierge/notifier/
|
165
|
-
- lib/konsierge/notifier/
|
79
|
+
- lib/konsierge/notifier/rails_report_subscriber.rb
|
80
|
+
- lib/konsierge/notifier/templates/telegram/error.html.erb
|
81
|
+
- lib/konsierge/notifier/templates/telegram/message.html.erb
|
166
82
|
- lib/konsierge/notifier/version.rb
|
167
83
|
- mise.toml
|
168
84
|
- sig/konsierge.rbs
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails/generators'
|
4
|
-
|
5
|
-
module KonsiergeSmtpMailer
|
6
|
-
class InstallGenerator < ::Rails::Generators::Base
|
7
|
-
source_root File.expand_path('templates', __dir__)
|
8
|
-
desc 'Installs KonsiergeSmtpMailer.'
|
9
|
-
|
10
|
-
def install
|
11
|
-
template 'initializer.rb', 'config/initializers/konsierge-smtp-mailer.rb'
|
12
|
-
readme 'README'
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
===============================================================================
|
2
|
-
|
3
|
-
There is a setup that you need to do before you can use KonsiergeSmtpMailer.
|
4
|
-
|
5
|
-
Step 1.
|
6
|
-
Go to config/initializers/konsierge-smtp-mailer.rb and configure
|
7
|
-
smtp_mailer_host and smtp_mailer_auth_key.
|
8
|
-
|
9
|
-
Step 2.
|
10
|
-
Set new mailer in environment files:
|
11
|
-
|
12
|
-
config.action_mailer.delivery_method = :konsierge_smtp_mailer
|
13
|
-
|
14
|
-
Step 3.
|
15
|
-
That's it, that's all. Enjoy!
|
16
|
-
|
17
|
-
===============================================================================
|
18
|
-
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
ActionMailer::Base.add_delivery_method :konsierge_notifier, Konsierge::Notifier::Mailer
|
4
|
-
|
5
|
-
Konsierge::Notifier::Mailer.configure do |config|
|
6
|
-
config.smtp_mailer_host = ENV.fetch('KONSIERGE_SMTP_MAILER_HOST', nil)
|
7
|
-
config.smtp_mailer_auth_key = ENV.fetch('KONSIERGE_SMTP_MAILER_AUTH_KEY', nil)
|
8
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<b><%= CGI.escape_html(app_name.to_s) %></b>
|
2
|
-
<% "\n" %>
|
3
|
-
<b>Error</b>: <%= CGI.escape_html(error.class.to_s) %> - <%= CGI.escape_html(error.message.to_s) %>
|
4
|
-
<% "\n" %>
|
5
|
-
<b>Source</b>: <%= CGI.escape_html(source.to_s) %>
|
6
|
-
<% "\n" %>
|
7
|
-
<b>Trace:</b>
|
8
|
-
<%= error.backtrace[0..2].flatten.map { |trace| "===> #{CGI.escape_html(trace.to_s)}" }.join("\n") %>
|
File without changes
|