lita-irc 1.1.0 → 1.2.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: 10218856be37aa87feacf88526fb7c3a917d7174
4
- data.tar.gz: c26b1cb8fd38da43748d82694b810082c5e11816
3
+ metadata.gz: f604d9501a4695877a1801bcc661adb5c652ba63
4
+ data.tar.gz: 586061b815ac4f09aa0f138030503324d829c42f
5
5
  SHA512:
6
- metadata.gz: e4c8f3d44c17c390ca2cf48a4ac45b5240202dea0071cf94cc0d262a3d8b394de0108a2fda93b8d0449d1887d78ce13e5415e45ac41284806f07039221858ce6
7
- data.tar.gz: 06b9db3c44933108d05459d0c52c54da2a7a1836d2e9569d9dd10744c58c49daa386833b9d71101bac6a4ebdc8962e29876e2f3f83379d6e7017983f1a1d06fb
6
+ metadata.gz: 59dee289523fcb3335ca46a7101595b6d84361fffe83fb72ec9f7dfc2027a15d24e23dcd9addadf9b844c5275c31320bb3fc019b037f8b019e7547500f6ccd9c
7
+ data.tar.gz: 6e9ec04a816b4a3b2047e38f4f094458e351deffdc75b8dd1bd0278792a1bf2d32684bcf326bbe9882c8bb4420f515ef7eeb53bfc3b2bb03dbcf26a303c255cc
data/README.md CHANGED
@@ -51,6 +51,10 @@ Lita.configure do |config|
51
51
  end
52
52
  ```
53
53
 
54
+ ## Events
55
+
56
+ The IRC adapter will trigger the `:connected` and `:disconnected` events when the robot has connected and disconnected from IRC, respectively. There is no payload data for either event.
57
+
54
58
  ## License
55
59
 
56
60
  [MIT](http://opensource.org/licenses/MIT)
@@ -45,6 +45,7 @@ module Lita
45
45
  def shut_down
46
46
  Lita.logger.info("Disconnecting from IRC.")
47
47
  cinch.quit
48
+ robot.trigger(:disconnected)
48
49
  end
49
50
 
50
51
  private
@@ -7,6 +7,7 @@ module Lita
7
7
  include Cinch::Plugin
8
8
 
9
9
  match /.*/
10
+ listen_to :connect, method: :on_connect
10
11
  listen_to :invite, method: :on_invite
11
12
 
12
13
  def execute(m)
@@ -17,6 +18,10 @@ module Lita
17
18
  dispatch(message)
18
19
  end
19
20
 
21
+ def on_connect(m)
22
+ robot.trigger(:connected)
23
+ end
24
+
20
25
  def on_invite(m)
21
26
  user = user_by_nick(m.user.nick)
22
27
  m.channel.join if Lita::Authorization.user_is_admin?(user)
data/lita-irc.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-irc"
3
- spec.version = "1.1.0"
3
+ spec.version = "1.2.0"
4
4
  spec.authors = ["Jimmy Cuadra"]
5
5
  spec.email = ["jimmy@jimmycuadra.com"]
6
6
  spec.description = %q{An IRC adapter for Lita.}
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
14
14
  spec.require_paths = ["lib"]
15
15
 
16
- spec.add_runtime_dependency "lita", "~> 2.0"
16
+ spec.add_runtime_dependency "lita", "~> 2.5"
17
17
  spec.add_runtime_dependency "cinch", "~> 2.0"
18
18
 
19
19
  spec.add_development_dependency "bundler", "~> 1.3"
@@ -66,6 +66,13 @@ describe Lita::Adapters::IRC::CinchPlugin do
66
66
  end
67
67
  end
68
68
 
69
+ describe "#on_connect" do
70
+ it "triggers a connected event on the robot" do
71
+ expect(robot).to receive(:trigger).with(:connected)
72
+ subject.on_connect(double)
73
+ end
74
+ end
75
+
69
76
  describe "#on_invite" do
70
77
  it "joins the room if the invite came from an admin" do
71
78
  allow(subject).to receive(:user_by_nick).and_return(user)
@@ -100,6 +100,7 @@ describe Lita::Adapters::IRC, lita: true do
100
100
  describe "#shut_down" do
101
101
  it "disconnects from IRC" do
102
102
  expect(subject.cinch).to receive(:quit)
103
+ expect(robot).to receive(:trigger).with(:disconnected)
103
104
  subject.shut_down
104
105
  end
105
106
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-irc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.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: 2013-08-31 00:00:00.000000000 Z
11
+ date: 2013-10-05 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.0'
19
+ version: '2.5'
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.0'
26
+ version: '2.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cinch
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.0.3
151
+ rubygems_version: 2.1.3
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: An IRC adapter for the Lita chat robot.