lita-campfire 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/adapters/campfire.rb +12 -13
- data/lib/lita/adapters/campfire/connector.rb +3 -1
- data/lita-campfire.gemspec +2 -2
- data/spec/lita/adapters/campfire/connector_spec.rb +9 -0
- data/spec/lita/adapters/campfire_spec.rb +14 -28
- data/spec/spec_helper.rb +1 -0
- metadata +3 -10
- data/Gemfile.lock +0 -106
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f48672b5bfe54bea05b3c96fca48d4766d80c72
|
4
|
+
data.tar.gz: 7312e56bbcd14406afb6f929f805d735c79a2019
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac6aa09ea87963f92d5eb22e6edc968f7c5ff4a3bfbad1e2e142cb24f27b5d5794fa3dad5054093c1d38a663a98b7180a222cd316703f66e33e9e82e9e858850
|
7
|
+
data.tar.gz: 2366dea862aea4d8dcf3b367a6f33110a2934820bab30d6088aff5211e1ea03e306d99d3be8f1611fd507c3c8dddea9c95de204a5e652c51937575ece051e0c9
|
@@ -1,8 +1,14 @@
|
|
1
1
|
module Lita
|
2
2
|
module Adapters
|
3
3
|
class Campfire < Adapter
|
4
|
-
|
5
|
-
|
4
|
+
namespace 'campfire'
|
5
|
+
|
6
|
+
config :subdomain, type: String, required: true
|
7
|
+
config :apikey, type: String, required: true
|
8
|
+
config :rooms, type: Array, required: true
|
9
|
+
|
10
|
+
config :debug, type: [TrueClass, FalseClass], default: false
|
11
|
+
config :tinder_options, type: Hash, default: {}
|
6
12
|
|
7
13
|
attr_reader :connector
|
8
14
|
|
@@ -13,10 +19,10 @@ module Lita
|
|
13
19
|
subdomain: config.subdomain,
|
14
20
|
apikey: config.apikey,
|
15
21
|
rooms: rooms,
|
22
|
+
debug: config.debug,
|
23
|
+
tinder_options: config.tinder_options
|
16
24
|
}
|
17
25
|
|
18
|
-
options.merge!(optional_config_options)
|
19
|
-
|
20
26
|
@connector = Connector.new(
|
21
27
|
robot,
|
22
28
|
options
|
@@ -46,7 +52,7 @@ module Lita
|
|
46
52
|
private
|
47
53
|
|
48
54
|
def config
|
49
|
-
|
55
|
+
Lita.config.adapters.campfire
|
50
56
|
end
|
51
57
|
|
52
58
|
def rooms
|
@@ -56,15 +62,8 @@ module Lita
|
|
56
62
|
def disconnect
|
57
63
|
connector.disconnect
|
58
64
|
end
|
59
|
-
|
60
|
-
def optional_config_options
|
61
|
-
OPTIONAL_CONFIG_OPTIONS.each_with_object({}) do |config_option, options|
|
62
|
-
config_option_value = config.public_send(config_option)
|
63
|
-
options[config_option] = config_option_value if config_option_value
|
64
|
-
end
|
65
|
-
end
|
66
65
|
end
|
67
66
|
|
68
67
|
Lita.register_adapter(:campfire, Campfire)
|
69
68
|
end
|
70
|
-
end
|
69
|
+
end
|
@@ -38,6 +38,8 @@ module Lita
|
|
38
38
|
messages.each do |message|
|
39
39
|
if message.include?("\n")
|
40
40
|
my_room.paste message
|
41
|
+
elsif message.start_with?("/play ")
|
42
|
+
my_room.play message.sub("/play ", "")
|
41
43
|
else
|
42
44
|
my_room.speak message
|
43
45
|
end
|
@@ -69,4 +71,4 @@ module Lita
|
|
69
71
|
end
|
70
72
|
end
|
71
73
|
end
|
72
|
-
end
|
74
|
+
end
|
data/lita-campfire.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'lita-campfire'
|
3
|
-
spec.version = '0.
|
3
|
+
spec.version = '0.3.0'
|
4
4
|
spec.authors = ['Jose Luis Salas', 'Zac Stewart']
|
5
5
|
spec.email = ['josacar@gmail.com', 'zgstewart@gmail.com']
|
6
6
|
spec.description = %q{A Campfire adapter for Lita.}
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.require_paths = ['lib']
|
15
15
|
spec.metadata = { 'lita_plugin_type' => 'adapter' }
|
16
16
|
|
17
|
-
spec.add_runtime_dependency 'lita', '>=
|
17
|
+
spec.add_runtime_dependency 'lita', '>= 4.0.0'
|
18
18
|
spec.add_runtime_dependency 'tinder', '~> 1.10.0'
|
19
19
|
|
20
20
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
@@ -106,6 +106,15 @@ describe Campfire::Connector, lita: true do
|
|
106
106
|
subject.send_messages room, [ message ]
|
107
107
|
end
|
108
108
|
end
|
109
|
+
|
110
|
+
context 'with a sound' do
|
111
|
+
let(:message) { "/play yeah" }
|
112
|
+
|
113
|
+
it 'plays a sound into room' do
|
114
|
+
expect(room).to receive(:play).with(message.sub("/play ",""))
|
115
|
+
subject.send_messages room, [ message ]
|
116
|
+
end
|
117
|
+
end
|
109
118
|
end
|
110
119
|
|
111
120
|
describe '#set_topic' do
|
@@ -2,10 +2,12 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Lita::Adapters::Campfire, lita: true do
|
4
4
|
before do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
config.
|
5
|
+
registry.register_adapter(:campfire, described_class)
|
6
|
+
|
7
|
+
registry.configure do |config|
|
8
|
+
config.adapters.campfire.subdomain = 'foodomain'
|
9
|
+
config.adapters.campfire.apikey = 'fooapikey'
|
10
|
+
config.adapters.campfire.rooms = ['fooroom']
|
9
11
|
end
|
10
12
|
|
11
13
|
allow(described_class::Connector).to receive(:new).and_return(connector)
|
@@ -13,37 +15,21 @@ describe Lita::Adapters::Campfire, lita: true do
|
|
13
15
|
|
14
16
|
subject { described_class.new(robot) }
|
15
17
|
|
16
|
-
let(:robot) {
|
18
|
+
let(:robot) { Lita::Robot.new(registry) }
|
17
19
|
let(:connector) { instance_double(Lita::Adapters::Campfire::Connector) }
|
18
20
|
|
19
21
|
it "registers with Lita" do
|
20
22
|
expect(Lita.adapters[:campfire]).to eql(described_class)
|
21
23
|
end
|
22
24
|
|
23
|
-
it
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'passing optional variables' do
|
30
|
-
optional_config = described_class::OPTIONAL_CONFIG_OPTIONS
|
31
|
-
optional_config.each do |option|
|
32
|
-
it "does not set #{option} hash value if option is not set" do
|
33
|
-
expect(described_class::Connector).not_to receive(:new).with(robot, hash_including(option.to_sym))
|
34
|
-
subject
|
35
|
-
end
|
25
|
+
it 'can receive hash with tinder options' do
|
26
|
+
tinder_options = { timeout: 30, auto_reconnect: false }
|
27
|
+
Lita.configure do |config|
|
28
|
+
config.adapters.campfire.tinder_options = tinder_options
|
36
29
|
end
|
37
30
|
|
38
|
-
|
39
|
-
|
40
|
-
Lita.configure do |config|
|
41
|
-
config.adapter.tinder_options = tinder_options
|
42
|
-
end
|
43
|
-
|
44
|
-
expect(described_class::Connector).to receive(:new).with(robot, hash_including(:tinder_options => tinder_options))
|
45
|
-
subject
|
46
|
-
end
|
31
|
+
expect(described_class::Connector).to receive(:new).with(robot, hash_including(:tinder_options => tinder_options))
|
32
|
+
subject
|
47
33
|
end
|
48
34
|
|
49
35
|
describe '#run' do
|
@@ -105,4 +91,4 @@ describe Lita::Adapters::Campfire, lita: true do
|
|
105
91
|
subject.shut_down
|
106
92
|
end
|
107
93
|
end
|
108
|
-
end
|
94
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-campfire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose Luis Salas
|
@@ -9,16 +9,13 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: lita
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 2.7.0
|
21
|
-
- - "<"
|
22
19
|
- !ruby/object:Gem::Version
|
23
20
|
version: 4.0.0
|
24
21
|
type: :runtime
|
@@ -26,9 +23,6 @@ dependencies:
|
|
26
23
|
version_requirements: !ruby/object:Gem::Requirement
|
27
24
|
requirements:
|
28
25
|
- - ">="
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: 2.7.0
|
31
|
-
- - "<"
|
32
26
|
- !ruby/object:Gem::Version
|
33
27
|
version: 4.0.0
|
34
28
|
- !ruby/object:Gem::Dependency
|
@@ -126,7 +120,6 @@ files:
|
|
126
120
|
- ".gitignore"
|
127
121
|
- ".travis.yml"
|
128
122
|
- Gemfile
|
129
|
-
- Gemfile.lock
|
130
123
|
- README.md
|
131
124
|
- Rakefile
|
132
125
|
- lib/lita-campfire.rb
|
@@ -160,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
153
|
version: '0'
|
161
154
|
requirements: []
|
162
155
|
rubyforge_project:
|
163
|
-
rubygems_version: 2.2.
|
156
|
+
rubygems_version: 2.2.2
|
164
157
|
signing_key:
|
165
158
|
specification_version: 4
|
166
159
|
summary: A Campfire adapter for the Lita chat robot.
|
data/Gemfile.lock
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
lita-campfire (0.2.1)
|
5
|
-
lita (>= 2.7.0, < 4.0.0)
|
6
|
-
tinder (~> 1.10.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
coveralls (0.7.0)
|
12
|
-
multi_json (~> 1.3)
|
13
|
-
rest-client
|
14
|
-
simplecov (>= 0.7)
|
15
|
-
term-ansicolor
|
16
|
-
thor
|
17
|
-
diff-lcs (1.2.5)
|
18
|
-
docile (1.1.5)
|
19
|
-
eventmachine (1.0.3)
|
20
|
-
faraday (0.9.0)
|
21
|
-
multipart-post (>= 1.2, < 3)
|
22
|
-
faraday_middleware (0.9.1)
|
23
|
-
faraday (>= 0.7.4, < 0.10)
|
24
|
-
hashie (2.1.2)
|
25
|
-
http_parser.rb (0.5.3)
|
26
|
-
http_router (0.11.1)
|
27
|
-
rack (>= 1.0.0)
|
28
|
-
url_mount (~> 0.2.1)
|
29
|
-
i18n (0.6.11)
|
30
|
-
ice_nine (0.11.0)
|
31
|
-
json (1.8.1)
|
32
|
-
lita (3.3.1)
|
33
|
-
bundler (>= 1.3)
|
34
|
-
faraday (>= 0.8.7)
|
35
|
-
http_router (>= 0.11.1)
|
36
|
-
i18n (>= 0.6.9)
|
37
|
-
ice_nine (>= 0.11.0)
|
38
|
-
multi_json (>= 1.7.7)
|
39
|
-
puma (>= 2.7.1)
|
40
|
-
rack (>= 1.5.2)
|
41
|
-
rb-readline (>= 0.5.1)
|
42
|
-
redis-namespace (>= 1.3.0)
|
43
|
-
thor (>= 0.18.1)
|
44
|
-
mime-types (2.3)
|
45
|
-
multi_json (1.10.1)
|
46
|
-
multipart-post (2.0.0)
|
47
|
-
netrc (0.7.7)
|
48
|
-
puma (2.9.0)
|
49
|
-
rack (>= 1.1, < 2.0)
|
50
|
-
rack (1.5.2)
|
51
|
-
rake (10.3.2)
|
52
|
-
rb-readline (0.5.1)
|
53
|
-
redis (3.1.0)
|
54
|
-
redis-namespace (1.5.1)
|
55
|
-
redis (~> 3.0, >= 3.0.4)
|
56
|
-
rest-client (1.7.2)
|
57
|
-
mime-types (>= 1.16, < 3.0)
|
58
|
-
netrc (~> 0.7)
|
59
|
-
rspec (3.0.0)
|
60
|
-
rspec-core (~> 3.0.0)
|
61
|
-
rspec-expectations (~> 3.0.0)
|
62
|
-
rspec-mocks (~> 3.0.0)
|
63
|
-
rspec-core (3.0.3)
|
64
|
-
rspec-support (~> 3.0.0)
|
65
|
-
rspec-expectations (3.0.3)
|
66
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
-
rspec-support (~> 3.0.0)
|
68
|
-
rspec-mocks (3.0.3)
|
69
|
-
rspec-support (~> 3.0.0)
|
70
|
-
rspec-support (3.0.3)
|
71
|
-
simple_oauth (0.1.9)
|
72
|
-
simplecov (0.9.0)
|
73
|
-
docile (~> 1.1.0)
|
74
|
-
multi_json
|
75
|
-
simplecov-html (~> 0.8.0)
|
76
|
-
simplecov-html (0.8.0)
|
77
|
-
term-ansicolor (1.3.0)
|
78
|
-
tins (~> 1.0)
|
79
|
-
thor (0.19.1)
|
80
|
-
tinder (1.10.0)
|
81
|
-
eventmachine (~> 1.0)
|
82
|
-
faraday (~> 0.9.0)
|
83
|
-
faraday_middleware (~> 0.9)
|
84
|
-
hashie (>= 1.0, < 3)
|
85
|
-
json (~> 1.8.0)
|
86
|
-
mime-types
|
87
|
-
multi_json (~> 1.7)
|
88
|
-
twitter-stream (~> 0.1)
|
89
|
-
tins (1.3.0)
|
90
|
-
twitter-stream (0.1.16)
|
91
|
-
eventmachine (>= 0.12.8)
|
92
|
-
http_parser.rb (~> 0.5.1)
|
93
|
-
simple_oauth (~> 0.1.4)
|
94
|
-
url_mount (0.2.1)
|
95
|
-
rack
|
96
|
-
|
97
|
-
PLATFORMS
|
98
|
-
ruby
|
99
|
-
|
100
|
-
DEPENDENCIES
|
101
|
-
bundler (~> 1.6)
|
102
|
-
coveralls
|
103
|
-
lita-campfire!
|
104
|
-
rake
|
105
|
-
rspec (~> 3.0)
|
106
|
-
simplecov
|