dialog_ruby 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +13 -0
  3. data/{lib/storage/redis → _dev}/redisPubSub.rb +1 -1
  4. data/background/_init.rb +43 -0
  5. data/background/batch.rb +69 -0
  6. data/background/redis.rb +34 -0
  7. data/dialog_ruby.gemspec +6 -7
  8. data/exec/conf/redis_global.conf +4 -2
  9. data/exec/dialog.sh +28 -26
  10. data/exec/git_sync/dialog__sync.service +1 -1
  11. data/exec/prereq.sh +18 -1
  12. data/exec/systemd/dialog_background.service +29 -0
  13. data/exec/systemd/dialog_redis.service +1 -1
  14. data/exec/systemd/dialog_runMode@.service +16 -6
  15. data/exec/systemd/dialog_runner@.path +8 -0
  16. data/lib/{triggers/start → begin}/_main.rb +29 -21
  17. data/lib/begin/_pre_bot.rb +58 -0
  18. data/lib/begin/background.rb +24 -0
  19. data/lib/{triggers/start → begin}/bot.rb +27 -6
  20. data/lib/{triggers/start → begin}/tdlib.rb +12 -16
  21. data/lib/configuration.rb +39 -27
  22. data/lib/dialect/canvas/element/send/Inline_query_result.rb +2 -0
  23. data/lib/dialect/canvas/element/send/background.rb +28 -0
  24. data/lib/dialect/canvas/element/send/recognize.rb +3 -2
  25. data/lib/dialect/canvas/element/send/restrict.rb +0 -1
  26. data/lib/dialect/canvas/element/send/tdlib_chat.rb +1 -1
  27. data/lib/dialect/canvas/element/send/tdlib_message.rb +1 -1
  28. data/lib/dialect/codegen/codegen.rb +9 -9
  29. data/lib/dialect/codegen/erb/functional/2.2.1.Events2ModReceive.erb +27 -4
  30. data/lib/dialect/codegen/erb/functional/4.1.AppEvent2Elements.erb +7 -2
  31. data/lib/dialect/codegen/erb/functional/5.1.Element2ModElements.erb +1 -1
  32. data/lib/dialect/codegen/erb/functional/7.ElementChains.erb +7 -6
  33. data/lib/dialog_ruby.rb +5 -2
  34. data/lib/metamess/_run.rb +1 -0
  35. data/lib/metamess/content/content_o-contact_f.rb +41 -0
  36. data/lib/metamess/content/content_o.rb +7 -6
  37. data/lib/metamess/func.rb +0 -24
  38. data/lib/metamess/naming.rb +8 -5
  39. data/lib/metamess/service/service_o-inline_f.rb +4 -3
  40. data/lib/require.rb +21 -2
  41. data/lib/statistics/func.rb +72 -0
  42. data/lib/statistics/general.rb +44 -0
  43. data/lib/statistics/redisDump.rb +49 -0
  44. data/lib/storage/redis/cached/pullpush.rb +76 -0
  45. data/lib/storage/redis/cached/pushPreproc.rb +41 -0
  46. data/lib/storage/redis/func.rb +47 -0
  47. data/lib/storage/redis/stat/push.rb +33 -0
  48. data/lib/tdlib/auth.rb +8 -7
  49. data/lib/tdlib/init.rb +5 -5
  50. data/lib/telegram/botapi.rb +2 -1
  51. data/lib/telegram/wrappers.rb +1 -2
  52. data/lib/tooling/log.rb +0 -1
  53. data/lib/tooling/strings.rb +12 -0
  54. data/lib/triggers/_func.rb +39 -0
  55. data/lib/triggers/{_meta/full.rb → console_start.rb} +8 -5
  56. data/lib/triggers/deploy.rb +104 -0
  57. data/lib/triggers/false.rb +8 -6
  58. data/lib/triggers/init.rb +23 -10
  59. data/lib/triggers/systemd_start.rb +24 -0
  60. data/lib/version.rb +1 -1
  61. metadata +83 -41
  62. data/_dev/sidekiq.rb +0 -28
  63. data/exec/systemd/_fix/dialog_bot@.path +0 -6
  64. data/exec/systemd/_fix/dialog_bot_dev@.path +0 -6
  65. data/exec/systemd/_fix/dialog_bot_dev_pre@.service +0 -16
  66. data/lib/storage/redis/rediscached.rb +0 -97
  67. data/lib/triggers/deploy/deploy.rb +0 -78
  68. data/lib/triggers/start/_pre_bot.rb +0 -43
@@ -0,0 +1,76 @@
1
+ ######## ####### ######## ####### ######## ########
2
+ ## / / / / License \ \ \ \
3
+ ## Copyleft culture, Copyright (C) is prohibited here
4
+ ## This work is licensed under a CC BY-SA 4.0
5
+ ## Creative Commons Attribution-ShareAlike 4.0 License
6
+ ## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
7
+ ######## ####### ######## ####### ######## ########
8
+ ## / / / / Code Climate \ \ \ \
9
+ ## Language = ruby
10
+ ## Indent = space; 2 chars;
11
+ ######## ####### ######## ####### ######## ########
12
+
13
+ module Dialog
14
+ module Storage
15
+ module Redis
16
+ class << self
17
+
18
+
19
+ def typeKeyDescr(query, args)
20
+ case query[:type]
21
+ when 'chat'
22
+ query[:typeKey] = args[:mmsg][:fqndata][:o][:chat][:id]
23
+ query[:pushCache] = true if query[:key] == 'context'
24
+ when 'user'
25
+ query[:typeKey] = args[:mmsg][:fqndata][:o][:from][:id]
26
+ end
27
+ end
28
+
29
+
30
+ def pullCached(query, args)
31
+ typeKeyDescr(query, args)
32
+ a = redisDo({:type => :cache,
33
+ :op => :read,
34
+ :data => {hname: "#{query[:type]}:#{query[:typeKey]}", k: query[:key]},
35
+ :query => query})
36
+ #[0] # possible BUG - first array element
37
+
38
+ Dialog.logger.debug "Redis Request: #{query}"
39
+
40
+ if a.nil? and query[:pushCache] == true
41
+ a = pushCachedPreproc(query, args)
42
+ else
43
+ Dialog.logger.debug "Using cached query for the upper request"
44
+ end
45
+ end
46
+
47
+
48
+ def pushCachedPreproc(query, args)
49
+ typeKeyDescr(query, args)
50
+ Dialog.logger.debug "Redis pushToCache, typeKey::#{query[:typeKey]}, type::#{query[:type]}"
51
+
52
+ case query[:type]
53
+ when 'chat'
54
+ case query[:key]
55
+ when 'context'
56
+ res = pushCachedPreprocChatContext(query, args)
57
+ end
58
+
59
+ when 'user'
60
+ case query[:key]
61
+ when :example
62
+ true
63
+ end
64
+ end
65
+
66
+ return redisDo({:type => :cache,
67
+ :op => :write,
68
+ :data => {hname: "#{query[:type]}:#{query[:typeKey]}", k: query[:key], v: res},
69
+ :query => query})
70
+ end
71
+
72
+
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,41 @@
1
+ ######## ####### ######## ####### ######## ########
2
+ ## / / / / License \ \ \ \
3
+ ## Copyleft culture, Copyright (C) is prohibited here
4
+ ## This work is licensed under a CC BY-SA 4.0
5
+ ## Creative Commons Attribution-ShareAlike 4.0 License
6
+ ## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
7
+ ######## ####### ######## ####### ######## ########
8
+ ## / / / / Code Climate \ \ \ \
9
+ ## Language = ruby
10
+ ## Indent = space; 2 chars;
11
+ ######## ####### ######## ####### ######## ########
12
+
13
+ module Dialog
14
+ module Storage
15
+ module Redis
16
+ class << self
17
+
18
+ def pushCachedPreprocChatContext(query, args)
19
+ Dialog.clearApi(args)
20
+ args[:smsg] = {chat_id: args[:mmsg][:fqndata][:o][:chat][:id]}
21
+ args[:api][:op] = 'ChatAdministrators'
22
+ a = Dialog::BotApi.apiActionGet(args)
23
+ bman = 0; cman = 0
24
+ a['result'].each do |user|
25
+ Dialog.logger.debug "userId #{user['user']['id']}, userStatus #{user['status']}; cliId #{args[:globals][:cliId]}, botId #{Dialog.config.naming.id}"
26
+ cman = 1 if (user['user']['id'].to_i == args[:globals][:cliId] and user['status'] == 'creator')
27
+ bman = 1 if (user['user']['id'].to_i == Dialog.config.naming.id and user['status'] == 'administrator')
28
+ end
29
+ Dialog.logger.debug "Context args: @bman=#{bman} @cman=#{cman}"
30
+ res = Dialog::Naming::ChatContext.Fullman if (bman == 1 and cman == 1)
31
+ res = Dialog::Naming::ChatContext.Botman if (bman == 1 and cman == 0)
32
+ res = Dialog::Naming::ChatContext.Climan if (bman == 0 and cman == 1)
33
+ res = Dialog::Naming::ChatContext.Noman if (bman == 0 and cman == 0)
34
+
35
+ return res
36
+ end
37
+
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,47 @@
1
+ ######## ####### ######## ####### ######## ########
2
+ ## / / / / License \ \ \ \
3
+ ## Copyleft culture, Copyright (C) is prohibited here
4
+ ## This work is licensed under a CC BY-SA 4.0
5
+ ## Creative Commons Attribution-ShareAlike 4.0 License
6
+ ## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
7
+ ######## ####### ######## ####### ######## ########
8
+ ## / / / / Code Climate \ \ \ \
9
+ ## Language = ruby
10
+ ## Indent = space; 2 chars;
11
+ ######## ####### ######## ####### ######## ########
12
+
13
+ module Dialog
14
+ module Storage
15
+ module Redis
16
+ class << self
17
+
18
+ def redisDo(act)
19
+ case act[:type]
20
+ when :cache
21
+ redis = Dialog.redisDBCache
22
+ when :stat
23
+ redis = Dialog.redisDBStat
24
+ when :store
25
+ redis = Dialog.redisDBStore
26
+ end
27
+
28
+ case act[:op]
29
+ when :write
30
+ res = redis.hmset("#{act[:data][:hname]}", ":#{act[:data][:k]}", act[:data][:v])
31
+ act[:query].key?(:ttl) ? ttl = act[:query][:ttl] : ttl = false
32
+ redis.expire "#{act[:data][:hname]}", act[:query][:ttl] unless ttl == false
33
+ Dialog.logger.debug "Redis SET - #{act[:data][:hname]} K:#{act[:data][:k]} V: #{act[:data][:v]} with ttl #{ttl}"
34
+ act[:data][:v]
35
+ when :read
36
+ res = redis.hmget("#{act[:query][:type]}:#{act[:query][:typeKey]}", ":#{act[:query][:key]}")[0] # possible BUG - first array element
37
+ when :inc
38
+ res = redis.hincrby("#{act[:data][:hname]}", ":#{act[:data][:k]}", 1)
39
+ end
40
+
41
+ return res
42
+ end
43
+
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,33 @@
1
+ ######## ####### ######## ####### ######## ########
2
+ ## / / / / License \ \ \ \
3
+ ## Copyleft culture, Copyright (C) is prohibited here
4
+ ## This work is licensed under a CC BY-SA 4.0
5
+ ## Creative Commons Attribution-ShareAlike 4.0 License
6
+ ## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
7
+ ######## ####### ######## ####### ######## ########
8
+ ## / / / / Code Climate \ \ \ \
9
+ ## Language = ruby
10
+ ## Indent = space; 2 chars;
11
+ ######## ####### ######## ####### ######## ########
12
+
13
+ module Dialog
14
+ module Storage
15
+ module Redis
16
+ class << self
17
+
18
+
19
+ def pushStat(query)
20
+ Dialog.logger.debug "Redis pushToStat, typeKey::#{query[:typeKey]}, type::#{query[:type]}"
21
+
22
+ query.has_key?(:redisOp) ? op = query[:redisOp].to_sym : op = :write
23
+ return redisDo({:type => :stat,
24
+ :op => op,
25
+ :data => {hname: "#{query[:type]}:#{query[:typeKey]}", k: query[:key], v: query[:value]},
26
+ :query => query})
27
+ end
28
+
29
+
30
+ end
31
+ end
32
+ end
33
+ end
@@ -17,8 +17,8 @@ module Dialog
17
17
  case mode
18
18
  when 'bot'
19
19
  bot_auth(tgSess)
20
- when 'cli'
21
- cli_auth(tgSess)
20
+ when 'user'
21
+ user_auth(tgSess)
22
22
  end
23
23
  end
24
24
 
@@ -54,7 +54,7 @@ module Dialog
54
54
  loop do
55
55
  case state
56
56
  when :wait_token
57
- p 'Please enter bot token:'
57
+ Dialog.logger.info 'Please enter bot token:'
58
58
  token = STDIN.gets.strip
59
59
  params = {
60
60
  '@type' => 'checkAuthenticationBotToken',
@@ -73,7 +73,7 @@ module Dialog
73
73
 
74
74
 
75
75
 
76
- def cli_auth(tgSess)
76
+ def user_auth(tgSess)
77
77
  state = nil
78
78
 
79
79
  tgSess.broadcast(proxy)
@@ -102,7 +102,7 @@ module Dialog
102
102
  p state
103
103
  case state
104
104
  when :wait_phone
105
- p 'Please enter phone number:'
105
+ Dialog.logger.error 'Please enter phone number:'
106
106
  phone = STDIN.gets.strip
107
107
  params = {
108
108
  '@type' => 'setAuthenticationPhoneNumber',
@@ -111,7 +111,7 @@ module Dialog
111
111
  tgSess.broadcast_and_receive(params).tap(&error_handler)
112
112
 
113
113
  when :wait_code
114
- p 'Please enter code from SMS:'
114
+ Dialog.logger.error 'Please enter code from SMS:'
115
115
  code = STDIN.gets.strip
116
116
  params = {
117
117
  '@type' => 'checkAuthenticationCode',
@@ -120,7 +120,7 @@ module Dialog
120
120
  tgSess.broadcast_and_receive(params).tap(&error_handler)
121
121
 
122
122
  when :wait_password
123
- p 'Please enter password:'
123
+ Dialog.logger.error 'Please enter password:'
124
124
  password = STDIN.gets.strip
125
125
  params = {
126
126
  '@type' => 'checkAuthenticationPassword',
@@ -129,6 +129,7 @@ module Dialog
129
129
  tgSess.broadcast_and_receive(params).tap(&error_handler)
130
130
  when :ready
131
131
  @me = tgSess.broadcast_and_receive('@type' => 'getMe')
132
+ Dialog.logger.error 'TDLib cli init success!'
132
133
  break
133
134
  end
134
135
  end
@@ -13,12 +13,12 @@ module Dialog
13
13
  module TDLib
14
14
  class << self
15
15
 
16
- def tdlibInit(name)
17
-
16
+ def tdlibInit
17
+ name = Dialog.config.naming.instance
18
18
  FileUtils.mkdir_p("#{Dialog.config.path.dialogData}/tdlib/#{name}")
19
19
  config = {
20
- api_id: Dialog.config.api.id,
21
- api_hash: Dialog.config.api.hash_s,
20
+ api_id: Dialog.config.tdlib.id,
21
+ api_hash: Dialog.config.tdlib.hash_s,
22
22
  device_model: Dialog.config.naming.app,
23
23
  database_directory: "#{Dialog.config.path.dialogData}/tdlib/#{name}",
24
24
  files_directory: "#{Dialog.config.path.dialogData}/tdlib/#{name}",
@@ -28,7 +28,7 @@ module Dialog
28
28
  config.lib_path = '/usr/lib64'
29
29
  end
30
30
 
31
- TD::Api.set_log_verbosity_level(Dialog.config.log.tdlib)
31
+ TD::Api.set_log_verbosity_level(Dialog.config.log.tdlib.to_i)
32
32
  handler = TD::Client.new(**config)
33
33
 
34
34
  return handler
@@ -27,12 +27,13 @@ module Dialog
27
27
  end
28
28
 
29
29
  def apiAction(args)
30
- args[:perf][:preApiAction] = Time.now
30
+ args[:perf][:preApiAction] = Time.now
31
31
  op = args[:api][:op]
32
32
  Dialog.logger.debug "Operation #{op}: #{args[:smsg]}\n"
33
33
  a = args[:bot].api.send("#{op}".to_sym, args[:smsg])
34
34
  Dialog.logger.debug "API Answer - #{a}"
35
35
 
36
+ args[:perf][:postApiAction] = Time.now
36
37
  if a["ok"] == true
37
38
  return a
38
39
  else
@@ -26,12 +26,11 @@ module Dialog
26
26
 
27
27
  def downloadFile(args)
28
28
  file = args[:mmsg][:fqndata][:f][:file]
29
- FileUtils.mkdir_p("#{Dialog.config.path.render}/_tmpfiles/")
30
29
  c = Dialog::BotApi.socks5_connection
31
30
  url_file="/file/bot#{Dialog.config.secure.token}/#{file[:path]}"
32
31
  response = c.get url_file
33
32
  file.has_key?(:name) ? name = file[:name] : name = file[:path].split('/')[1]
34
- File.open("#{Dialog.config.path.render}/_tmpfiles/#{name}", 'wb') { |fp| fp.write(response.body) }
33
+ File.open("#{Dialog.config.path.dialogTmpfiles}/#{name}", 'wb') { |fp| fp.write(response.body) }
35
34
  return name
36
35
  end
37
36
 
@@ -25,7 +25,6 @@ module Dialog
25
25
  "#{msg}\n"
26
26
  end
27
27
 
28
- @logger.info 'Logger started'
29
28
  @debug_level = debug_level
30
29
  end
31
30
 
@@ -0,0 +1,12 @@
1
+ module Dialog
2
+ module Strings
3
+ class << self
4
+
5
+ def text2md(text)
6
+ res = text.gsub(/[_*]/, '_' => '\_', '*' => '\*')
7
+ return res
8
+ end
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,39 @@
1
+ ######## ####### ######## ####### ######## ########
2
+ ## / / / / License \ \ \ \
3
+ ## Copyleft culture, Copyright (C) is prohibited here
4
+ ## This work is licensed under a CC BY-SA 4.0
5
+ ## Creative Commons Attribution-ShareAlike 4.0 License
6
+ ## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
7
+ ######## ####### ######## ####### ######## ########
8
+ ## / / / / Code Climate \ \ \ \
9
+ ## Language = ruby
10
+ ## Indent = space; 2 chars;
11
+ ######## ####### ######## ####### ######## ########
12
+
13
+ module Dialog
14
+ module Triggers
15
+ class << self
16
+
17
+ def erbGen(erbFile, dst, erb={})
18
+ if not File.file?(dst)
19
+ tmpl = ERB.new(File.read("#{Dialog.config.path.dialog_ruby}/exec/#{erbFile}")).result(binding)
20
+ File.open(dst, 'w') do |f| f.write tmpl; end
21
+ end
22
+ end
23
+
24
+
25
+ def systemd(service, mode)
26
+ Open3.popen3('/usr/bin/systemctl', '--user', 'daemon-reload')
27
+ if mode == 'enstart'
28
+ Open3.popen3('/usr/bin/systemctl', '--user', 'enable', service)
29
+ Open3.popen3('/usr/bin/systemctl', '--user', 'restart', service)
30
+ end
31
+ end
32
+
33
+ def trigger__run
34
+ Dialog._run
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -10,12 +10,15 @@
10
10
  ## Indent = space; 2 chars;
11
11
  ######## ####### ######## ####### ######## ########
12
12
 
13
- module Dialog
14
- class << self
13
+ module Dialog
14
+ module Triggers
15
+ class << self
15
16
 
16
- def trigger_full
17
-
18
- end
19
17
 
18
+ def trigger_console_start
19
+ Dialog._run
20
+ end
21
+
22
+ end
20
23
  end
21
24
  end
@@ -0,0 +1,104 @@
1
+ ######## ####### ######## ####### ######## ########
2
+ ## / / / / License \ \ \ \
3
+ ## Copyleft culture, Copyright (C) is prohibited here
4
+ ## This work is licensed under a CC BY-SA 4.0
5
+ ## Creative Commons Attribution-ShareAlike 4.0 License
6
+ ## Refer to the http://creativecommons.org/licenses/by-sa/4.0/
7
+ ######## ####### ######## ####### ######## ########
8
+ ## / / / / Code Climate \ \ \ \
9
+ ## Language = ruby
10
+ ## Indent = space; 2 chars;
11
+ ######## ####### ######## ####### ######## ########
12
+
13
+ module Dialog
14
+ module Triggers
15
+ class << self
16
+
17
+ def trigger_deploy
18
+ require 'erb'
19
+ mode = Dialog.config.run.mode
20
+ Dialog.logger.debug "Using mode '#{mode}'"
21
+ FileUtils.mkdir_p "#{Dir.home}/.config/systemd/user"
22
+ deploy_redis_run unless File.file?("#{Dialog.config.path.dialogData}/redis/dump.rdb")
23
+ deploy_background_systemd
24
+ deploy_binaries_notice
25
+ deploy_bot_systemd
26
+ deploy_tdlib_systemd
27
+ deploy_bot_dev_systemd if Dialog.config.run.mode == 'dev'
28
+ Open3.popen3('/usr/bin/systemctl', '--user', 'daemon-reload')
29
+ deploy_gems unless File.file?("#{Dir.home}/.config/systemd/user/dialog_bot_dev@.service")
30
+ end
31
+
32
+
33
+ def deploy_redis_run
34
+ if File.file?('/usr/sbin/redis-server')
35
+ redisDir = "#{Dialog.config.path.dialogData}/redis"
36
+ FileUtils.mkdir_p redisDir
37
+ erbGen('systemd/dialog_redis.service', "#{Dir.home}/.config/systemd/user/dialog_redis.service")
38
+ erbGen('conf/redis_local.conf', "#{redisDir}/redis_local.conf")
39
+ erbGen('conf/redis_global.conf', "#{redisDir}/redis_global.conf")
40
+ systemd('dialog_redis', 'enstart')
41
+ Dialog.logger.info "Redis deployment OK!"
42
+ else
43
+ Dialog.logger.error "Please install Redis binary"
44
+ Dialog.logger.info "openSUSE: zypper --no-gpg-checks --non-interactive in redis"
45
+ exit(false)
46
+ end
47
+ end
48
+
49
+
50
+ def deploy_bot_systemd
51
+ erbGen('systemd/dialog_runMode@.service', "#{Dir.home}/.config/systemd/user/dialog_bot@.service", {:mode => 'bot'})
52
+ erbGen('systemd/dialog_runner@.path', "#{Dir.home}/.config/systemd/user/dialog_bot_pre@.path", {:desc => "dialog_bot_pre runner", :path => "/tmp/in4/dialog_touch_%i"})
53
+ erbGen('systemd/dialog_runMode@.service', "#{Dir.home}/.config/systemd/user/dialog_bot_pre@.service", {:mode => 'check', :env => 'bot', :systemdChain => "dialog_bot"})
54
+ Dialog.logger.info "Bot systemd services deployed OK!"
55
+ end
56
+
57
+
58
+ def deploy_tdlib_systemd
59
+ erbGen('systemd/dialog_runMode@.service', "#{Dir.home}/.config/systemd/user/dialog_tdlib@.service", {:mode => 'tdlib'})
60
+ Dialog.logger.info "TDLib systemd services deployed OK!"
61
+ end
62
+
63
+
64
+ def deploy_background_systemd
65
+ erbGen('systemd/dialog_background.service', "#{Dir.home}/.config/systemd/user/dialog_background.service")
66
+ systemd('dialog_background', 'enstart')
67
+ Dialog.logger.info "Background systemd services deployed OK!"
68
+ end
69
+
70
+
71
+ def deploy_bot_dev_systemd
72
+ erbGen('systemd/dialog_runner@.path', "#{Dir.home}/.config/systemd/user/dialog_bot_dev@.path", {:desc => 'dialog_bot_dev runner', :path => "#{Dialog.config.path.dialog}/dialect/dialect.sqlite"})
73
+ erbGen('systemd/dialog_runMode@.service', "#{Dir.home}/.config/systemd/user/dialog_bot_dev@.service", {:mode => 'dialect', :env => 'bot', :systemdChain => 'dialog_bot'})
74
+ Dialog.logger.info "Bot development systemd services deployed OK!"
75
+ end
76
+
77
+
78
+ def deploy_binaries_notice
79
+ Dialog.logger.warn "Please install neccessary binaries:"
80
+ Dialog.logger.info "openSUSE: zypper ar -cf https://download.opensuse.org/repositories/home:/in4ops:/4wrap/openSUSE_Leap_15.0/home:in4ops:4wrap.repo"
81
+ #will be 'home:in4ops:Innosense:libs'
82
+ Dialog.logger.info "openSUSE: zypper --no-gpg-checks --non-interactive in zbar tdlib"
83
+ Dialog.logger.info "sudo loginctl enable-linger $USER"
84
+ end
85
+
86
+
87
+ def deploy_gems
88
+ stderr, status = Open3.capture3("gem specific_install -u -l https://gitlab.com/Innosense/libs/dialog_bot_ruby.git", :stdin_data => 'stdin')
89
+ Dialog.logger.info stderr
90
+ stderr, status = Open3.capture3("gem specific_install -u -l https://gitlab.com/Innosense/MVP/dialect_lookup.git", :stdin_data => 'stdin')
91
+ Dialog.logger.info stderr
92
+ stderr, status = Open3.capture3("gem specific_install -u -l https://gitlab.com/Innosense/MVP/dialog_ruby.git", :stdin_data => 'stdin')
93
+ Dialog.logger.info stderr
94
+ Dialog.logger.info "Gems deployment OK!"
95
+ end
96
+
97
+
98
+ def deploy_gitsync
99
+ end
100
+
101
+
102
+ end
103
+ end
104
+ end