cognition 2.0.2 → 2.0.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
  SHA1:
3
- metadata.gz: 2f4da3fb15fa2cf643a7e989c81e5467cd35284d
4
- data.tar.gz: 9c440ceee3f1cca18f71c0485a57723248e3f139
3
+ metadata.gz: 06462dac8c1c3f92692619d523bc9f1a58fc4de4
4
+ data.tar.gz: db097768b8ff030201e53fb93f3aaf1efb8c997d
5
5
  SHA512:
6
- metadata.gz: 866e3d8727d945165488ed69e611ca84f1063acab94061464d5c28b41087f445a33f0d1ce3f927ba7a6cf13e6d2515668cd67179fcdef87649144ca83cadd5d2
7
- data.tar.gz: 47be6d5c494c3db31744c47b72848e9b00f70fa470a8d82c2f7d57ad32255f9cd17a21cfc3aa50d099349a607aa07c97dbf1bcaf2c798bd03e792eaf7425f999
6
+ metadata.gz: c9a2814d94865711e1605188d017ccd865a416c714b9e6d21b15dba5691862119b6d425cc0696f9fbe1fed932744e3e1bbb4dda8c760d3614181b1471aa2a483
7
+ data.tar.gz: e8ab955d9bbe0862248e6b233c0e7dd2212db532ba342a145cb8d4264ceca1f5657ce9f00a3ff321bca53732f30652cee37161a7c10f0129e06bb8f90ed81794
@@ -1,5 +1,6 @@
1
1
  require 'erb'
2
2
  require 'tilt'
3
+ require 'cgi'
3
4
 
4
5
  module Cognition
5
6
  module Plugins
@@ -1,7 +1,7 @@
1
1
  <table>
2
2
  <% @help.each do |text| %>
3
3
  <tr>
4
- <td><%= text %></td>
4
+ <td><%= CGI.escapeHTML(text) %></td>
5
5
  </tr>
6
6
  <% end %>
7
7
  </table>
@@ -16,11 +16,10 @@ module Cognition
16
16
 
17
17
  def help(msg, match_data = nil)
18
18
  type = msg.metadata[:type] ||= "text"
19
- if match_data['command'].empty?
19
+ if match_data[:command].nil? || match_data[:command].empty?
20
20
  @help = bot.help
21
21
  else
22
22
  @help = bot.help.find_all { |text| text.match match_data[:command] }
23
-
24
23
  end
25
24
  render(type: type)
26
25
  end
@@ -1,3 +1,3 @@
1
1
  module Cognition
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
@@ -1,3 +1,5 @@
1
+ require 'tilt/haml'
2
+ require 'tilt/erubis'
1
3
  require 'haml'
2
4
  class Hello < Cognition::Plugins::Base
3
5
  match 'hello', :hello, help: {
@@ -7,12 +7,12 @@ class DefaultPluginTest < Minitest::Test
7
7
  end
8
8
 
9
9
  def test_returns_help
10
- help = "ping - Test if the endpoint is responding. Returns PONG.\nhelp - Lists all commands with help\nhelp <command> - Lists help for <command>"
10
+ help = "ping - Test if the endpoint is responding. Returns PONG.\nhelp - Lists all commands with help\nhelp <command> - Lists help for <command>\n"
11
11
  assert_equal help, @bot.process("help")
12
12
  end
13
13
 
14
14
  def test_returns_filtered_help
15
- help = "ping - Test if the endpoint is responding. Returns PONG."
15
+ help = "ping - Test if the endpoint is responding. Returns PONG.\n"
16
16
  assert_equal help, @bot.process("help ping")
17
17
  end
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cognition
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Anderson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-09 00:00:00.000000000 Z
11
+ date: 2015-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  requirements: []
166
166
  rubyforge_project:
167
- rubygems_version: 2.4.5
167
+ rubygems_version: 2.4.8
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: A rules engine for running commands.