cinch-rabbit 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/Rakefile +7 -0
- data/cinch-rabbit.gemspec +28 -0
- data/lib/cinch-rabbit.rb +5 -0
- data/lib/cinch/plugins/rabbit.rb +90 -0
- data/lib/cinch/plugins/rabbit/rabbit_link.rb +55 -0
- data/lib/cinch/plugins/rabbit/subscription.rb +61 -0
- data/lib/cinch/plugins/rabbit/version.rb +9 -0
- data/spec/cinch-rabbit-subscriptions_spec.rb +61 -0
- data/spec/cinch-rabbit_spec.rb +69 -0
- data/spec/spec_helper.rb +18 -0
- metadata +184 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1acd4f7002d04e91ee884421d6728b81ee54c358
|
4
|
+
data.tar.gz: 3a112d87526086510a3799b5c96b72d7cccd7c98
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 515e8cdc741bdd2cab57ced484a7e6b300893e92e27645ff1c4f4e141c3a637fc22c240eae1ee99c9ee689a79bb6b1c745779eb48257d4e9a5cf99fb815fdba9
|
7
|
+
data.tar.gz: 8573395e7391ce959895ca0e8c4d79f0bf686ac57881b4c5e94a518bd9eee70ae92a62518cee264393f9c3da7bba3f3f3b9320feebff2335345fa2f54e87cac0
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Brian Haberer
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Cinch::Plugins::Rabbit
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/cinch-rabbit.png)](http://badge.fury.io/rb/cinch-rabbit)
|
4
|
+
[![Dependency Status](https://gemnasium.com/bhaberer/cinch-rabbit.png)](https://gemnasium.com/bhaberer/cinch-rabbit)
|
5
|
+
[![Build Status](https://travis-ci.org/bhaberer/cinch-rabbit.png?branch=master)](https://travis-ci.org/bhaberer/cinch-rabbit)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/bhaberer/cinch-rabbit/badge.png?branch=master)](https://coveralls.io/r/bhaberer/cinch-rabbit?branch=master)
|
7
|
+
[![Code Climate](https://codeclimate.com/github/bhaberer/cinch-rabbit.png)](https://codeclimate.com/github/bhaberer/cinch-rabbit)
|
8
|
+
|
9
|
+
Cinch Plugin for tracking Rabbit URLs linked in the channel.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'cinch-rabbit'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install cinch-rabbit
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Just add the plugin to your list:
|
28
|
+
|
29
|
+
@bot = Cinch::Bot.new do
|
30
|
+
configure do |c|
|
31
|
+
c.plugins.plugins = [Cinch::Plugins::Rabbit]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
Then in channel use !rabbit to get notifications of the rabbit that have been linked recently.
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cinch/plugins/rabbit/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = 'cinch-rabbit'
|
8
|
+
gem.version = Cinch::Plugins::Rabbit::VERSION
|
9
|
+
gem.authors = ['Brian Haberer']
|
10
|
+
gem.email = ['bhaberer@gmail.com']
|
11
|
+
gem.description = %q{Cinch Plugin to track any Rabbit that are linked into the channel}
|
12
|
+
gem.summary = %q{Cinch Plugin for racking Rabbit links}
|
13
|
+
gem.homepage = 'https://github.com/bhaberer/cinch-rabbit'
|
14
|
+
gem.license = 'MIT'
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.require_paths = ['lib']
|
20
|
+
|
21
|
+
gem.add_development_dependency 'rake', '~> 10'
|
22
|
+
gem.add_development_dependency 'rspec', '~> 3'
|
23
|
+
gem.add_development_dependency 'cinch-test', '~> 0.1'
|
24
|
+
gem.add_dependency 'cinch', '~> 2.0', '>= 2.0.12'
|
25
|
+
gem.add_dependency 'cinch-storage', '~> 1.2', '>= 1.2.0'
|
26
|
+
gem.add_dependency 'cinch-toolbox', '~> 1.1', '>= 1.0.0'
|
27
|
+
gem.add_dependency 'time-lord', '~> 1.0', '>= 1.0.1'
|
28
|
+
end
|
data/lib/cinch-rabbit.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'cinch'
|
3
|
+
require 'cinch/storage'
|
4
|
+
require 'cinch/toolbox'
|
5
|
+
require 'time-lord'
|
6
|
+
|
7
|
+
module Cinch::Plugins
|
8
|
+
# Plugin to track Rabb.it links
|
9
|
+
class Rabbit
|
10
|
+
include Cinch::Plugin
|
11
|
+
|
12
|
+
attr_accessor :storage
|
13
|
+
|
14
|
+
self.help = 'Use .rabbit to see the info for any recent rabbits. You ' +
|
15
|
+
'can also use .rabbit subscribe to sign up for notifications'
|
16
|
+
|
17
|
+
match /(rabbits?|movie)\z/, method: :list_rabbits
|
18
|
+
# match /rabbits subscribe/, method: :subscribe
|
19
|
+
# match /rabbits unsubscribe/, method: :unsubscribe
|
20
|
+
|
21
|
+
listen_to :channel
|
22
|
+
|
23
|
+
# This is the regex that captures rabbit links
|
24
|
+
# The regex will need to be updated if the url scheme changes in the future
|
25
|
+
RABBIT_REGEX = %r(rabb\.it/r/([a-zA-Z0-9]{6}))
|
26
|
+
|
27
|
+
def initialize(*args)
|
28
|
+
super
|
29
|
+
@expire = config[:expire_period] || 120
|
30
|
+
@response_type = config[:response_type] || :notice
|
31
|
+
end
|
32
|
+
|
33
|
+
def listen(m)
|
34
|
+
rabbit_id = m.message[RABBIT_REGEX, 1]
|
35
|
+
process_rabbit(rabbit_id, m) if rabbit_id
|
36
|
+
end
|
37
|
+
|
38
|
+
def process_rabbit(rabbit_id, m)
|
39
|
+
if RabbitLink.find_by_id(rabbit_id)
|
40
|
+
# If it's an old rabbit capture a new expiration time
|
41
|
+
rabbit = RabbitLink.find_by_id(rabbit_id)
|
42
|
+
rabbit.time = Time.now
|
43
|
+
rabbit.save
|
44
|
+
else
|
45
|
+
RabbitLink.new(m.user.nick, rabbit_id, Time.now).save
|
46
|
+
Subscription.notify(rabbit_id, @bot, @response_type)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def subscribe(m)
|
51
|
+
nick = m.user.nick
|
52
|
+
if Subscription.for_user(nick)
|
53
|
+
msg = 'You are already subscribed. '
|
54
|
+
else
|
55
|
+
sub = Subscription.new(nick, @subscription_filename)
|
56
|
+
sub.save
|
57
|
+
msg = 'You are now subscribed. ' +
|
58
|
+
'I will let you know when a rabbit is linked. '
|
59
|
+
end
|
60
|
+
m.user.notice msg + 'To unsubscribe use `.rabbit unsubscribe`.'
|
61
|
+
end
|
62
|
+
|
63
|
+
def unsubscribe(m)
|
64
|
+
nick = m.user.nick
|
65
|
+
if Subscription.for_user(nick)
|
66
|
+
Subscription.for_user(nick).delete
|
67
|
+
msg = 'You are now unsubscribed, and will no ' +
|
68
|
+
'longer receive a messages. '
|
69
|
+
else
|
70
|
+
msg = 'You are not subscribed. '
|
71
|
+
end
|
72
|
+
m.user.notice msg + 'To subscribe use `.rabbit subscribe`.'
|
73
|
+
end
|
74
|
+
|
75
|
+
def list_rabbits(m)
|
76
|
+
RabbitLink.delete_expired(@expire)
|
77
|
+
if RabbitLink.sorted.empty?
|
78
|
+
m.user.notice 'No rabbits have been linked recently!'
|
79
|
+
return
|
80
|
+
end
|
81
|
+
m.user.notice 'These rabbits have been linked in the last ' +
|
82
|
+
"#{@expire} minutes. They may or may not still be going."
|
83
|
+
RabbitLink.sorted.each do |rabbit|
|
84
|
+
m.user.notice "#{rabbit.nick} started a rabbit at " +
|
85
|
+
RabbitLink.url(rabbit.id) +
|
86
|
+
" it was last linked #{rabbit.time.ago.to_words}"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
# Class to manage Hangout information
|
3
|
+
class RabbitLink < Cinch::Plugins::Rabbit
|
4
|
+
attr_accessor :nick, :id, :time, :file
|
5
|
+
FILENAME = ENV['RABBIT_LINKS_FILE'] || 'yaml/rabbit_links.yml'
|
6
|
+
|
7
|
+
def initialize(nick, id, time)
|
8
|
+
@nick = nick
|
9
|
+
@id = id
|
10
|
+
@time = time
|
11
|
+
end
|
12
|
+
|
13
|
+
def save
|
14
|
+
storage = Cinch::Storage.new(FILENAME)
|
15
|
+
storage.data ||= {}
|
16
|
+
storage.data[id] = self
|
17
|
+
storage.save
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.find_by_id(id)
|
21
|
+
listing[id]
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.delete_expired(expire_time)
|
25
|
+
return if listing.nil?
|
26
|
+
storage = read_file
|
27
|
+
storage.data.delete_if do |id, rabbit|
|
28
|
+
(Time.now - rabbit.time) > (expire_time * 60)
|
29
|
+
end
|
30
|
+
storage.save
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.sorted
|
34
|
+
rabbits = listing.values
|
35
|
+
rabbits.sort! { |x, y| y.time <=> x.time }
|
36
|
+
rabbits
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.listing
|
40
|
+
read_file.data
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.url(id)
|
44
|
+
"https://rabb.it/r/#{id}"
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def self.read_file
|
50
|
+
storage = Cinch::Storage.new(FILENAME)
|
51
|
+
storage.data ||= {}
|
52
|
+
storage.save
|
53
|
+
storage
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
# Class to handle user subscriptions
|
3
|
+
class RabbitSubscription < Cinch::Plugins::Rabbit
|
4
|
+
attr_accessor :nick, :all_links
|
5
|
+
FILENAME = ENV['RABBIT_SUBSCRIPTIONS_FILE'] || 'yaml/rabbit_subs.yml'
|
6
|
+
|
7
|
+
def initialize(nick, file)
|
8
|
+
@nick = nick
|
9
|
+
@all_links = false
|
10
|
+
save
|
11
|
+
end
|
12
|
+
|
13
|
+
def save
|
14
|
+
subs = Subscription.storage
|
15
|
+
subs.data[nick] = self
|
16
|
+
subs.save
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete
|
20
|
+
subs = Subscription.storage
|
21
|
+
subs.data.delete(nick)
|
22
|
+
subs.save
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.for_user(nick)
|
26
|
+
return nil unless list.key?(nick)
|
27
|
+
list[nick]
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.list
|
31
|
+
storage.data
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.notify(rabbit_id, bot, type)
|
35
|
+
nick = RabbitLink.find_by_id(rabbit_id).nick
|
36
|
+
list.each_value do |s|
|
37
|
+
# Don't link the person who linked it.
|
38
|
+
unless nick == s.nick
|
39
|
+
user = Cinch::User.new(s.nick, bot)
|
40
|
+
message = "#{nick} just linked a new rabbit at: " +
|
41
|
+
RabbitLink.url(rabbit_id)
|
42
|
+
respond(user, message, type)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.respond(user, message, type)
|
48
|
+
case type
|
49
|
+
when :notice
|
50
|
+
user.notice message
|
51
|
+
when :pm
|
52
|
+
user.send message
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def self.storage
|
59
|
+
Cinch::Storage.new(FILENAME)
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Cinch::Plugins::Rabbit do
|
4
|
+
include Cinch::Test
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
['/tmp/rabbit_subs_file.yml', '/tmp/rabbit_links_file.yml'].each do |file|
|
8
|
+
File.delete(file) if File.exist?(file)
|
9
|
+
end
|
10
|
+
@bot = make_bot(Cinch::Plugins::Rabbit)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'subscriptions' do
|
14
|
+
it 'should allow users to subscribe' do
|
15
|
+
msg = make_message(@bot, '!rabbits subscribe')
|
16
|
+
expect(get_replies(msg).first.text).to include("You are now subscribed")
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should allow users to subscribe' do
|
20
|
+
get_replies(make_message(@bot, '!rabbits subscribe'))
|
21
|
+
expect(Cinch::Plugins::Rabbit::Subscription.list.length).to eq(1)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should inform users that they already subscribed' do
|
25
|
+
get_replies(make_message(@bot, '!rabbits subscribe'))
|
26
|
+
msg = make_message(@bot, '!rabbits subscribe')
|
27
|
+
expect(get_replies(msg).first.text).to include("You are already subscribed")
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should allow users to unsubscribe' do
|
31
|
+
get_replies(make_message(@bot, '!rabbits subscribe'))
|
32
|
+
get_replies(make_message(@bot, '!rabbits unsubscribe'))
|
33
|
+
expect(Cinch::Plugins::Rabbit::Subscription.list.length).to be_zero
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should inform users that they are not subscribed on an unsubscribe' do
|
37
|
+
msg = make_message(@bot, '!rabbits unsubscribe')
|
38
|
+
expect(get_replies(msg).first.text).to include("You are not subscribed.")
|
39
|
+
end
|
40
|
+
|
41
|
+
#it 'should notify users when a new rabbit is linked' do
|
42
|
+
# get_replies(make_message(@bot, '!rabbits subscribe'), { channel: '#foo', nick: 'joe' } )
|
43
|
+
# msgs = get_replies(make_message(@bot, RabbitLink.url(random_rabbit_id, false), { channel: '#foo', nick: 'josh' }))
|
44
|
+
# msgs.first.should_not be_nil
|
45
|
+
#end
|
46
|
+
|
47
|
+
it 'should not notify users when an old rabbit is relinked' do
|
48
|
+
get_replies(make_message(@bot, '!rabbits subscribe'), { :channel => '#foo' } )
|
49
|
+
get_replies(make_message(@bot, RabbitLink.url(random_rabbit_id, false), { :channel => '#foo' }))
|
50
|
+
msg = make_message(@bot, RabbitLink.url(random_rabbit_id, false), { :channel => '#foo' })
|
51
|
+
expect(get_replies(msg)).to be_empty
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def random_rabbit_id(len = 6)
|
56
|
+
chars = %w{ a b c d e f 0 1 2 3 4 5 6 7 8 9 }
|
57
|
+
string = ''
|
58
|
+
len.times { string << chars[rand(chars.length)] }
|
59
|
+
string
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Cinch::Plugins::Rabbit do
|
4
|
+
include Cinch::Test
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
['/tmp/rabbit_subs_file.yml', '/tmp/rabbit_links_file.yml'].each do |file|
|
8
|
+
File.delete(file) if File.exist?(file)
|
9
|
+
end
|
10
|
+
@bot = make_bot(Cinch::Plugins::Rabbit)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'handling rabbit links' do
|
14
|
+
it 'should return an error if no one has linked a rabbit' do
|
15
|
+
msg = get_replies(make_message(@bot, '!rabbits', { channel: '#foo' }))
|
16
|
+
expect(msg.first.text).to eq("No rabbits have been linked recently!")
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should not capture a malformed (invalid chars) Rabbit link' do
|
20
|
+
msg = make_message(@bot, RabbitLink.url('82b5@!'), { channel: '#foo' })
|
21
|
+
expect(get_replies(msg)).to be_empty
|
22
|
+
msg = make_message(@bot, '!rabbits')
|
23
|
+
msg = get_replies(msg).first.text
|
24
|
+
expect(msg).to eql("No rabbits have been linked recently!")
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should not capture a malformed (short length) Rabbit link' do
|
28
|
+
msg = make_message(@bot, RabbitLink.url('82b5'), { channel: '#foo' })
|
29
|
+
expect(get_replies(msg)).to be_empty
|
30
|
+
msg = make_message(@bot, '!rabbits')
|
31
|
+
expect(get_replies(msg).first.text).to eq("No rabbits have been linked recently!")
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should capture a legit Rabbit link and store it in @storage' do
|
35
|
+
msg = make_message(@bot, RabbitLink.url('82b512'), { channel: '#foo' })
|
36
|
+
expect(get_replies(msg)).to be_empty
|
37
|
+
sleep 1 # hack until 'time-lord' fix gets released
|
38
|
+
msg = make_message(@bot, '!rabbits')
|
39
|
+
reply = get_replies(msg).last.text
|
40
|
+
expect(reply).to include('test started a rabbit at')
|
41
|
+
expect(reply).to match(/it was last linked \d seconds? ago/)
|
42
|
+
end
|
43
|
+
|
44
|
+
=begin
|
45
|
+
|
46
|
+
it 'should capture a legit Rabbit link if it has trailing params' do
|
47
|
+
msg = make_message(@bot, RabbitLink.url(random_rabbit_id + '?hl=en', false), { channel: '#foo' })
|
48
|
+
get_replies(msg)
|
49
|
+
sleep 1 # hack until 'time-lord' fix gets released
|
50
|
+
msg = make_message(@bot, '!rabbits')
|
51
|
+
reply = get_replies(msg).last.text
|
52
|
+
expect(reply).to include "test started a rabbit at"
|
53
|
+
expect(reply).to match(/it was last linked \d seconds? ago/)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should recapture a legit Rabbit link' do
|
57
|
+
id = random_rabbit_id
|
58
|
+
msg = make_message(@bot, RabbitLink.url(id, false), { channel: '#foo' })
|
59
|
+
get_replies(msg)
|
60
|
+
sleep 1 # hack until 'time-lord' fix gets released
|
61
|
+
get_replies(msg)
|
62
|
+
sleep 1 # hack until 'time-lord' fix gets released
|
63
|
+
msg = make_message(@bot, '!rabbits')
|
64
|
+
reply = get_replies(msg).length
|
65
|
+
expect(reply).to eq(2)
|
66
|
+
end
|
67
|
+
=end
|
68
|
+
end
|
69
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
require 'simplecov'
|
3
|
+
|
4
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
5
|
+
SimpleCov::Formatter::HTMLFormatter,
|
6
|
+
Coveralls::SimpleCov::Formatter
|
7
|
+
]
|
8
|
+
SimpleCov.start
|
9
|
+
|
10
|
+
ENV['RABBIT_LINKS_FILE'] = '/tmp/rabbit_links_file.yml'
|
11
|
+
ENV['RABBIT_SUBSCRIPTIONS_FILE'] = '/tmp/rabbit_subs_file.yml'
|
12
|
+
|
13
|
+
[ENV['RABBIT_LINKS_FILE'], ENV['RABBIT_SUBSCRIPTIONS_FILE']].each do |file|
|
14
|
+
File.delete(file) if File.exists?(file)
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'cinch-rabbit'
|
18
|
+
require 'cinch/test'
|
metadata
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cinch-rabbit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brian Haberer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cinch-test
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: cinch
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 2.0.12
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '2.0'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 2.0.12
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: cinch-storage
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '1.2'
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 1.2.0
|
85
|
+
type: :runtime
|
86
|
+
prerelease: false
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '1.2'
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.2.0
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: cinch-toolbox
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '1.1'
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 1.0.0
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '1.1'
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: 1.0.0
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: time-lord
|
117
|
+
requirement: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - "~>"
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '1.0'
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.0.1
|
125
|
+
type: :runtime
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.0'
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 1.0.1
|
135
|
+
description: Cinch Plugin to track any Rabbit that are linked into the channel
|
136
|
+
email:
|
137
|
+
- bhaberer@gmail.com
|
138
|
+
executables: []
|
139
|
+
extensions: []
|
140
|
+
extra_rdoc_files: []
|
141
|
+
files:
|
142
|
+
- ".gitignore"
|
143
|
+
- ".travis.yml"
|
144
|
+
- Gemfile
|
145
|
+
- LICENSE.txt
|
146
|
+
- README.md
|
147
|
+
- Rakefile
|
148
|
+
- cinch-rabbit.gemspec
|
149
|
+
- lib/cinch-rabbit.rb
|
150
|
+
- lib/cinch/plugins/rabbit.rb
|
151
|
+
- lib/cinch/plugins/rabbit/rabbit_link.rb
|
152
|
+
- lib/cinch/plugins/rabbit/subscription.rb
|
153
|
+
- lib/cinch/plugins/rabbit/version.rb
|
154
|
+
- spec/cinch-rabbit-subscriptions_spec.rb
|
155
|
+
- spec/cinch-rabbit_spec.rb
|
156
|
+
- spec/spec_helper.rb
|
157
|
+
homepage: https://github.com/bhaberer/cinch-rabbit
|
158
|
+
licenses:
|
159
|
+
- MIT
|
160
|
+
metadata: {}
|
161
|
+
post_install_message:
|
162
|
+
rdoc_options: []
|
163
|
+
require_paths:
|
164
|
+
- lib
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
requirements: []
|
176
|
+
rubyforge_project:
|
177
|
+
rubygems_version: 2.4.8
|
178
|
+
signing_key:
|
179
|
+
specification_version: 4
|
180
|
+
summary: Cinch Plugin for racking Rabbit links
|
181
|
+
test_files:
|
182
|
+
- spec/cinch-rabbit-subscriptions_spec.rb
|
183
|
+
- spec/cinch-rabbit_spec.rb
|
184
|
+
- spec/spec_helper.rb
|