slack-smart-bot 1.6.2 → 1.6.3

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: c58734c44f90b171c957d0f48c6c2c6353278d39666676667c774557fb8625a0
4
- data.tar.gz: 4a4799485e58730145388bbc1772c842d3abaed0135c5bc4b1337d2dad91bc58
3
+ metadata.gz: ecb1da7d24358beb4544377c625a0d72bedf3e77b4d7be0596edba30d44ca945
4
+ data.tar.gz: a8974bc95a2404e62425b4f39ed38e2db896558ca42c1de5f1dbc5fada453dc0
5
5
  SHA512:
6
- metadata.gz: f8b9c2d19aff0aad05b3a594b050999d72ed354861e303ea9dc32fff00816042ee838bc7ce33045e418e2f51e3193912bd1599e8743aed9746d79b69da671a1d
7
- data.tar.gz: eaeaad86fea1bdfd9dad6d7e70ef649b593deab8f1a9099c8c3d89d6a53d6ee5280ce5bef267311a18a85cb4b98a700ebc20d592df288a30a07227cdadc2b2f1
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}.input")
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}.input").gsub(/^(quit|exit|bye)$/i,'')
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 \"awesome_print\"
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!(/^\s*(puts|print|p|pp)\s/, \"\")
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.awesome_inspect}\`\`\`\"
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}.input")
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}.input").gsub(/^(quit|exit|bye)$/i,'')
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.2
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-14 00:00:00.000000000 Z
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: awesome_print
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.8'
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.8'
88
+ version: '1'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rspec
91
91
  requirement: !ruby/object:Gem::Requirement