edi 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/edi/cli.rb +1 -1
- data/lib/edi/logger.rb +18 -11
- data/lib/edi/service_runner.rb +2 -2
- data/lib/edi/services/youtube.rb +0 -1
- data/lib/edi/version.rb +1 -1
- data/lib/edi/websocket/client.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59a95b3f9c6a512fb11163af72d6e9133715fe45
|
4
|
+
data.tar.gz: e2f4f8354b1f8a87c8b853fe1d02d9777ac5e884
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81001f46bb8fb26eaca65422cae4208d1905113561d4fccc3d6287c3b3b4170c94bc52833102a0daffc953f64376e2441a3b4a1a81254d229909a3dc57452356
|
7
|
+
data.tar.gz: 90fe92e23028e37d4104e116fe5f98ad511f2371bd9cfa07ea30cfb1d4f3e1225ba920d2917b2879ddd2bea44050cc10319af053fadb29717bca840a6f06da2b
|
data/.gitignore
CHANGED
data/lib/edi/cli.rb
CHANGED
data/lib/edi/logger.rb
CHANGED
@@ -2,21 +2,28 @@ require 'logging'
|
|
2
2
|
|
3
3
|
module EDI
|
4
4
|
class Logger
|
5
|
-
|
6
|
-
|
7
|
-
@logger
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
|
6
|
+
def self.logger
|
7
|
+
@logger ||= _create_logger
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.debug(message)
|
11
|
+
logger.debug message
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
|
14
|
+
def self.info(message)
|
15
|
+
logger.info message
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
private
|
19
|
+
|
20
|
+
def self._create_logger
|
21
|
+
l = Logging.logger['EDI']
|
22
|
+
l.level = EDI.config.log_level
|
23
|
+
l.add_appenders \
|
24
|
+
Logging.appenders.stdout,
|
25
|
+
Logging.appenders.file('log/EDI.log')
|
26
|
+
l
|
20
27
|
end
|
21
28
|
|
22
29
|
end
|
data/lib/edi/service_runner.rb
CHANGED
@@ -7,7 +7,7 @@ class ServiceRunner
|
|
7
7
|
|
8
8
|
def execute
|
9
9
|
self.service = EDI::Interpreter.new(message).determine_service.new(message)
|
10
|
-
|
10
|
+
EDI::Logger.info "Service: #{service.class} invoked"
|
11
11
|
begin
|
12
12
|
_run_service
|
13
13
|
rescue EDI::UnfitEnvironmentException => e
|
@@ -25,5 +25,5 @@ private
|
|
25
25
|
service.validate_environment
|
26
26
|
service.invoke
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
end
|
data/lib/edi/services/youtube.rb
CHANGED
data/lib/edi/version.rb
CHANGED
data/lib/edi/websocket/client.rb
CHANGED
@@ -22,14 +22,14 @@ module Websocket
|
|
22
22
|
self.client = Faye::WebSocket::Client.new(ws_url)
|
23
23
|
|
24
24
|
client.on :open do |event|
|
25
|
-
|
25
|
+
EDI::Logger.info "EDI is now online"
|
26
26
|
end
|
27
27
|
|
28
28
|
# Respond to Messages
|
29
29
|
client.on :message do |event|
|
30
30
|
incoming_message = Slack::WebsocketIncomingMessage.new(event.data)
|
31
31
|
if incoming_message.should_respond?
|
32
|
-
|
32
|
+
EDI::Logger.info "EDI received message #{incoming_message.text} in channel #{incoming_message.channel}"
|
33
33
|
response_text = ""
|
34
34
|
service = Proc.new { response_text = EDI.runner.new(message: incoming_message).execute }
|
35
35
|
response = Proc.new { client.send Slack::WebsocketOutgoingMessage.new(text: response_text, channel: incoming_message.channel, id: id).to_json if response_text }
|
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.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DVG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|