slack-smart-bot 1.6.2 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecb1da7d24358beb4544377c625a0d72bedf3e77b4d7be0596edba30d44ca945
|
4
|
+
data.tar.gz: a8974bc95a2404e62425b4f39ed38e2db896558ca42c1de5f1dbc5fada453dc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f315a12bd2b523f9fb08081a39529994af2159c015d2d711f836ac55d83585fe3fcb0002bbbfd2e975a0ed3bd87908249edd2333fbcfe84638f62e109e3dd2bb
|
7
|
+
data.tar.gz: d4158da3cd73c87813f0fa0c72b849db557b99fe854cdd8258c35bd2a2861e7f981285a75890587427ab05923cffaa8f6c2effac2c3ed6fff5acb4aac633015a
|
@@ -15,7 +15,7 @@ class SlackSmartBot
|
|
15
15
|
else
|
16
16
|
Dir.mkdir("#{config.path}/repl") unless Dir.exist?("#{config.path}/repl")
|
17
17
|
Dir.mkdir("#{config.path}/repl/#{@channel_id}") unless Dir.exist?("#{config.path}/repl/#{@channel_id}")
|
18
|
-
if File.exist?("#{config.path}/repl/#{@channel_id}/#{session_name}.
|
18
|
+
if File.exist?("#{config.path}/repl/#{@channel_id}/#{session_name}.run")
|
19
19
|
if @repls.key?(session_name) and @repls[session_name][:type] == :private and
|
20
20
|
@repls[session_name][:creator_name]!=user.name and
|
21
21
|
!config.admins.include?(user.name)
|
@@ -32,7 +32,7 @@ class SlackSmartBot
|
|
32
32
|
content += File.read("#{project_folder}/.smart-bot-repl")
|
33
33
|
content += "\n"
|
34
34
|
end
|
35
|
-
content += File.read("#{config.path}/repl/#{@channel_id}/#{session_name}.
|
35
|
+
content += File.read("#{config.path}/repl/#{@channel_id}/#{session_name}.run").gsub(/^(quit|exit|bye)$/i,'') #todo: remove this gsub it will never contain it
|
36
36
|
File.write("#{config.path}/repl/#{@channel_id}/#{session_name}.rb", content, mode: "w+")
|
37
37
|
send_file(dest, "REPL #{session_name} on #{config.channel}", "#{config.path}/repl/#{@channel_id}/#{session_name}.rb", " REPL #{session_name} on #{config.channel}", 'text/plain', "ruby")
|
38
38
|
end
|
@@ -93,10 +93,11 @@ class SlackSmartBot
|
|
93
93
|
|
94
94
|
File.write("#{config.path}/repl/#{@channel_id}/#{@repl_sessions[from][:name]}.input", "", mode: "a+")
|
95
95
|
File.write("#{config.path}/repl/#{@channel_id}/#{@repl_sessions[from][:name]}.output", "", mode: "a+")
|
96
|
+
File.write("#{config.path}/repl/#{@channel_id}/#{@repl_sessions[from][:name]}.run", "", mode: "a+")
|
96
97
|
|
97
98
|
process_to_run = '
|
98
99
|
ruby -e "' + env_vars.join("\n") + '
|
99
|
-
require \"
|
100
|
+
require \"amazing_print\"
|
100
101
|
bindme' + serialt + ' = binding
|
101
102
|
eval(\"require \'nice_http\'\" , bindme' + serialt + ')
|
102
103
|
|
@@ -120,15 +121,21 @@ class SlackSmartBot
|
|
120
121
|
if code_to_run_repl.match?(/^\s*ls\s+(.+)/)
|
121
122
|
code_to_run_repl = \"#{code_to_run_repl.scan(/^\s*ls\s+(.+)/).join}.methods - Object.methods\"
|
122
123
|
end
|
124
|
+
error = false
|
123
125
|
begin
|
124
|
-
code_to_run_repl.gsub
|
125
|
-
resp_repl = eval(code_to_run_repl.to_s, bindme' + serialt + ')
|
126
|
+
resp_repl = eval(code_to_run_repl.gsub(/^\s*(puts|print|p|pp)\s/, \"\"), bindme' + serialt + ')
|
126
127
|
rescue Exception => resp_repl
|
128
|
+
error = true
|
127
129
|
end
|
128
130
|
if resp_repl.to_s != \"\"
|
129
131
|
open(\"' + Dir.pwd + '/repl/' + @channel_id + '/' + session_name + '.output\", \"a+\") {|f|
|
130
|
-
f.puts \"\`\`\`#{resp_repl.
|
132
|
+
f.puts \"\`\`\`#{resp_repl.ai}\`\`\`\"
|
131
133
|
}
|
134
|
+
unless error
|
135
|
+
open(\"' + Dir.pwd + '/repl/' + @channel_id + '/' + session_name + '.run\", \"a+\") {|f|
|
136
|
+
f.puts code_to_run_repl
|
137
|
+
}
|
138
|
+
end
|
132
139
|
end
|
133
140
|
end
|
134
141
|
end
|
@@ -21,7 +21,7 @@ class SlackSmartBot
|
|
21
21
|
save_stats(__method__)
|
22
22
|
Dir.mkdir("#{config.path}/repl") unless Dir.exist?("#{config.path}/repl")
|
23
23
|
Dir.mkdir("#{config.path}/repl/#{@channel_id}") unless Dir.exist?("#{config.path}/repl/#{@channel_id}")
|
24
|
-
if File.exist?("#{config.path}/repl/#{@channel_id}/#{session_name}.
|
24
|
+
if File.exist?("#{config.path}/repl/#{@channel_id}/#{session_name}.run")
|
25
25
|
if @repls.key?(session_name) and @repls[session_name][:type] == :private and
|
26
26
|
@repls[session_name][:creator_name]!=user.name and
|
27
27
|
!config.admins.include?(user.name)
|
@@ -48,7 +48,7 @@ class SlackSmartBot
|
|
48
48
|
content += File.read("#{project_folder}/.smart-bot-repl")
|
49
49
|
content += "\n"
|
50
50
|
end
|
51
|
-
content += File.read("#{config.path}/repl/#{@channel_id}/#{session_name}.
|
51
|
+
content += File.read("#{config.path}/repl/#{@channel_id}/#{session_name}.run").gsub(/^(quit|exit|bye)$/i,'') #todo: remove this gsub, it will never contain it
|
52
52
|
Dir.mkdir("#{project_folder}/tmp") unless Dir.exist?("#{project_folder}/tmp")
|
53
53
|
Dir.mkdir("#{project_folder}/tmp/repl") unless Dir.exist?("#{project_folder}/tmp/repl")
|
54
54
|
File.write("#{project_folder}/tmp/repl/#{session_name}.rb", content, mode: "w+")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-smart-bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slack-ruby-client
|
@@ -73,19 +73,19 @@ dependencies:
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 0.8.0
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
76
|
+
name: amazing_print
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '1
|
81
|
+
version: '1'
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '1
|
88
|
+
version: '1'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: rspec
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|