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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c5a629587224959c0a4c49c8491b264d031191f
4
- data.tar.gz: 5adfd41f595b87780a58217f1965ffd7666137d6
3
+ metadata.gz: 59a95b3f9c6a512fb11163af72d6e9133715fe45
4
+ data.tar.gz: e2f4f8354b1f8a87c8b853fe1d02d9777ac5e884
5
5
  SHA512:
6
- metadata.gz: 05967d9a49d930a96d4ca3876b30fd9bbc2b16aab632b7890fd1f3fd553fac43d0b1ce8e7e71e3654422b8794e2a3618279e5f8a4cbd442dac7a47b8751457aa
7
- data.tar.gz: e14b0c81884f834c7c6f8540130d5a43cdcae8fa33983649aa576cc0fb40f2f552853d1ee9726a825c5b3ed02ee63341f0deac8dcfdd7f95fcedae303bc2271d
6
+ metadata.gz: 81001f46bb8fb26eaca65422cae4208d1905113561d4fccc3d6287c3b3b4170c94bc52833102a0daffc953f64376e2441a3b4a1a81254d229909a3dc57452356
7
+ data.tar.gz: 90fe92e23028e37d4104e116fe5f98ad511f2371bd9cfa07ea30cfb1d4f3e1225ba920d2917b2879ddd2bea44050cc10319af053fadb29717bca840a6f06da2b
data/.gitignore CHANGED
@@ -23,3 +23,4 @@ mkmf.log
23
23
  variables.sh
24
24
  .vagrant/
25
25
  log/
26
+ dummy
@@ -13,7 +13,7 @@ module EDI
13
13
 
14
14
  desc "start", "Bootup the EDI Application"
15
15
  def start(*args)
16
- puts "Starting EDI Slackbot"
16
+ EDI::Logger.info "Starting EDI Slackbot"
17
17
  run_command("ruby boot.rb")
18
18
  end
19
19
 
@@ -2,21 +2,28 @@ require 'logging'
2
2
 
3
3
  module EDI
4
4
  class Logger
5
- def initialize
6
- @log_level = EDI.config.log_level
7
- @logger = Logging.logger['edi']
8
- @logger.level = @log_level
9
- @logger.add_appenders \
10
- Logging.appenders.stdout,
11
- Logging.appenders.file('log/edi.log')
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 debug(message)
15
- @logger.debug message
14
+ def self.info(message)
15
+ logger.info message
16
16
  end
17
17
 
18
- def info(message)
19
- @logger.info message
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
@@ -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
- puts "Service: #{service.class} invoked"
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
@@ -6,7 +6,6 @@ class Youtube < EDI::Service
6
6
 
7
7
  def run
8
8
  response = EDI.get("#{url}?#{params}").response
9
- puts "Youtube Response: #{response.code}"
10
9
  "https://youtu.be/#{response["items"].first["id"]["videoId"]}"
11
10
  end
12
11
 
@@ -1,3 +1,3 @@
1
1
  module EDI
2
- VERSION = "0.4.6"
2
+ VERSION = "0.4.7"
3
3
  end
@@ -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
- puts "EDI is now online"
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
- puts "EDI received message #{incoming_message.text} in channel #{incoming_message.channel}"
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.6
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-06 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler