lita-irc 1.0.0 → 1.1.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: 267b171c8564fa0e0eb11cc880178646e4f3c3e2
4
- data.tar.gz: 538ee8f00c2c55061e1d7f9ba0d357f9f4cc9c0b
3
+ metadata.gz: 10218856be37aa87feacf88526fb7c3a917d7174
4
+ data.tar.gz: c26b1cb8fd38da43748d82694b810082c5e11816
5
5
  SHA512:
6
- metadata.gz: c319385fdec8f1ba1f1383957e5a7d71a430e3dcbc2288eed733f8f45b94e43ebc0898ae8b3829144130364bf1256ada4e18eea7c4cebc2f80ca5f54ae1b52cf
7
- data.tar.gz: 7b64d29931dde2ee721e96d2fd17c15c32dfbe3c46553888c850812bc770beac683ee423dbe0676a05bd1fc94dec9ad15826ef1a06f05a3a069ba660f9807a0b
6
+ metadata.gz: e4c8f3d44c17c390ca2cf48a4ac45b5240202dea0071cf94cc0d262a3d8b394de0108a2fda93b8d0449d1887d78ce13e5415e45ac41284806f07039221858ce6
7
+ data.tar.gz: 06b9db3c44933108d05459d0c52c54da2a7a1836d2e9569d9dd10744c58c49daa386833b9d71101bac6a4ebdc8962e29876e2f3f83379d6e7017983f1a1d06fb
data/.travis.yml CHANGED
@@ -4,3 +4,7 @@ rvm:
4
4
  script: bundle exec rspec
5
5
  before_install:
6
6
  - gem update --system
7
+ notifications:
8
+ webhooks:
9
+ urls:
10
+ - https://lita-freenode.herokuapp.com/travis
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2013 Jimmy Cuadra
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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # lita-irc
2
2
 
3
- [![Build Status](https://travis-ci.org/jimmycuadra/lita-irc.png)](https://travis-ci.org/jimmycuadra/lita-irc)
3
+ [![Build Status](https://travis-ci.org/jimmycuadra/lita-irc.png?branch=master)](https://travis-ci.org/jimmycuadra/lita-irc)
4
4
  [![Code Climate](https://codeclimate.com/github/jimmycuadra/lita-irc.png)](https://codeclimate.com/github/jimmycuadra/lita-irc)
5
5
  [![Coverage Status](https://coveralls.io/repos/jimmycuadra/lita-irc/badge.png)](https://coveralls.io/r/jimmycuadra/lita-irc)
6
6
 
@@ -7,6 +7,7 @@ module Lita
7
7
  include Cinch::Plugin
8
8
 
9
9
  match /.*/
10
+ listen_to :invite, method: :on_invite
10
11
 
11
12
  def execute(m)
12
13
  body = get_body(m)
@@ -16,6 +17,11 @@ module Lita
16
17
  dispatch(message)
17
18
  end
18
19
 
20
+ def on_invite(m)
21
+ user = user_by_nick(m.user.nick)
22
+ m.channel.join if Lita::Authorization.user_is_admin?(user)
23
+ end
24
+
19
25
  private
20
26
 
21
27
  def dispatch(message)
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.0.0"
3
+ spec.version = "1.1.0"
4
4
  spec.authors = ["Jimmy Cuadra"]
5
5
  spec.email = ["jimmy@jimmycuadra.com"]
6
6
  spec.description = %q{An IRC adapter for Lita.}
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  spec.add_development_dependency "bundler", "~> 1.3"
20
20
  spec.add_development_dependency "rake"
21
- spec.add_development_dependency "rspec", ">= 2.14.0.rc1"
21
+ spec.add_development_dependency "rspec", "~> 2.14"
22
22
  spec.add_development_dependency "simplecov"
23
23
  spec.add_development_dependency "coveralls"
24
24
  end
@@ -16,6 +16,13 @@ describe Lita::Adapters::IRC::CinchPlugin do
16
16
  action?: false
17
17
  ).as_null_object
18
18
  end
19
+ let(:invite_m) do
20
+ double(
21
+ "Cinch::Message",
22
+ channel: double("Cinch::Channel"),
23
+ user: double("Cinch::User", nick: "Carl")
24
+ )
25
+ end
19
26
 
20
27
  before do
21
28
  allow(subject).to receive(:config).and_return(
@@ -58,4 +65,20 @@ describe Lita::Adapters::IRC::CinchPlugin do
58
65
  subject.execute(m)
59
66
  end
60
67
  end
68
+
69
+ describe "#on_invite" do
70
+ it "joins the room if the invite came from an admin" do
71
+ allow(subject).to receive(:user_by_nick).and_return(user)
72
+ allow(Lita::Authorization).to receive(
73
+ :user_is_admin?
74
+ ).with(user).and_return(true)
75
+ expect(invite_m.channel).to receive(:join)
76
+ subject.on_invite(invite_m)
77
+ end
78
+
79
+ it "ignores the invite if it didn't come from an admin" do
80
+ expect(invite_m.channel).not_to receive(:join)
81
+ subject.on_invite(invite_m)
82
+ end
83
+ end
61
84
  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.0.0
4
+ version: 1.1.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-07-06 00:00:00.000000000 Z
11
+ date: 2013-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ~>
74
74
  - !ruby/object:Gem::Version
75
- version: 2.14.0.rc1
75
+ version: '2.14'
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: 2.14.0.rc1
82
+ version: '2.14'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -118,13 +118,14 @@ files:
118
118
  - .gitignore
119
119
  - .travis.yml
120
120
  - Gemfile
121
+ - LICENSE
121
122
  - README.md
122
123
  - Rakefile
123
124
  - lib/lita-irc.rb
124
125
  - lib/lita/adapters/irc.rb
125
126
  - lib/lita/adapters/irc/cinch_plugin.rb
126
127
  - lita-irc.gemspec
127
- - spec/lita/adapters/cinch_plugin_spec.rb
128
+ - spec/lita/adapters/irc/cinch_plugin_spec.rb
128
129
  - spec/lita/adapters/irc_spec.rb
129
130
  - spec/spec_helper.rb
130
131
  homepage: https://github.com/jimmycuadra/lita-irc
@@ -152,7 +153,7 @@ signing_key:
152
153
  specification_version: 4
153
154
  summary: An IRC adapter for the Lita chat robot.
154
155
  test_files:
155
- - spec/lita/adapters/cinch_plugin_spec.rb
156
+ - spec/lita/adapters/irc/cinch_plugin_spec.rb
156
157
  - spec/lita/adapters/irc_spec.rb
157
158
  - spec/spec_helper.rb
158
159
  has_rdoc: