edi 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -1
- data/lib/edi/services/null_service.rb +1 -1
- data/lib/edi/slack/websocket_incoming_message.rb +1 -1
- data/lib/edi/version.rb +1 -1
- data/lib/edi/websocket/client.rb +1 -1
- data/spec/slack/websocket_incoming_message_spec.rb +42 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e58b16b135e152636c1cac5801c1202469b77775
|
4
|
+
data.tar.gz: ebb7220b6e05bb58c838fa677e33f6a05e41316b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 811b359111df50176f17dbfdb47a65e50ff57387df17dbfa8c6b9181c4c18c339cee953d782bb551c4a48139caae5ce4e91119b8d1139ef7c2b3f6b46f76a766
|
7
|
+
data.tar.gz: 973f43e01e447e95117d1b214acb8ddb215693b6f0762fb10575f379ecdf17460e17ba7177e0a827287fb9cc96f5e60a5db1cb4be750f4aedde6031925628311
|
data/README.md
CHANGED
@@ -106,6 +106,16 @@ class Joke < EDI::Service
|
|
106
106
|
end
|
107
107
|
```
|
108
108
|
|
109
|
+
## Deployment
|
110
|
+
|
111
|
+
Since EDI is, under the hood, a web socket client, it can be deployed to any internet connected computer, and does not require a web server. Simple run
|
112
|
+
|
113
|
+
```shell
|
114
|
+
$ edi start -D
|
115
|
+
```
|
116
|
+
|
117
|
+
And EDI will connect to slack and will stay connected for the life of the process.
|
118
|
+
|
109
119
|
## Ship List
|
110
120
|
|
111
121
|
When these things are done, we'll be ready for 1.0
|
@@ -117,6 +127,7 @@ When these things are done, we'll be ready for 1.0
|
|
117
127
|
- [x] Service Generator
|
118
128
|
- [x] Configure All The Things
|
119
129
|
- [x] Boot Process for the Generated App
|
130
|
+
- [x] Switch from sinatra-based incoming and outgoing webhooks to websocket-based implementation
|
120
131
|
|
121
132
|
## Upcoming Features
|
122
133
|
|
@@ -128,7 +139,7 @@ You can make special classes that model special messages you'd like EDI to send
|
|
128
139
|
|
129
140
|
```ruby
|
130
141
|
class CiMessage < EDI::Message
|
131
|
-
channel "#general"
|
142
|
+
channel "#general"
|
132
143
|
|
133
144
|
end
|
134
145
|
```
|
data/lib/edi/version.rb
CHANGED
data/lib/edi/websocket/client.rb
CHANGED
@@ -25,7 +25,7 @@ module Websocket
|
|
25
25
|
if incoming_message.should_respond?
|
26
26
|
response_text = ""
|
27
27
|
service = Proc.new { response_text = EDI.runner.new(message: incoming_message).execute }
|
28
|
-
response = Proc.new { client.send Slack::WebsocketOutgoingMessage.new(text: response_text, channel: incoming_message.channel, id: id).to_json }
|
28
|
+
response = Proc.new { client.send Slack::WebsocketOutgoingMessage.new(text: response_text, channel: incoming_message.channel, id: id).to_json if response_text }
|
29
29
|
EM.defer service, response
|
30
30
|
increment_id
|
31
31
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
RSpec.describe Slack::WebsocketIncomingMessage do
|
5
|
+
subject { described_class.new params }
|
6
|
+
describe "Case Insensitive" do
|
7
|
+
context "Lowercase" do
|
8
|
+
let(:params) { {type: "message", text: "hello edi"}.to_json }
|
9
|
+
it { expect(subject.mentions_edi?).to eq true }
|
10
|
+
end
|
11
|
+
|
12
|
+
context "uppercase" do
|
13
|
+
let(:params) { {type: "message", text: "hello EDI"}.to_json }
|
14
|
+
it { expect(subject.mentions_edi?).to eq true }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "Responds when edi is followed by !" do
|
19
|
+
let(:params) { {type: "message", text: "hello edi!"}.to_json }
|
20
|
+
it { expect(subject.mentions_edi?).to eq true }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "Responds when edi is followed by ." do
|
24
|
+
let(:params) { {type: "message", text: "hello edi."}.to_json }
|
25
|
+
it { expect(subject.mentions_edi?).to eq true }
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "Responds when edi is followed by ?" do
|
29
|
+
let(:params) { {type: "message", text: "hello edi?"}.to_json }
|
30
|
+
it { expect(subject.mentions_edi?).to eq true }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "Responds when edi is followed by ," do
|
34
|
+
let(:params) { {type: "message", text: "hello edi,"}.to_json }
|
35
|
+
it { expect(subject.mentions_edi?).to eq true }
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "Doesn't respond when edi is part of a larger word" do
|
39
|
+
let(:params) { {type: "message", text: "I should edit that file"}.to_json }
|
40
|
+
it { expect(subject.mentions_edi?).to eq false }
|
41
|
+
end
|
42
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DVG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -365,6 +365,7 @@ files:
|
|
365
365
|
- spec/services/null_service_spec.rb
|
366
366
|
- spec/services/tweet_that_spec.rb
|
367
367
|
- spec/services/weather_spec.rb
|
368
|
+
- spec/slack/websocket_incoming_message_spec.rb
|
368
369
|
- spec/spec_helper.rb
|
369
370
|
- spec/support/fixtures/vcr_cassettes/fact.yml
|
370
371
|
- spec/support/fixtures/vcr_cassettes/giphy.yml
|
@@ -434,6 +435,7 @@ test_files:
|
|
434
435
|
- spec/services/null_service_spec.rb
|
435
436
|
- spec/services/tweet_that_spec.rb
|
436
437
|
- spec/services/weather_spec.rb
|
438
|
+
- spec/slack/websocket_incoming_message_spec.rb
|
437
439
|
- spec/spec_helper.rb
|
438
440
|
- spec/support/fixtures/vcr_cassettes/fact.yml
|
439
441
|
- spec/support/fixtures/vcr_cassettes/giphy.yml
|