lita-logger 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2123ecb78f35b9428ddf2c4e21f26084c60483cb
4
+ data.tar.gz: bedd3409819c8ed12230381b43c3dea549dc1e9d
5
+ SHA512:
6
+ metadata.gz: 39bba6d9706db437130b83a1df2467cf24463dc834ae58491a4040a660f8aa405ea070f022a21f7645fc239647b7d67ac3d7db8b27cde50cbd87d3e51f3ea913
7
+ data.tar.gz: 3e0cb9d7c7e027b62768ae97bbe804782e0262e9551a894ebbb9b658011caed31e72480d5f942421d984679205e4429d4cc663d13b153110f964d02488ade5e9
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *.gem
2
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ lita-logger (1.0.0)
5
+ lita (>= 3.3)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.2.5)
11
+ faraday (0.9.0)
12
+ multipart-post (>= 1.2, < 3)
13
+ http_router (0.11.1)
14
+ rack (>= 1.0.0)
15
+ url_mount (~> 0.2.1)
16
+ i18n (0.6.9)
17
+ ice_nine (0.11.0)
18
+ lita (3.3.1)
19
+ bundler (>= 1.3)
20
+ faraday (>= 0.8.7)
21
+ http_router (>= 0.11.1)
22
+ i18n (>= 0.6.9)
23
+ ice_nine (>= 0.11.0)
24
+ multi_json (>= 1.7.7)
25
+ puma (>= 2.7.1)
26
+ rack (>= 1.5.2)
27
+ rb-readline (>= 0.5.1)
28
+ redis-namespace (>= 1.3.0)
29
+ thor (>= 0.18.1)
30
+ multi_json (1.10.1)
31
+ multipart-post (2.0.0)
32
+ puma (2.8.2)
33
+ rack (>= 1.1, < 2.0)
34
+ rack (1.5.2)
35
+ rake (10.3.2)
36
+ rb-readline (0.5.1)
37
+ redis (3.1.0)
38
+ redis-namespace (1.5.0)
39
+ redis (~> 3.0, >= 3.0.4)
40
+ rspec (3.0.0)
41
+ rspec-core (~> 3.0.0)
42
+ rspec-expectations (~> 3.0.0)
43
+ rspec-mocks (~> 3.0.0)
44
+ rspec-core (3.0.2)
45
+ rspec-support (~> 3.0.0)
46
+ rspec-expectations (3.0.2)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.0.0)
49
+ rspec-mocks (3.0.2)
50
+ rspec-support (~> 3.0.0)
51
+ rspec-support (3.0.2)
52
+ thor (0.19.1)
53
+ url_mount (0.2.1)
54
+ rack
55
+
56
+ PLATFORMS
57
+ ruby
58
+
59
+ DEPENDENCIES
60
+ bundler (~> 1.3)
61
+ lita-logger!
62
+ rake
63
+ rspec (>= 3.0.0)
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2014 Mike Machado
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # lita-logger
2
+
3
+ **lita-logger** is a handler for [Lita](https://github.com/jimmycuadra/lita) to log all chat messages to a file.
4
+
5
+ ## Installation
6
+
7
+ Add lita-logger to your Lita instance's Gemfile:
8
+
9
+ ``` ruby
10
+ gem "lita-logger"
11
+ ```
12
+
13
+ ## Configuration
14
+
15
+ This plugin requires the path to the log file.
16
+
17
+ ``` ruby
18
+ Lita.configure do |config|
19
+ config.handlers.logger.log_file = "/tmp/lita_chat.log"
20
+ config.handlers.logger.enable_http_log = true
21
+ end
22
+ ```
23
+
24
+ ## License
25
+
26
+ [MIT](http://opensource.org/licenses/MIT)
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,44 @@
1
+ require "lita"
2
+
3
+ module Lita
4
+ module Handlers
5
+ class Logger < Handler
6
+
7
+
8
+ def self.default_config(config)
9
+ config.log_file = nil
10
+ config.enable_http_log = false
11
+ end
12
+
13
+ route(/.*/, :logger)
14
+
15
+ http.get "/chat_log", :chat_log
16
+
17
+ def logger(response)
18
+ if !Lita.config.handlers.logger.log_file || response.message.source.private_message || !response.message.body
19
+ return
20
+ end
21
+
22
+ File.open(Lita.config.handlers.logger.log_file, 'a') do |f|
23
+ f.puts "[#{Time.now}] [#{response.user.name} in #{response.message.source.room}] #{response.message.body}"
24
+ end
25
+ end
26
+
27
+ def chat_log(request, response)
28
+ if !Lita.config.handlers.logger.log_file || !Lita.config.handlers.logger.enable_http_log
29
+ return
30
+ end
31
+
32
+ response.headers["Content-Type"] = "text/plain"
33
+
34
+ File.open(Lita.config.handlers.logger.log_file, "r") do |f|
35
+ response.write f.read
36
+ end
37
+ end
38
+
39
+ end
40
+
41
+ Lita.register_handler(Logger)
42
+ end
43
+ end
44
+
@@ -0,0 +1 @@
1
+ require "lita/handlers/logger"
@@ -0,0 +1,22 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "lita-logger"
3
+ spec.version = "1.0.0"
4
+ spec.authors = ["Mike Machado"]
5
+ spec.email = ["mike@machadolab.com"]
6
+ spec.description = %q{A Lita handler to log all chat messages to a file}
7
+ spec.summary = %q{A Lita handler to log all chat messages to a file}
8
+ spec.homepage = "https://github.com/machadolab/lita-logger"
9
+ spec.license = "MIT"
10
+ spec.metadata = { "lita_plugin_type" => "extension" }
11
+
12
+ spec.files = `git ls-files`.split($/)
13
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
14
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.require_paths = ["lib"]
16
+
17
+ spec.add_runtime_dependency "lita", ">= 3.3"
18
+
19
+ spec.add_development_dependency "bundler", "~> 1.3"
20
+ spec.add_development_dependency "rake"
21
+ spec.add_development_dependency "rspec", ">= 3.0.0"
22
+ end
data/locales/en.yml ADDED
@@ -0,0 +1,4 @@
1
+ en:
2
+ lita:
3
+ extensions:
4
+ logger:
@@ -0,0 +1,4 @@
1
+ require "spec_helper"
2
+
3
+ describe Lita::Extensions::Testme, lita: true do
4
+ end
@@ -0,0 +1,2 @@
1
+ require "lita-testme"
2
+ require "lita/rspec"
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-logger
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Mike Machado
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: lita
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 3.0.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 3.0.0
69
+ description: A Lita handler to log all chat messages to a file
70
+ email:
71
+ - mike@machadolab.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - Gemfile.lock
79
+ - LICENSE
80
+ - README.md
81
+ - Rakefile
82
+ - lib/lita-logger.rb
83
+ - lib/lita/handlers/logger.rb
84
+ - lita-logger.gemspec
85
+ - locales/en.yml
86
+ - spec/lita/extensions/testme_spec.rb
87
+ - spec/spec_helper.rb
88
+ homepage: https://github.com/machadolab/lita-logger
89
+ licenses:
90
+ - MIT
91
+ metadata:
92
+ lita_plugin_type: extension
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.2.2
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: A Lita handler to log all chat messages to a file
113
+ test_files:
114
+ - spec/lita/extensions/testme_spec.rb
115
+ - spec/spec_helper.rb