campfire_bot 0.0.3 → 0.0.4
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/Gemfile.lock +19 -8
- data/README.md +45 -0
- data/campfire_bot.gemspec +6 -3
- data/examples/basic.rb +2 -2
- data/lib/campfire_bot.rb +8 -9
- data/lib/campfire_bot/version.rb +5 -0
- data/spec/campfire_bot_spec.rb +1 -1
- metadata +43 -13
- data/README.rdoc +0 -45
- data/VERSION +0 -1
data/Gemfile.lock
CHANGED
@@ -1,19 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
campfire_bot (0.0.
|
5
|
-
|
4
|
+
campfire_bot (0.0.3)
|
5
|
+
i18n (~> 0.4.2)
|
6
|
+
json
|
7
|
+
tinder (~> 1.4.2)
|
6
8
|
|
7
9
|
GEM
|
8
10
|
remote: http://rubygems.org/
|
9
11
|
specs:
|
10
12
|
activesupport (3.0.3)
|
11
|
-
|
13
|
+
addressable (2.2.2)
|
12
14
|
diff-lcs (1.1.2)
|
13
15
|
eventmachine (0.12.10)
|
14
|
-
|
15
|
-
|
16
|
+
faraday (0.5.3)
|
17
|
+
addressable (~> 2.2.2)
|
18
|
+
multipart-post (~> 1.0.1)
|
19
|
+
rack (>= 1.1.0, < 2)
|
20
|
+
i18n (0.4.2)
|
21
|
+
json (1.4.6)
|
16
22
|
mime-types (1.16)
|
23
|
+
multipart-post (1.0.1)
|
24
|
+
rack (1.2.1)
|
17
25
|
rake (0.8.7)
|
18
26
|
roauth (0.0.3)
|
19
27
|
rspec (2.1.0)
|
@@ -24,11 +32,12 @@ GEM
|
|
24
32
|
rspec-expectations (2.1.0)
|
25
33
|
diff-lcs (~> 1.1.2)
|
26
34
|
rspec-mocks (2.1.0)
|
27
|
-
tinder (1.4.
|
35
|
+
tinder (1.4.2)
|
28
36
|
activesupport
|
29
37
|
eventmachine
|
30
|
-
|
38
|
+
faraday (~> 0.5.1)
|
31
39
|
mime-types
|
40
|
+
multipart-post
|
32
41
|
twitter-stream
|
33
42
|
twitter-stream (0.1.10)
|
34
43
|
eventmachine (>= 0.12.8)
|
@@ -39,9 +48,11 @@ PLATFORMS
|
|
39
48
|
|
40
49
|
DEPENDENCIES
|
41
50
|
campfire_bot!
|
51
|
+
i18n (~> 0.4.2)
|
52
|
+
json
|
42
53
|
rake (~> 0.8.7)
|
43
54
|
rspec (~> 2.1.0)
|
44
|
-
tinder (
|
55
|
+
tinder (~> 1.4.2)
|
45
56
|
|
46
57
|
METADATA
|
47
58
|
version: 1.0.6
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Campfire Bot
|
2
|
+
|
3
|
+
This is a Campfire bot heavily inspired by http://github.com/ichverstehe/isaac
|
4
|
+
|
5
|
+
## How To Install
|
6
|
+
|
7
|
+
sudo gem install campfire_bot
|
8
|
+
|
9
|
+
## How To Use
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
require "campfire_bot"
|
13
|
+
|
14
|
+
Campfire::Bot.config do |bot|
|
15
|
+
# Login
|
16
|
+
bot.login do |l|
|
17
|
+
l.username = "username"
|
18
|
+
l.password = "password"
|
19
|
+
l.subdomain = "subdomain"
|
20
|
+
l.room = "room"
|
21
|
+
|
22
|
+
## or
|
23
|
+
# l.token = "XXX"
|
24
|
+
##
|
25
|
+
end
|
26
|
+
|
27
|
+
# Events
|
28
|
+
bot.on(/^How are you?/) do |x|
|
29
|
+
x.msg("Im very well thank-you")
|
30
|
+
end
|
31
|
+
end.start
|
32
|
+
|
33
|
+
## Note on Patches/Pull Requests
|
34
|
+
|
35
|
+
* Fork the project.
|
36
|
+
* Make your feature addition or bug fix.
|
37
|
+
* Add tests for it. This is important so I don't break it in a
|
38
|
+
future version unintentionally.
|
39
|
+
* Commit, do not mess with rakefile, version, or history.
|
40
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
41
|
+
* Send me a pull request. Bonus points for topic branches.
|
42
|
+
|
43
|
+
## Copyright
|
44
|
+
|
45
|
+
Copyright (c) 2010 Red Davis. See LICENSE for details.
|
data/campfire_bot.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "campfire_bot"
|
3
|
+
require "campfire_bot/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = %q{campfire_bot}
|
@@ -11,8 +11,11 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.email = %q{reddavis@gmail.com}
|
12
12
|
s.homepage = %q{http://github.com/reddavis/campfire_bot}
|
13
13
|
|
14
|
-
s.add_dependency "tinder", "1.4.
|
15
|
-
|
14
|
+
s.add_dependency "tinder", "~> 1.4.2"
|
15
|
+
|
16
|
+
# Tinder needs these...
|
17
|
+
s.add_dependency "json"
|
18
|
+
s.add_dependency "i18n", "~> 0.4.2"
|
16
19
|
|
17
20
|
s.add_development_dependency "rspec", "~> 2.1.0"
|
18
21
|
s.add_development_dependency "rake", "~> 0.8.7"
|
data/examples/basic.rb
CHANGED
data/lib/campfire_bot.rb
CHANGED
@@ -3,18 +3,16 @@ require "tinder"
|
|
3
3
|
|
4
4
|
module Campfire
|
5
5
|
class Bot
|
6
|
-
VERSION = "0.0.3"
|
7
|
-
|
8
6
|
class << self
|
9
|
-
def config
|
10
|
-
|
11
|
-
yield(@bot)
|
12
|
-
@bot
|
7
|
+
def config(&block)
|
8
|
+
new(&block)
|
13
9
|
end
|
14
10
|
end
|
15
11
|
|
16
|
-
def initialize
|
12
|
+
def initialize(&block)
|
17
13
|
@events = []
|
14
|
+
|
15
|
+
block.call(self) if block_given?
|
18
16
|
end
|
19
17
|
|
20
18
|
def login(&block)
|
@@ -25,6 +23,7 @@ module Campfire
|
|
25
23
|
|
26
24
|
def start
|
27
25
|
raise "You need to configure me" unless @campfire
|
26
|
+
|
28
27
|
@campfire.listen do |line|
|
29
28
|
evaluate(line[:body]) if line[:body]
|
30
29
|
end
|
@@ -40,7 +39,7 @@ module Campfire
|
|
40
39
|
|
41
40
|
def evaluate(message)
|
42
41
|
if event = find_event(message)
|
43
|
-
event.action.call
|
42
|
+
event.action.call(self)
|
44
43
|
end
|
45
44
|
end
|
46
45
|
|
@@ -55,7 +54,7 @@ module Campfire
|
|
55
54
|
end
|
56
55
|
|
57
56
|
def find_event(command)
|
58
|
-
@events.find {|event| command.match(event.regex)}
|
57
|
+
@events.find {|event| command.match(event.regex) }
|
59
58
|
end
|
60
59
|
end
|
61
60
|
|
data/spec/campfire_bot_spec.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: campfire_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- reddavis
|
@@ -24,20 +24,50 @@ dependencies:
|
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 3
|
30
30
|
segments:
|
31
31
|
- 1
|
32
32
|
- 4
|
33
|
-
-
|
34
|
-
version: 1.4.
|
33
|
+
- 2
|
34
|
+
version: 1.4.2
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
38
|
+
name: json
|
39
39
|
prerelease: false
|
40
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: i18n
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 11
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
- 4
|
63
|
+
- 2
|
64
|
+
version: 0.4.2
|
65
|
+
type: :runtime
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: rspec
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
41
71
|
none: false
|
42
72
|
requirements:
|
43
73
|
- - ~>
|
@@ -49,11 +79,11 @@ dependencies:
|
|
49
79
|
- 0
|
50
80
|
version: 2.1.0
|
51
81
|
type: :development
|
52
|
-
version_requirements: *
|
82
|
+
version_requirements: *id004
|
53
83
|
- !ruby/object:Gem::Dependency
|
54
84
|
name: rake
|
55
85
|
prerelease: false
|
56
|
-
requirement: &
|
86
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
57
87
|
none: false
|
58
88
|
requirements:
|
59
89
|
- - ~>
|
@@ -65,7 +95,7 @@ dependencies:
|
|
65
95
|
- 7
|
66
96
|
version: 0.8.7
|
67
97
|
type: :development
|
68
|
-
version_requirements: *
|
98
|
+
version_requirements: *id005
|
69
99
|
description: Create bots in your Campfires
|
70
100
|
email: reddavis@gmail.com
|
71
101
|
executables: []
|
@@ -82,12 +112,12 @@ files:
|
|
82
112
|
- Gemfile
|
83
113
|
- Gemfile.lock
|
84
114
|
- LICENSE
|
85
|
-
- README.
|
115
|
+
- README.md
|
86
116
|
- Rakefile
|
87
|
-
- VERSION
|
88
117
|
- campfire_bot.gemspec
|
89
118
|
- examples/basic.rb
|
90
119
|
- lib/campfire_bot.rb
|
120
|
+
- lib/campfire_bot/version.rb
|
91
121
|
- spec/campfire_bot_spec.rb
|
92
122
|
- spec/spec_helper.rb
|
93
123
|
has_rdoc: true
|
data/README.rdoc
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
= Campfire Bot
|
2
|
-
|
3
|
-
This is a Campfire bot heavily inspired by http://github.com/ichverstehe/isaac
|
4
|
-
|
5
|
-
== How To Install
|
6
|
-
|
7
|
-
sudo gem install campfire_bot
|
8
|
-
|
9
|
-
== How To User
|
10
|
-
|
11
|
-
require "rubygems"
|
12
|
-
require "campfire_bot"
|
13
|
-
|
14
|
-
Campfire::Bot.config do |bot|
|
15
|
-
# Login
|
16
|
-
bot.login do |l|
|
17
|
-
l.username = "username"
|
18
|
-
l.password = "password"
|
19
|
-
l.subdomain = "subdomain"
|
20
|
-
l.room = "room"
|
21
|
-
end
|
22
|
-
|
23
|
-
# Events
|
24
|
-
bot.on(/^How are you?/) do
|
25
|
-
bot.msg("Im very well thank-you")
|
26
|
-
end
|
27
|
-
end.start
|
28
|
-
|
29
|
-
== Note on Patches/Pull Requests
|
30
|
-
|
31
|
-
* Fork the project.
|
32
|
-
* Make your feature addition or bug fix.
|
33
|
-
* Add tests for it. This is important so I don't break it in a
|
34
|
-
future version unintentionally.
|
35
|
-
* Commit, do not mess with rakefile, version, or history.
|
36
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
37
|
-
* Send me a pull request. Bonus points for topic branches.
|
38
|
-
|
39
|
-
== Todo
|
40
|
-
|
41
|
-
* Use Campfire keys
|
42
|
-
|
43
|
-
== Copyright
|
44
|
-
|
45
|
-
Copyright (c) 2010 Red Davis. See LICENSE for details.
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.1
|