muzang-plugins 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,6 +39,7 @@ class RubyGems
39
39
  @new_gem = false
40
40
  rescue Exception
41
41
  connection.msg(message.channel, "Niepoprawna nazwa gema")
42
+ @store.transaction{@store[:gems].delete(@current_gem)}
42
43
  end
43
44
  }
44
45
  else
@@ -53,12 +54,15 @@ class RubyGems
53
54
  http = EventMachine::HttpRequest.new("http://rubygems.org/api/v1/gems/#{gem[:name]}.json").get
54
55
  http.callback {
55
56
  iter.next
56
- current_gem = JSON.parse(http.response)
57
- if Gem::Version.new(gem[:version]) < Gem::Version.new(current_gem["version"])
58
- @store.transaction do
59
- @store[:gems][gem[:name]][:version] = current_gem["version"]
57
+ begin
58
+ current_gem = JSON.parse(http.response)
59
+ if Gem::Version.new(gem[:version]) < Gem::Version.new(current_gem["version"])
60
+ @store.transaction do
61
+ @store[:gems][gem[:name]][:version] = current_gem["version"]
62
+ end
63
+ connection.msg(message.channel, "Nowa wersja #{gem[:name]} (#{current_gem["version"]})")
60
64
  end
61
- connection.msg(message.channel, "Nowa wersja #{gem[:name]} (#{current_gem["version"]})")
65
+ rescue
62
66
  end
63
67
  }
64
68
  end
@@ -1,5 +1,5 @@
1
1
  module Muzang
2
2
  module Plugins
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
@@ -56,6 +56,18 @@ describe "RubyGems" do
56
56
  end
57
57
  end
58
58
 
59
+ it "should remove gem from storage" do
60
+ @message.message = "watch! acts-as-messageable2"
61
+ EM.run do
62
+ @rubygems.call(@connection, @message)
63
+ eventually(true) do
64
+ @rubygems.store.transaction do
65
+ @rubygems.store[:gems]["acts-as-messageable2"] == nil
66
+ end
67
+ end
68
+ end
69
+ end
70
+
59
71
  it "should notice about new version of gem" do
60
72
  @message.message = ""
61
73
  @message.command = :join
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muzang-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: em-http-request
16
- requirement: &70167909877820 !ruby/object:Gem::Requirement
16
+ requirement: &70039033906260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70167909877820
24
+ version_requirements: *70039033906260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: muzang
27
- requirement: &70167909875680 !ruby/object:Gem::Requirement
27
+ requirement: &70039033905340 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70167909875680
35
+ version_requirements: *70039033905340
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: em-ventually
38
- requirement: &70167909874320 !ruby/object:Gem::Requirement
38
+ requirement: &70039033904440 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.1.2
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70167909874320
46
+ version_requirements: *70039033904440
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70167909873600 !ruby/object:Gem::Requirement
49
+ requirement: &70039033903200 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 2.6.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70167909873600
57
+ version_requirements: *70039033903200
58
58
  description: Plugins for Muzang IRC bot
59
59
  email:
60
60
  - piotr.nielacny@gmail.com
@@ -217,7 +217,6 @@ files:
217
217
  - lib/muzang-plugins/muzang-plusone.rb
218
218
  - lib/muzang-plugins/muzang-reddit.rb
219
219
  - lib/muzang-plugins/muzang-rubygems.rb
220
- - lib/muzang-plugins/muzang-say.rb
221
220
  - lib/muzang-plugins/version.rb
222
221
  - muzang-plugins.gemspec
223
222
  - spec/livereload_spec.rb
@@ -1,12 +0,0 @@
1
- class Say
2
- include Muzang::Plugins::Helpers
3
-
4
- def initialize(bot)
5
- @bot = bot
6
- end
7
-
8
- def call(connection, message)
9
- message.match(/^say (.*?)$/) do |match|
10
- end
11
- end
12
- end