poundie 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -53,4 +53,9 @@ What can you do in the `action`?
53
53
  tweet "https://twitter.com/steve_martocci/status/69140542038097921"
54
54
  paste "Some long text"
55
55
 
56
- That's about it for now.
56
+ That's about it for now.
57
+
58
+ ## Available Plugins
59
+
60
+ * [poundie-last-tweet](https://github.com/nakajima/poundie-last-tweet) - Posts the last tweet from a given Twitter user to campfire
61
+ * [poundie-weather](https://github.com/nakajima/poundie-weather) - Posts weather information for a given city to campfire
@@ -21,13 +21,28 @@ module Poundie
21
21
  define_method(:perform, &block)
22
22
  end
23
23
 
24
+ def self.prefix(regex, &block)
25
+ match do |message|
26
+ message.body =~ regex
27
+ end
28
+
29
+ action do |message|
30
+ instance_exec(message.body.gsub(regex, ''), &block)
31
+ end
32
+ end
33
+
24
34
  def initialize(room)
25
35
  @room = room
26
36
  end
27
37
 
28
38
  def call(message)
29
39
  message = Poundie::Campfire::Message.new(message)
30
- match?(message) && perform(message)
40
+ begin
41
+ match?(message) && perform(message)
42
+ rescue => e
43
+ puts "ERROR: #{e.message}"
44
+ raise e
45
+ end
31
46
  end
32
47
 
33
48
  private
@@ -0,0 +1,15 @@
1
+ module Poundie
2
+ module Plugins
3
+ class Debug < Poundie::Plugin
4
+ register :debug
5
+
6
+ match do |message|
7
+ true
8
+ end
9
+
10
+ action do |message|
11
+ puts message.inspect
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/poundie.rb CHANGED
@@ -11,6 +11,7 @@ require "poundie/plugin"
11
11
  require "poundie/campfire/user"
12
12
  require "poundie/campfire/message"
13
13
  require "poundie/plugins/greeter"
14
+ require "poundie/plugins/debug"
14
15
 
15
16
  trap('INT') { puts "ok bye!" ; exit! }
16
17
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poundie
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pat Nakajima
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-13 00:00:00 Z
18
+ date: 2011-05-13 00:00:00 -04:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: tinder
@@ -62,7 +63,9 @@ files:
62
63
  - lib/poundie/campfire/user.rb
63
64
  - lib/poundie/plugin.rb
64
65
  - lib/poundie/plugins/greeter.rb
66
+ - lib/poundie/plugins/debug.rb
65
67
  - lib/poundie/runner.rb
68
+ has_rdoc: true
66
69
  homepage:
67
70
  licenses: []
68
71
 
@@ -92,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
95
  requirements: []
93
96
 
94
97
  rubyforge_project:
95
- rubygems_version: 1.8.0
98
+ rubygems_version: 1.6.2
96
99
  signing_key:
97
100
  specification_version: 3
98
101
  summary: A campfire bot