Skip to content

Commit

Permalink
v1.0.5 - Dep Bump
Browse files Browse the repository at this point in the history
  • Loading branch information
bhaberer committed Feb 20, 2014
1 parent e54d8ff commit e72c216
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 33 deletions.
27 changes: 14 additions & 13 deletions cinch-hangouts.gemspec
Expand Up @@ -4,26 +4,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cinch/plugins/hangouts/version'

Gem::Specification.new do |gem|
gem.name = "cinch-hangouts"
gem.name = 'cinch-hangouts'
gem.version = Cinch::Plugins::Hangouts::VERSION
gem.authors = ["Brian Haberer"]
gem.email = ["bhaberer@gmail.com"]
gem.authors = ['Brian Haberer']
gem.email = ['bhaberer@gmail.com']
gem.description = %q{Cinch Plugin to track any Google Hangouts that are linked into the channel}
gem.summary = %q{Cinch Plugin for racking Google Hangouts}
gem.homepage = "https://github.com/bhaberer/cinch-hangouts"
gem.homepage = 'https://github.com/bhaberer/cinch-hangouts'
gem.license = 'MIT'

gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
gem.require_paths = ['lib']

gem.add_development_dependency 'rake'
gem.add_development_dependency 'rspec'
gem.add_development_dependency 'coveralls'
gem.add_development_dependency 'cinch-test'
gem.add_development_dependency 'rake'
gem.add_development_dependency 'rspec'
gem.add_development_dependency 'coveralls'
gem.add_development_dependency 'cinch-test'

gem.add_dependency 'cinch', '~> 2.0.5'
gem.add_dependency 'cinch-storage', '~> 1.0.3'
gem.add_dependency 'cinch-toolbox', '~> 1.0.3'
gem.add_dependency 'time-lord', '~> 1.0.1'
gem.add_dependency 'cinch', '~> 2.0.12'
gem.add_dependency 'cinch-storage', '~> 1.1.0'
gem.add_dependency 'cinch-toolbox', '~> 1.1.0'
gem.add_dependency 'time-lord', '~> 1.0.1'
end
8 changes: 4 additions & 4 deletions lib/cinch/plugins/hangouts.rb
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
require 'cinch'
require 'cinch-storage'
require 'cinch/storage'
require 'cinch/toolbox'
require 'time-lord'

Expand Down Expand Up @@ -95,12 +95,12 @@ def list_hangouts(m)
end
end

def respond(m, message)
def respond(user, message)
case @response_type
when :notice
m.user.notice message
user.notice message
when :pm
m.user.send message
user.send message
end
end
end
Expand Down
8 changes: 2 additions & 6 deletions lib/cinch/plugins/hangouts/hangout.rb
Expand Up @@ -10,16 +10,12 @@ def initialize(nick, id, time)
end

def save
storage = CinchStorage.new(@@hangout_filename)
storage = Cinch::Storage.new(@@hangout_filename)
storage.data[:hangouts] ||= {}
storage.data[:hangouts][id] = self
storage.save
end

def to_yaml
{ nick: @nick, id: @id, time: @time }
end

def self.find_by_id(id)
listing[id]
end
Expand Down Expand Up @@ -52,7 +48,7 @@ def self.url(id, shorten = true)
private

def self.read_file
storage = CinchStorage.new(@@hangout_filename)
storage = Cinch::Storage.new(@@hangout_filename)
unless storage.data[:hangouts]
storage.data[:hangouts] = {}
storage.save
Expand Down
9 changes: 5 additions & 4 deletions lib/cinch/plugins/hangouts/subscription.rb
Expand Up @@ -34,17 +34,18 @@ def self.notify(hangout_id, bot)
nick = Hangout.find_by_id(hangout_id).nick
list.each_value do |s|
# Don't link the person who linked it.
if nick != s.nick
unless nick == s.nick
user = Cinch::User.new(s.nick, bot)
user.msg("#{nick} just linked a new hangout at: " +
Hangout.url(hangout_id))
message = "#{nick} just linked a new hangout at: " +
Hangout.url(hangout_id)
Hangout.respond(user, message)
end
end
end

private

def self.storage
CinchStorage.new(@@subscription_filename)
Cinch::Storage.new(@@subscription_filename)
end
end
2 changes: 1 addition & 1 deletion lib/cinch/plugins/hangouts/version.rb
Expand Up @@ -3,7 +3,7 @@ module Cinch
module Plugins
# Versioning Info
class Hangouts
VERSION = '1.0.4'
VERSION = '1.0.5'
end
end
end
22 changes: 17 additions & 5 deletions spec/cinch-hangouts_spec.rb
Expand Up @@ -57,6 +57,18 @@
reply.should match(/it was last linked \d seconds? ago/)
end

it 'should recapture a legit Hangout link' do
id = random_hangout_id
msg = make_message(@bot, Hangout.url(id, false), { channel: '#foo' })
get_replies(msg)
sleep 1 # hack until 'time-lord' fix gets released
get_replies(msg)
sleep 1 # hack until 'time-lord' fix gets released
msg = make_message(@bot, '!hangouts')
reply = get_replies(msg).length
.should == 2
end

it 'should capture a new short Hangout link and store it in @storage' do
msg = make_message(@bot, Hangout.url('7acpjrpcmgl00u0b665mu25b1g', false), { :channel => '#foo' })
get_replies(msg).should be_empty
Expand All @@ -76,9 +88,9 @@
end

it 'should allow users to subscribe' do
msg = make_message(@bot, '!hangouts subscribe')
get_replies(msg).first.text.
should include("You are now subscribed")
get_replies(make_message(@bot, '!hangouts subscribe'))
Cinch::Plugins::Hangouts::Subscription.list.length
.should == 1
end

it 'should inform users that they already subscribed' do
Expand All @@ -91,8 +103,8 @@
it 'should allow users to unsubscribe' do
get_replies(make_message(@bot, '!hangouts subscribe'))
msg = make_message(@bot, '!hangouts unsubscribe')
get_replies(msg).first.text.
should include("You are now unsubscribed")
Cinch::Plugins::Hangouts::Subscription.list.length
.should == 0
end

it 'should inform users that they are not subscribed on an unsubscribe' do
Expand Down

0 comments on commit e72c216

Please sign in to comment.