Permalink
Browse files

Update README, trasnlate plugins messages and update specs.

  • Loading branch information...
LTe committed Jan 7, 2012
1 parent 4c28fd6 commit d1b762138ba55e5306688360fece73c0d22db880
View
@@ -123,7 +123,7 @@ Watch the gems and notify when new version comes out
``` ```
<LTe> watch! rails <LTe> watch! rails
<Muzang> I added gem rails to the observed <Muzang> I added gem rails to watchlist
<Muzang> Current version: 3.1.1 <Muzang> Current version: 3.1.1
... ...
<Muzang> New version of rails (4.0.0) <Muzang> New version of rails (4.0.0)
@@ -17,10 +17,10 @@ def call(connection, message)
plus_for = plus_for[1] plus_for = plus_for[1]
plus_for.gsub!(":","") plus_for.gsub!(":","")
if filter(plus_for, message.nick) if filter(plus_for, message.nick)
connection.msg(message.channel, "#{message.nick} pisze w PHP") and return connection.msg(message.channel, "#{message.nick} write in PHP") and return
end end
connection.msg(message.channel, "#{message.nick} podarowal +1 dla *#{plus_for}*") connection.msg(message.channel, "#{message.nick} gave +1 for *#{plus_for}*")
@stats[plus_for] ||= 0 @stats[plus_for] ||= 0
@stats[plus_for] += 1 @stats[plus_for] += 1
save save
@@ -34,16 +34,16 @@ def call(connection, message)
@store.transaction do @store.transaction do
@store[:gems][@current_gem][:version] = gem["version"] @store[:gems][@current_gem][:version] = gem["version"]
end end
connection.msg(message.channel, "Dodalem gema #{@current_gem} do obserwowanych") connection.msg(message.channel, "I added gem #{@current_gem} to watchlist")
connection.msg(message.channel, "Aktualna wersja: #{@current_gem} (#{gem["version"]})") connection.msg(message.channel, "Current version: #{@current_gem} (#{gem["version"]})")
@new_gem = false @new_gem = false
rescue Exception rescue Exception
connection.msg(message.channel, "Niepoprawna nazwa gema") connection.msg(message.channel, "Gem name is incorrect")
@store.transaction{@store[:gems].delete(@current_gem)} @store.transaction{@store[:gems].delete(@current_gem)}
end end
} }
else else
connection.msg(message.channel, "Gem #{@current_gem} jest juz obserwowany") connection.msg(message.channel, "Gem #{@current_gem} is already observed")
end end
end end
@@ -60,7 +60,7 @@ def call(connection, message)
@store.transaction do @store.transaction do
@store[:gems][gem[:name]][:version] = current_gem["version"] @store[:gems][gem[:name]][:version] = current_gem["version"]
end end
connection.msg(message.channel, "Nowa wersja #{gem[:name]} (#{current_gem["version"]})") connection.msg(message.channel, "New version #{gem[:name]} (#{current_gem["version"]})")
end end
rescue rescue
end end
@@ -1,5 +1,5 @@
module Muzang module Muzang
module Plugins module Plugins
VERSION = "1.1.0" VERSION = "1.1.1"
end end
end end
View
@@ -11,14 +11,14 @@
end end
it "should not add plus one for myself" do it "should not add plus one for myself" do
@connection.should_receive(:msg).with("#test", "LTe pisze w PHP") @connection.should_receive(:msg).with("#test", "LTe write in PHP")
@plusone.call(@connection, @message) @plusone.call(@connection, @message)
@plusone.stats["LTe"].should == 1 @plusone.stats["LTe"].should == 1
end end
it "should not allow to add plus one for new user" do it "should not allow to add plus one for new user" do
@message.nick = "new_user" @message.nick = "new_user"
@connection.should_receive(:msg).with("#test", "new_user pisze w PHP") @connection.should_receive(:msg).with("#test", "new_user write in PHP")
@plusone.call(@connection, @message) @plusone.call(@connection, @message)
@plusone.stats["LTe"].should == 1 @plusone.stats["LTe"].should == 1
end end
@@ -54,14 +54,14 @@
def invalid_plus_one(message) def invalid_plus_one(message)
@message = OpenStruct.new({ :channel => "#test", :message => message, :nick => "ruby" }) @message = OpenStruct.new({ :channel => "#test", :message => message, :nick => "ruby" })
@connection.should_not_receive(:msg).with("#test", "ruby podarowal +1 dla *LTe*") @connection.should_not_receive(:msg).with("#test", "ruby gave +1 for *LTe*")
@plusone.call(@connection, @message) @plusone.call(@connection, @message)
@plusone.stats["LTe"].should == 1 @plusone.stats["LTe"].should == 1
end end
def proper_plus_one(message) def proper_plus_one(message)
@message = OpenStruct.new({ :channel => "#test", :message => message, :nick => "ruby" }) @message = OpenStruct.new({ :channel => "#test", :message => message, :nick => "ruby" })
@connection.should_receive(:msg).with("#test", "ruby podarowal +1 dla *LTe*") @connection.should_receive(:msg).with("#test", "ruby gave +1 for *LTe*")
@plusone.call(@connection, @message) @plusone.call(@connection, @message)
@plusone.stats["LTe"].should == 2 @plusone.stats["LTe"].should == 2
end end
View
@@ -30,8 +30,8 @@ def period
EM.run do EM.run do
@rubygems.call(@connection, @message) @rubygems.call(@connection, @message)
eventually(true, :times => 10) do eventually(true, :times => 10) do
@connection.messages.include? "Dodalem gema acts-as-messageable do obserwowanych" and @connection.messages.include? "I added gem acts-as-messageable to watchlist" and
@connection.messages.include? "Aktualna wersja: acts-as-messageable (0.4.2)" @connection.messages.include? "Current version: acts-as-messageable (0.4.2)"
end end
end end
end end
@@ -41,7 +41,7 @@ def period
EM.run do EM.run do
@rubygems.call(@connection, @message) @rubygems.call(@connection, @message)
eventually(true) do eventually(true) do
@connection.messages.include? "Niepoprawna nazwa gema" @connection.messages.include? "Gem name is incorrect"
end end
end end
end end
@@ -51,7 +51,7 @@ def period
EM.run do EM.run do
2.times{ @rubygems.call(@connection, @message) } 2.times{ @rubygems.call(@connection, @message) }
eventually(true) do eventually(true) do
@connection.messages.include? "Gem acts-as-messageable jest juz obserwowany" @connection.messages.include? "Gem acts-as-messageable is already observed"
end end
end end
end end
@@ -80,7 +80,7 @@ def period
@rubygems.store.transaction{ @rubygems.store[:gems]["acts-as-messageable"][:version] = "0.4.1" } @rubygems.store.transaction{ @rubygems.store[:gems]["acts-as-messageable"][:version] = "0.4.1" }
eventually(true, :every => 0.1, :total => 100) do eventually(true, :every => 0.1, :total => 100) do
@connection.messages.include? "Nowa wersja acts-as-messageable (0.4.2)" @connection.messages.include? "New version acts-as-messageable (0.4.2)"
end end
end end
end end

0 comments on commit d1b7621

Please sign in to comment.