kanal 0.4.0 → 0.4.2

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
  SHA256:
3
- metadata.gz: 36d8d91a78e9f227b53d4b8f2221fed9890670c327477d4ce1e2506e70e7ac3d
4
- data.tar.gz: 66bb506e933b59e5de10595a5f9a08e5225048d71d75d9c605a3a60e7fc2bf45
3
+ metadata.gz: 3a651f7ffee3a091afafa59e96d5c4e90d3f15ebd8fe5c0991ef0f3d25559cb5
4
+ data.tar.gz: 80a337f6047a542982f5167a1a15c73a9df90ffa95d6d24dc07bba881a4f575e
5
5
  SHA512:
6
- metadata.gz: 2baebfec99a7f2b973a37b07f681743cb6778856012a2530bfc5421a4d9eea6d7be1882881dc777e78fd660374c660e0d51a3f9bede04a1b2b0c47b050eebf52
7
- data.tar.gz: b904037d8384582b2802ff714df534451642a3811981257619520584e486beaed43b9a22ee76a3ef81344921b9829ae8bc9950c7a26553b891f318b19ec29d13
6
+ metadata.gz: 69b67d9f7886722abe0cc0b8ba27e30daecde925a275e3147b38c5b80bb1b9d041d1acdd33151be97c8e4a668888fbcf1819192dceb763e52104bfaa97a56ce4
7
+ data.tar.gz: fb12441c0c5797397cbc40e4517cc23c6a70c6604a0314961d4c9b203c02130464baefda7c6671cd31733112d4f131076de3d92482d695f10b7898c7b5c7b2c8
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.2] 2023-03-22
4
+ - Adding any number of loggers can be now done with core.add_logger(l) - where l is logger that have same methods as default ruby logger (debug, warn, fatal, etc)
5
+ - To get logger into your class you can include Kanal::Core::Logging::Logger - this will give you method .logger to get logger
6
+ - Batteries now have .keyboard output property and several conditions for input
7
+
8
+ ## [0.4.1] 2023-03-16
9
+ - Added Attachment that can be used inside new input parameters in Batteries plugin
10
+ - New input and output parameters in Batteries plugin: image, audio, file
11
+
3
12
  ## [0.4.0] 2023-03-10
4
13
  - Added logging feature to Kanal, for a time being - just stdout
5
14
  - Error response, now Kanal Router accepts error response block, when things go haywire inside constructing output
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kanal (0.3.0)
4
+ kanal (0.4.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -105,4 +105,4 @@ DEPENDENCIES
105
105
  yard
106
106
 
107
107
  BUNDLED WITH
108
- 2.3.12
108
+ 2.3.19
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "../logger/logging"
3
+ require_relative "../logging/logger"
4
4
 
5
5
  module Kanal
6
6
  module Core
@@ -8,7 +8,7 @@ module Kanal
8
8
  # Base class for conditions
9
9
  # with this class you can
10
10
  class Condition
11
- include Logging
11
+ include Logging::Logger
12
12
 
13
13
  attr_reader :name
14
14
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "../logger/logging"
3
+ require_relative "../logging/logger"
4
4
 
5
5
  module Kanal
6
6
  module Core
@@ -8,7 +8,7 @@ module Kanal
8
8
  # This class helps creating conditions in dsl way,
9
9
  # with using helper methods
10
10
  class ConditionCreator
11
- include Logging
11
+ include Logging::Logger
12
12
 
13
13
  def initialize(name)
14
14
  @name = name
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "./condition"
4
4
  require_relative "./condition_creator"
5
- require_relative "../logger/logging"
5
+ require_relative "../logging/logger"
6
6
 
7
7
  module Kanal
8
8
  module Core
@@ -11,7 +11,7 @@ module Kanal
11
11
  # It is served as some kind of namespace for conditions, with specific
12
12
  # name of pack and helper methods
13
13
  class ConditionPack
14
- include Logging
14
+ include Logging::Logger
15
15
 
16
16
  attr_reader :name
17
17
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "./condition_pack"
4
4
  require_relative "./condition_creator"
5
- require_relative "../logger/logging"
5
+ require_relative "../logging/logger"
6
6
 
7
7
  module Kanal
8
8
  module Core
@@ -10,7 +10,7 @@ module Kanal
10
10
  # This class helps in condition pack creation
11
11
  # with the help of dsl
12
12
  class ConditionPackCreator
13
- include Logging
13
+ include Logging::Logger
14
14
 
15
15
  TEMP_NAME = :temp_name
16
16
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "../logger/logging"
3
+ require_relative "../logging/logger"
4
4
 
5
5
  module Kanal
6
6
  module Core
@@ -8,7 +8,7 @@ module Kanal
8
8
  # This class contains all needed functionality to store,
9
9
  # search conditions
10
10
  class ConditionStorage
11
- include Logging
11
+ include Logging::Logger
12
12
 
13
13
  def initialize
14
14
  @condition_packs = []
@@ -8,8 +8,8 @@ require_relative "./helpers/parameter_registrator"
8
8
  require_relative "./plugins/plugin"
9
9
  require_relative "./input/input"
10
10
  require_relative "./services/service_container"
11
- require_relative "./logger/logging"
12
-
11
+ require_relative "./logging/logger"
12
+ require_relative "./logging/configuration"
13
13
 
14
14
  module Kanal
15
15
  module Core
@@ -36,6 +36,7 @@ module Kanal
36
36
  include Plugins
37
37
  include Hooks
38
38
  include Services
39
+ include Logging::Logger
39
40
  include Logging
40
41
 
41
42
  # @return [Kanal::Core::Conditions::ConditionStorage]
@@ -223,9 +224,14 @@ module Kanal
223
224
  def register_hooks
224
225
  @hooks.register :input_just_created # input
225
226
  @hooks.register :input_before_router # input
227
+ @hooks.register :output_just_created # input, output
226
228
  @hooks.register :output_before_returned # input, output
227
229
  end
228
230
 
231
+ def add_logger(logger)
232
+ Kanal::Core::Logging::Configuration.add_logger logger
233
+ end
234
+
229
235
  private :register_hooks
230
236
  end
231
237
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "parameter_bag"
4
- require_relative "../logger/logging"
4
+ require_relative "../logging/logger"
5
5
 
6
6
  module Kanal
7
7
  module Core
@@ -10,7 +10,7 @@ module Kanal
10
10
  # and if they are has needed by registrator allowances, types etc, whatever
11
11
  # registrator rules are stored for property
12
12
  class ParameterBagWithRegistrator < ParameterBag
13
- include Logging
13
+ include Logging::Logger
14
14
 
15
15
  def initialize(registrator)
16
16
  super()
@@ -23,7 +23,7 @@ module Kanal
23
23
  # like that
24
24
  # setters: prop value
25
25
  # getters: prop
26
- @parameter_bag.set(parameter_name, *args)
26
+ @parameter_bag.set parameter_name, args.first
27
27
  # means it is used as setter in dsl,
28
28
  # method call with argument
29
29
  else
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "../logger/logging"
3
+ require_relative "../logging/logger"
4
4
 
5
5
  module Kanal
6
6
  module Core
@@ -21,7 +21,7 @@ module Kanal
21
21
  # Class holds parameter names that are allowed
22
22
  # to be used.
23
23
  class ParameterRegistrator
24
- include Logging
24
+ include Logging::Logger
25
25
 
26
26
  def initialize
27
27
  @parameters_by_name = {}
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../output/output"
4
- require_relative "../logger/logging"
4
+ require_relative "../logging/logger"
5
5
 
6
6
  module Kanal
7
7
  module Core
8
8
  module Helpers
9
9
  class ResponseExecutionBlock
10
10
  include Output
11
- include Logging
11
+ include Logging::Logger
12
12
 
13
13
  attr_reader :response_block, :input
14
14
 
@@ -40,6 +40,8 @@ module Kanal
40
40
  output = Output::Output.new core.output_parameter_registrator, input, core
41
41
 
42
42
  begin
43
+ core.hooks.call :output_just_created, input, output
44
+
43
45
  output.instance_eval(&@response_block.block)
44
46
 
45
47
  core.hooks.call :output_before_returned, input, output
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "../logger/logging"
3
+ require_relative "../logging/logger"
4
4
 
5
5
  module Kanal
6
6
  module Core
@@ -10,7 +10,7 @@ module Kanal
10
10
  # attaching to hooks, calling hooks with arguments
11
11
  #
12
12
  class HookStorage
13
- include Logging
13
+ include Logging::Logger
14
14
 
15
15
  def initialize
16
16
  @listeners = {}
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kanal
4
+ module Core
5
+ module Logging
6
+ class CompositeLogger
7
+ # Property allowed_methods defines which methods can be called.
8
+ # These methods mirror standard Logger methods.
9
+ def initialize
10
+ @loggers = []
11
+ @allowed_methods = [:debug, :info, :warn, :error, :fatal, :unknown]
12
+ end
13
+
14
+ def add_logger(logger)
15
+ @loggers << logger
16
+ end
17
+
18
+ # This method gets called when calling any method in @allowed_methods.
19
+ # It passes message string to method call of every added logger.
20
+ #
21
+ # @param method [Symbol]
22
+ # @param message [String]
23
+ def method_missing(method, message)
24
+ # Getting caller class name to put into log message later.
25
+ begin
26
+ caller_class_name = "[" + caller[0].split(".rb").first.split("/").last.split('_').collect(&:capitalize).join + "]"
27
+ rescue
28
+ caller_class_name = "[ErrorGettingClassName]"
29
+ end
30
+
31
+ raise "Wrong method called for CompositeLogger" unless @allowed_methods.include? method
32
+
33
+ @loggers.each do |logger|
34
+ # progname is a property of standard Logger. It is a prefix for log message.
35
+ # In our case progname is used to store class name of class which calls for CompositeLogger methods.
36
+ logger.progname = caller_class_name
37
+ logger.send method, message
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "composite_logger"
4
+
5
+ module Kanal
6
+ module Core
7
+ module Logging
8
+ module Configuration
9
+ class << self
10
+ def composite_logger
11
+ get_or_create_composite_logger
12
+ end
13
+
14
+ def add_logger(logger)
15
+ @composite_logger.add_logger logger
16
+ end
17
+
18
+ private
19
+
20
+ def get_or_create_composite_logger
21
+ @composite_logger ||= CompositeLogger.new
22
+
23
+ @composite_logger
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "logger"
4
+
5
+ module Kanal
6
+ module Core
7
+ module Logging
8
+ # Mixing in Logger in some class to get access to logger method
9
+ module Logger
10
+ # @return [CompositeLogger]
11
+ def logger
12
+ Kanal::Core::Logging::Configuration.composite_logger
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -3,7 +3,7 @@
3
3
  require_relative "./router_node"
4
4
  require_relative "../helpers/queue"
5
5
  require_relative "../helpers/response_execution_block"
6
- require_relative "../logger/logging"
6
+ require_relative "../logging/composite_logger"
7
7
 
8
8
  module Kanal
9
9
  module Core
@@ -14,7 +14,7 @@ module Kanal
14
14
  # router nodes and have a name.
15
15
  class Router
16
16
  include Helpers
17
- include Logging
17
+ include Logging::Logger
18
18
 
19
19
  attr_reader :name, :core, :output_ready_block
20
20
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "../output/output"
4
4
  require_relative "../helpers/response_block"
5
- require_relative "../logger/logging"
5
+ require_relative "../logging/composite_logger"
6
6
 
7
7
  module Kanal
8
8
  module Core
@@ -14,7 +14,7 @@ module Kanal
14
14
  class RouterNode
15
15
  include Output
16
16
  include Helpers
17
- include Logging
17
+ include Logging::Logger
18
18
 
19
19
  attr_reader :parent,
20
20
  :children
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "../logger/logging"
3
+ require_relative "../logging/logger"
4
4
 
5
5
  module Kanal
6
6
  module Core
@@ -28,7 +28,7 @@ module Kanal
28
28
  # lifespan types.
29
29
  #
30
30
  class ServiceContainer
31
- include Logging
31
+ include Logging::Logger
32
32
 
33
33
  TYPE_SINGLETON = :singleton
34
34
  TYPE_TRANSIENT = :transient
@@ -0,0 +1,163 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fileutils"
4
+ require "uri"
5
+ require 'open-uri'
6
+
7
+ module Kanal
8
+ module Plugins
9
+ module Batteries
10
+ module Attachments
11
+ class Attachment
12
+ attr_reader :url
13
+
14
+ def initialize(url)
15
+ @url = url
16
+ end
17
+
18
+ def audio?
19
+ mp3? || wav? || ogg?
20
+ end
21
+
22
+ def mp3?
23
+ extension == "mp3"
24
+ end
25
+
26
+ def wav?
27
+ extension == "wav"
28
+ end
29
+
30
+ def ogg?
31
+ extension == "ogg"
32
+ end
33
+
34
+ def document?
35
+ doc? || docx? || odf?
36
+ end
37
+
38
+ def doc?
39
+ extension == "doc"
40
+ end
41
+
42
+ def docx?
43
+ extension == "docx"
44
+ end
45
+
46
+ def odf?
47
+ extension == "odf"
48
+ end
49
+
50
+ def image?
51
+ jpg? || jpeg? || png? || bpm? || gif?
52
+ end
53
+
54
+ def jpg?
55
+ extension == "jpg"
56
+ end
57
+
58
+ def jpeg?
59
+ extension == "jpeg"
60
+ end
61
+
62
+ def png?
63
+ extension == "png"
64
+ end
65
+
66
+ def bpm?
67
+ extension == "bpm"
68
+ end
69
+
70
+ def gif?
71
+ extension == "gif"
72
+ end
73
+
74
+ def video?
75
+ mp4? || mov? || mkv?
76
+ end
77
+
78
+ def mp4?
79
+ extension == "mp4"
80
+ end
81
+
82
+ def mov?
83
+ extension == "mov"
84
+ end
85
+
86
+ def mkv?
87
+ extension == "mkv"
88
+ end
89
+
90
+ #
91
+ # Method that returns extension of url file if possible
92
+ # For example calling extension https://123.txt?something=1 will return 'txt'
93
+ #
94
+ # @return [String, nil]
95
+ #
96
+ def extension
97
+ uri = URI.parse(@url)
98
+ return nil if uri.path.nil?
99
+
100
+ File.extname(uri.path).split(".").last if File.basename(uri.path).include? "."
101
+ end
102
+
103
+ #
104
+ # Saves file to specified path. End user provides full filepath.
105
+ #
106
+ # @param [String] <Full filepath>
107
+ # @param [Boolean] <Should directories be created or not>
108
+ #
109
+ # @return [void]
110
+ #
111
+ def save(filepath, create_dirs = false)
112
+ stream = URI.open(@url)
113
+
114
+ save_stream_to_file stream, filepath, create_dirs
115
+ end
116
+
117
+ #
118
+ # Saves file. End user provides directory only. Filename gets generated, extension is read from url.
119
+ #
120
+ # @param [String] <Directory>
121
+ # @param [Boolean] <Should directories be created or not>
122
+ # @param [Integer] <Length of filename to generate>
123
+ #
124
+ # @return [String] Full filepath to saved file
125
+ #
126
+ def quick_save(directory, create_dir = false, filename_length = 32)
127
+ filename = generate_filename filename_length, extension
128
+
129
+ return quick_save directory, create_dir, filename_length if File.exist? filename
130
+
131
+ save directory + filename, create_dir
132
+
133
+ directory + filename
134
+ end
135
+
136
+ private
137
+
138
+ def generate_filename(filename_length, extension = nil)
139
+ alphanumeric = "abcdefghijkmnopQRSTUVWNXYZW12345676789-".chars
140
+
141
+ name = ""
142
+
143
+ filename_length.times do
144
+ name += alphanumeric.sample
145
+ end
146
+
147
+ extension ? "#{name}.#{extension}" : name
148
+ end
149
+
150
+ def save_stream_to_file(stream, filepath, create_dirs)
151
+ raise "File with that name already exists!" if File.exist? filepath
152
+
153
+ if create_dirs == true
154
+ FileUtils.mkdir_p(File.dirname(filepath)) unless File.directory?(File.dirname(filepath))
155
+ end
156
+
157
+ IO.copy_stream stream, filepath
158
+ end
159
+ end
160
+ end
161
+ end
162
+ end
163
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "kanal/core/plugins/plugin"
4
+ require_relative "keyboard"
4
5
 
5
6
  module Kanal
6
7
  module Plugins
@@ -16,6 +17,8 @@ module Kanal
16
17
  source_batteries core
17
18
  body_batteries core
18
19
  flow_batteries core
20
+ attachments_batteries core
21
+ keyboard_batteries core
19
22
  end
20
23
 
21
24
  def flow_batteries(core)
@@ -110,6 +113,24 @@ module Kanal
110
113
  end
111
114
  end
112
115
  end
116
+
117
+ def attachments_batteries(core)
118
+ core.register_input_parameter :image
119
+ core.register_input_parameter :audio
120
+ core.register_input_parameter :file
121
+
122
+ core.register_output_parameter :image
123
+ core.register_output_parameter :audio
124
+ core.register_output_parameter :file
125
+ end
126
+
127
+ def keyboard_batteries(core)
128
+ core.register_output_parameter :keyboard
129
+
130
+ core.hooks.attach :output_just_created do |input, output|
131
+ output.keyboard = Keyboard.new
132
+ end
133
+ end
113
134
  end
114
135
  end
115
136
  end
@@ -0,0 +1,98 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "kanal/core/logging/composite_logger"
4
+
5
+ module Kanal
6
+ module Plugins
7
+ module Batteries
8
+ #
9
+ # This class provides methods to construct and get keyboard.
10
+ # You can construct keyboard inside respond do block in router.
11
+ # There are two ways of constructing a keyboard
12
+ # 1. Using #to_array method: provide 2-dimensional array of button names
13
+ # 2. Using #build method: provide block with calls to DSL method #row with button names as arguments
14
+ #
15
+ class Keyboard
16
+ include Kanal::Core::Logging
17
+
18
+ def initialize
19
+ @layout = []
20
+ end
21
+
22
+ # Use this method to pass names for buttons in 2-dimensional array of strings.
23
+ # Each sub-array represents a row of button names.
24
+ # Example call below is two rows of button names:
25
+ # keyboard.from_array [["B1", "B2"], ["B3"]]
26
+ #
27
+ # @param array [Array<Array<String>>]
28
+ #
29
+ def from_array(array)
30
+ unless array.instance_of? Array
31
+ logger.error "2-dimensional array was not provided. Type of provided object is #{array.class.name}"
32
+
33
+ raise "2-dimensional array was not provided"
34
+ end
35
+
36
+ array.each do |sub_array|
37
+ unless sub_array.instance_of? Array
38
+ logger.error "Value provided as row is not of Array type. Type of provided object is #{sub_array.class.name}"
39
+
40
+ raise "Value provided as row is not of Array type"
41
+ end
42
+
43
+ sub_array.each do |value|
44
+ unless value.instance_of? String
45
+ logger.error "Value provided as button name is not of String type. Type of provided object is #{sub_array.class.name}"
46
+
47
+ raise "Value provided as button name is not of String type"
48
+ end
49
+ end
50
+ end
51
+
52
+ @layout = array
53
+ end
54
+
55
+ #
56
+ # Use this method to pass block. Code inside block should call for DSL method row.
57
+ # Example below is two rows of button names
58
+ # keyboard.build do
59
+ # row "B", "B2"
60
+ # row "B3"
61
+ # end
62
+ #
63
+ # @param block [Proc]
64
+ #
65
+ def build(&block)
66
+ instance_eval &block
67
+ end
68
+
69
+ #
70
+ # Creates a row of button names, takes each provided arg and adds it to a row
71
+ #
72
+ # @param args [Array<String>]
73
+ #
74
+ def row(*args)
75
+ args.each do |value|
76
+ unless value.instance_of? String
77
+ logger.error "Value provided as button name is not of String type. Type of provided object is #{sub_array.class.name}"
78
+
79
+ raise "Value provided as button name is not of String type"
80
+ end
81
+ end
82
+
83
+ @layout.append args
84
+ end
85
+
86
+ #
87
+ # Returns constructed 2-dimensional array of strings.
88
+ # Each sub-array represents a row of button names.
89
+ #
90
+ # @return [Array<Array<String>>]
91
+ #
92
+ def to_a
93
+ @layout
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
data/lib/kanal/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kanal
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kanal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - idchlife
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-10 00:00:00.000000000 Z
11
+ date: 2023-03-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Thanks to the core library, ecosystem of Kanal tools can be extendted
14
14
  to use with input-output bot-like behaviour, with routing
@@ -29,7 +29,6 @@ files:
29
29
  - LICENSE.txt
30
30
  - README.md
31
31
  - Rakefile
32
- - kanal.gemspec
33
32
  - lib/kanal.rb
34
33
  - lib/kanal/core/conditions/condition.rb
35
34
  - lib/kanal/core/conditions/condition_creator.rb
@@ -49,7 +48,9 @@ files:
49
48
  - lib/kanal/core/hooks/hook_storage.rb
50
49
  - lib/kanal/core/input/input.rb
51
50
  - lib/kanal/core/interfaces/interface.rb
52
- - lib/kanal/core/logger/logging.rb
51
+ - lib/kanal/core/logging/composite_logger.rb
52
+ - lib/kanal/core/logging/configuration.rb
53
+ - lib/kanal/core/logging/logger.rb
53
54
  - lib/kanal/core/output/output.rb
54
55
  - lib/kanal/core/output/output_creator.rb
55
56
  - lib/kanal/core/plugins/plugin.rb
@@ -58,7 +59,9 @@ files:
58
59
  - lib/kanal/core/router/router_storage.rb
59
60
  - lib/kanal/core/services/service_container.rb
60
61
  - lib/kanal/interfaces/simple_cli/simple_cli_interface.rb
62
+ - lib/kanal/plugins/batteries/attachments/attachment.rb
61
63
  - lib/kanal/plugins/batteries/batteries_plugin.rb
64
+ - lib/kanal/plugins/batteries/keyboard.rb
62
65
  - lib/kanal/version.rb
63
66
  - sig/kanal.rbs
64
67
  - sig/kanal/core/conditions/condition_pack.rbs
@@ -72,7 +75,7 @@ metadata:
72
75
  source_code_uri: https://github.com/idchlife/kanal
73
76
  changelog_uri: https://github.com/idchlife/kanal/CHANGELOG.md
74
77
  rubygems_mfa_required: 'true'
75
- post_install_message:
78
+ post_install_message:
76
79
  rdoc_options: []
77
80
  require_paths:
78
81
  - lib
@@ -88,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
91
  version: '0'
89
92
  requirements: []
90
93
  rubygems_version: 3.1.6
91
- signing_key:
94
+ signing_key:
92
95
  specification_version: 4
93
96
  summary: Kanal library
94
97
  test_files: []
data/kanal.gemspec DELETED
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/kanal/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "kanal"
7
- spec.version = Kanal::VERSION
8
- spec.authors = ["idchlife"]
9
- spec.email = ["idchlife@gmail.com"]
10
-
11
- spec.summary = "Kanal library"
12
- spec.description = "Thanks to the core library, ecosystem of Kanal tools can be extendted to use with input-output bot-like behaviour, with routing"
13
- spec.homepage = "https://idchlife.github.io/kanal-documentation/"
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.7.6"
16
-
17
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
-
19
- spec.metadata["homepage_uri"] = spec.homepage
20
- spec.metadata["source_code_uri"] = "https://github.com/idchlife/kanal"
21
- spec.metadata["changelog_uri"] = "https://github.com/idchlife/kanal/CHANGELOG.md"
22
-
23
- # Specify which files should be added to the gem when it is released.
24
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
- spec.files = Dir.chdir(__dir__) do
26
- `git ls-files -z`.split("\x0").reject do |f|
27
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
- end
29
- end
30
- spec.bindir = "exe"
31
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
- spec.require_paths = ["lib"]
33
-
34
- # Uncomment to register a new dependency of your gem
35
- # spec.add_dependency "example-gem", "~> 1.0"
36
-
37
- # For more information and examples about making a new gem, check out our
38
- # guide at: https://bundler.io/guides/creating_gem.html
39
- spec.metadata["rubygems_mfa_required"] = "true"
40
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "logger"
4
-
5
- module Kanal
6
- module Core
7
- module Logging
8
- # Logger instance will be saved inside class itself for future calls
9
- @logger_instance
10
-
11
- # Mixing in Logger in some class adds possibility to use logger instance method
12
- def logger
13
- @logger_instance ||= Logging.create_logger self.class.name
14
- end
15
-
16
- class << self
17
- def create_logger(class_name)
18
- logger = Logger.new STDOUT
19
- logger.progname = class_name.rpartition(':').last
20
- logger.datetime_format = "%d-%m-%Y %H:%M:%S"
21
- logger
22
- end
23
- end
24
- end
25
- end
26
- end