lita-hipchat 1.6.2 → 2.0.0

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: 2008096896f5668bf8f7ab76b4052adfd9234ebc
4
- data.tar.gz: e8330ab2e846e8f0e29ca0c9f044b22c09e56693
3
+ metadata.gz: 06b49ea9905f7fa01abf8fc5ea4ac12b3ee8534a
4
+ data.tar.gz: 743d1bb267b79febabd7f2dd224c45d9ba96b2fa
5
5
  SHA512:
6
- metadata.gz: 698f9488fab611f47c4624d96050ef1f13a19bac98e8a3e7c765b2c8d14eec23b1c28d39e03cddb56fe86b8d48b756305a697b2903b71ffd418b83f51aabdcc0
7
- data.tar.gz: f1736b9d19db9c29ce4b9fe40656a103907f9a7f4ed2efbe684af4fd5052708ad4512dbbc90a8c96d15182a4570c8d7fe3b56cbc411876608fbd509450a78159
6
+ metadata.gz: deb61b39730229d24905c17aee14d1fa98046ed14d90fdb949ba625f7632e2e796eb4e90313a50aa5c40bee01ee8adaecb9e668cf5626ce1fcc514d5513c1ef8
7
+ data.tar.gz: ded6e57e89e1dea9a5d2bf323b5df42db99f4fef4602cf23af637c9392ffe445773fab8b1c6d453647d7cc9df0995e2c5c195835577f54fbee4f255e700114cd
data/README.md CHANGED
@@ -40,11 +40,11 @@ There's no need to set `config.robot.mention_name` manually. The adapter will lo
40
40
  Lita.configure do |config|
41
41
  config.robot.name = "Lita Bot"
42
42
  config.robot.adapter = :hipchat
43
- config.adapter.jid = "12345_123456@chat.hipchat.com"
44
- config.adapter.password = "secret"
45
- config.adapter.debug = false
46
- config.adapter.rooms = :all
47
- config.adapter.muc_domain = "conf.hipchat.com"
43
+ config.adapters.hipchat.jid = "12345_123456@chat.hipchat.com"
44
+ config.adapters.hipchat.password = "secret"
45
+ config.adapters.hipchat.debug = true
46
+ config.adapters.hipchat.rooms = :all
47
+ config.adapters.hipchat.muc_domain = "conf.hipchat.com"
48
48
  end
49
49
  ```
50
50
 
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -4,13 +4,23 @@ require "lita/adapters/hipchat/connector"
4
4
  module Lita
5
5
  module Adapters
6
6
  class HipChat < Adapter
7
- require_configs :jid, :password
7
+ namespace "hipchat"
8
+
9
+ # Required attributes
10
+ config :jid, type: String, required: true
11
+ config :password, type: String, required: true
12
+
13
+ # Optional attributes
14
+ config :debug, type: [TrueClass, FalseClass], default: false
15
+ config :rooms, type: [Symbol, Array]
16
+ config :muc_domain, type: String, default: "conf.hipchat.com"
17
+ config :ignore_unknown_users, type: [TrueClass, FalseClass], default: false
8
18
 
9
19
  attr_reader :connector
10
20
 
11
21
  def initialize(robot)
12
22
  super
13
- @connector = Connector.new(robot, config.jid, config.password, debug: debug)
23
+ @connector = Connector.new(robot, config.jid, config.password, debug: config.debug)
14
24
  end
15
25
 
16
26
  def join(room_id)
@@ -64,16 +74,8 @@ module Lita
64
74
  end
65
75
  end
66
76
 
67
- def config
68
- Lita.config.adapter
69
- end
70
-
71
- def debug
72
- config.debug || false
73
- end
74
-
75
77
  def muc_domain
76
- config.muc_domain.nil? ? "conf.hipchat.com" : config.muc_domain.dup
78
+ config.muc_domain.dup
77
79
  end
78
80
 
79
81
  end
data/lita-hipchat.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-hipchat"
3
- spec.version = "1.6.2"
3
+ spec.version = "2.0.0"
4
4
  spec.authors = ["Jimmy Cuadra"]
5
5
  spec.email = ["jimmy@jimmycuadra.com"]
6
6
  spec.description = %q{A HipChat adapter for Lita.}
@@ -14,12 +14,12 @@ Gem::Specification.new do |spec|
14
14
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
15
  spec.require_paths = ["lib"]
16
16
 
17
- spec.add_runtime_dependency "lita", ">= 2.5"
17
+ spec.add_runtime_dependency "lita", ">= 4.0"
18
18
  spec.add_runtime_dependency "xmpp4r", ">= 0.5.6"
19
19
 
20
20
  spec.add_development_dependency "bundler", "~> 1.3"
21
21
  spec.add_development_dependency "rake"
22
- spec.add_development_dependency "rspec", ">= 3.0.0.beta2"
22
+ spec.add_development_dependency "rspec", ">= 3.0.0"
23
23
  spec.add_development_dependency "simplecov"
24
24
  spec.add_development_dependency "coveralls"
25
25
  end
@@ -1,12 +1,12 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Lita::Adapters::HipChat do
3
+ describe Lita::Adapters::HipChat, lita: true do
4
4
  before do
5
- Lita.configure do |config|
6
- config.adapter.jid = "jid"
7
- config.adapter.password = "secret"
8
- config.adapter.rooms = nil
9
- config.adapter.muc_domain = nil
5
+ registry.register_adapter(:hipchat, described_class)
6
+
7
+ registry.configure do |config|
8
+ config.adapters.hipchat.jid = "jid"
9
+ config.adapters.hipchat.password = "secret"
10
10
  end
11
11
 
12
12
  allow(described_class::Connector).to receive(:new).and_return(connector)
@@ -14,7 +14,7 @@ describe Lita::Adapters::HipChat do
14
14
 
15
15
  subject { described_class.new(robot) }
16
16
 
17
- let(:robot) { instance_double("Lita::Robot") }
17
+ let(:robot) { Lita::Robot.new(registry) }
18
18
  let(:connector) { instance_double("Lita::Adapters::HipChat::Connector") }
19
19
  let(:domain) { "conf.hipchat.com" }
20
20
 
@@ -22,12 +22,6 @@ describe Lita::Adapters::HipChat do
22
22
  expect(Lita.adapters[:hipchat]).to eql(described_class)
23
23
  end
24
24
 
25
- it "requires config.jid and config.password" do
26
- Lita.config.adapter.jid = Lita.config.adapter.password = nil
27
- expect(Lita.logger).to receive(:fatal).with(/jid, password/)
28
- expect { subject }.to raise_error(SystemExit)
29
- end
30
-
31
25
  describe "#join" do
32
26
  let(:room) { "#foo" }
33
27
  before do
@@ -75,7 +69,7 @@ describe Lita::Adapters::HipChat do
75
69
  context "with a custom domain" do
76
70
  let(:domain) { "foo.bar.com" }
77
71
  it "joins rooms with a custom muc_domain" do
78
- Lita.config.adapter.muc_domain = domain
72
+ registry.config.adapters.hipchat.muc_domain = domain
79
73
  allow(subject).to receive(:rooms).and_return(rooms)
80
74
  expect(subject.connector).to receive(:join).with(domain, anything)
81
75
  subject.run
@@ -83,7 +77,7 @@ describe Lita::Adapters::HipChat do
83
77
  end
84
78
 
85
79
  it "joins all rooms when config.rooms is :all" do
86
- Lita.config.adapter.rooms = :all
80
+ registry.config.adapters.hipchat.rooms = :all
87
81
  allow(subject.connector).to receive(:list_rooms).with(domain).and_return(rooms)
88
82
  rooms.each do |room|
89
83
  expect(subject).to receive(:join).with(room)
@@ -93,7 +87,7 @@ describe Lita::Adapters::HipChat do
93
87
 
94
88
  it "joins rooms specified by config.rooms" do
95
89
  custom_rooms = rooms
96
- Lita.config.adapter.rooms = custom_rooms
90
+ registry.config.adapters.hipchat.rooms = custom_rooms
97
91
  rooms.each do |room|
98
92
  expect(subject).to receive(:join).with(room)
99
93
  end
@@ -138,6 +132,8 @@ describe Lita::Adapters::HipChat do
138
132
  describe "#shut_down" do
139
133
  it "shuts down the connector" do
140
134
  expect(subject.connector).to receive(:shut_down)
135
+ allow(robot).to receive(:trigger)
136
+ allow(subject.connector).to receive(:part)
141
137
  expect(robot).to receive(:trigger).with(:disconnected)
142
138
  subject.shut_down
143
139
  end
data/spec/spec_helper.rb CHANGED
@@ -8,3 +8,5 @@ SimpleCov.start { add_filter "/spec/" }
8
8
 
9
9
  require "lita-hipchat"
10
10
  require "lita/rspec"
11
+
12
+ Lita.version_3_compatibility_mode = false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-hipchat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Cuadra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-16 00:00:00.000000000 Z
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.5'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '2.5'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: xmpp4r
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 3.0.0.beta2
75
+ version: 3.0.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 3.0.0.beta2
82
+ version: 3.0.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement