slack-smart-bot 1.6.4 → 1.6.5

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: f07b09cbcf1e3546a38bf8f34ac6eff1d3e19c53af22cc38663b1cf932da7440
4
- data.tar.gz: '05639afadac3c32459fed0999db003d162fa1d61db6e89e085acab95c4f76f1b'
3
+ metadata.gz: 97d3af04c6b231089bad9829779d20b650c878e4782a43d7a43435144c5b9c96
4
+ data.tar.gz: 111ae9d729118b0e596845c597a613d6f41fb28d34b0e2ce160419aac863d9de
5
5
  SHA512:
6
- metadata.gz: bb067ed25c1cf464cb104ba56e3ff995366fc72e5f657dafd99e942092616a9bda58f33bd6f52f8c1b8db37a5f2d0e79a12fed3acf0a2d0f52e795e82fd9b1c1
7
- data.tar.gz: f2db5a51c5f74c791c8793efbaf68626c2444ba2b7d6aabdd8485723d9b25bb4a43b0db2fa9d11d788091a011e22ceb2d40c6ee985daa28f4ba26a8e2c47e14b
6
+ metadata.gz: 9a8183b5c24bcd88484932c23bbf0f2df8fd11efedf4c845c6ac39660ab9c9a1c27f2702b6c5e8d312aac083acc968e6c4119ea5f0cffd4a64330824a7f1df90
7
+ data.tar.gz: 7e5d4ac7c6d6056754d33897ece0475839ce8160be966bf5b37dc6a19f71976944459fc2423899af12de17099635b5f85c277dacd610481af372d401574c120a
@@ -100,7 +100,36 @@ class SlackSmartBot
100
100
  require \"amazing_print\"
101
101
  bindme' + serialt + ' = binding
102
102
  eval(\"require \'nice_http\'\" , bindme' + serialt + ')
103
-
103
+ def repl_params(met)
104
+ res = []
105
+ met.parameters.each do |par|
106
+ if par[0]==:req
107
+ res << par[1].to_s
108
+ elsif par[0]==:keyreq
109
+ res << par[1].to_s + \":\"
110
+ elsif par[0]==:key
111
+ res << \"?\"+par[1].to_s + \":\"
112
+ elsif par[0]==:opt
113
+ res << \"?\"+par[1].to_s
114
+ elsif par[0]==:rest
115
+ res << \"*\"+par[1].to_s
116
+ elsif par[0]==:keyrest
117
+ res << \"**\"+par[1].to_s
118
+ else
119
+ res << par[1].to_s
120
+ end
121
+ end
122
+ \"(#{res.join(\", \")})\"
123
+ end
124
+ def ls(obj)
125
+ mets = (obj.methods - Object.methods)
126
+ res = []
127
+ mets.each do |met|
128
+ res << \"#{met}#{repl_params(obj.method(met))}\"
129
+ end
130
+ res
131
+ end
132
+
104
133
  file_input_repl = File.open(\"' + Dir.pwd + '/repl/' + @channel_id + '/' + session_name + '.input\", \"r\")
105
134
  if File.exist?(\"./.smart-bot-repl\")
106
135
  begin
@@ -112,6 +141,7 @@ class SlackSmartBot
112
141
  sleep 0.2
113
142
  code_to_run_repl = file_input_repl.read
114
143
  if code_to_run_repl.to_s!=''
144
+ add_to_run_repl = true
115
145
  if code_to_run_repl.to_s.match?(/^quit$/i) or
116
146
  code_to_run_repl.to_s.match?(/^exit$/i) or
117
147
  code_to_run_repl.to_s.match?(/^bye bot$/i) or
@@ -119,7 +149,7 @@ class SlackSmartBot
119
149
  exit
120
150
  else
121
151
  if code_to_run_repl.match?(/^\s*ls\s+(.+)/)
122
- code_to_run_repl = \"#{code_to_run_repl.scan(/^\s*ls\s+(.+)/).join}.methods - Object.methods\"
152
+ add_to_run_repl = false
123
153
  end
124
154
  error = false
125
155
  begin
@@ -129,9 +159,9 @@ class SlackSmartBot
129
159
  end
130
160
  if resp_repl.to_s != \"\"
131
161
  open(\"' + Dir.pwd + '/repl/' + @channel_id + '/' + session_name + '.output\", \"a+\") {|f|
132
- f.puts \"\`\`\`#{resp_repl.ai}\`\`\`\"
162
+ f.puts \"\`\`\`\n#{resp_repl.ai}\n\`\`\`\"
133
163
  }
134
- unless error
164
+ unless error or !add_to_run_repl
135
165
  open(\"' + Dir.pwd + '/repl/' + @channel_id + '/' + session_name + '.run\", \"a+\") {|f|
136
166
  f.puts code_to_run_repl
137
167
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-smart-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.4
4
+ version: 1.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Ruiz