campfire_bot 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.bundle/config +2 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +52 -0
- data/README.rdoc +1 -1
- data/Rakefile +6 -43
- data/campfire_bot.gemspec +13 -49
- data/examples/basic.rb +1 -1
- data/lib/campfire_bot.rb +12 -2
- data/spec/spec_helper.rb +6 -11
- metadata +48 -22
- data/spec/spec.opts +0 -1
data/.bundle/config
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
campfire_bot (0.0.2)
|
5
|
+
tinder (~> 1.4.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (3.0.3)
|
11
|
+
addressable (2.2.2)
|
12
|
+
diff-lcs (1.1.2)
|
13
|
+
eventmachine (0.12.10)
|
14
|
+
faraday (0.5.3)
|
15
|
+
addressable (~> 2.2.2)
|
16
|
+
multipart-post (~> 1.0.1)
|
17
|
+
rack (>= 1.1.0, < 2)
|
18
|
+
mime-types (1.16)
|
19
|
+
multipart-post (1.0.1)
|
20
|
+
rack (1.2.1)
|
21
|
+
rake (0.8.7)
|
22
|
+
roauth (0.0.3)
|
23
|
+
rspec (2.1.0)
|
24
|
+
rspec-core (~> 2.1.0)
|
25
|
+
rspec-expectations (~> 2.1.0)
|
26
|
+
rspec-mocks (~> 2.1.0)
|
27
|
+
rspec-core (2.1.0)
|
28
|
+
rspec-expectations (2.1.0)
|
29
|
+
diff-lcs (~> 1.1.2)
|
30
|
+
rspec-mocks (2.1.0)
|
31
|
+
tinder (1.4.2)
|
32
|
+
activesupport
|
33
|
+
eventmachine
|
34
|
+
faraday (~> 0.5.1)
|
35
|
+
mime-types
|
36
|
+
multipart-post
|
37
|
+
twitter-stream
|
38
|
+
twitter-stream (0.1.10)
|
39
|
+
eventmachine (>= 0.12.8)
|
40
|
+
roauth (>= 0.0.2)
|
41
|
+
|
42
|
+
PLATFORMS
|
43
|
+
ruby
|
44
|
+
|
45
|
+
DEPENDENCIES
|
46
|
+
campfire_bot!
|
47
|
+
rake (~> 0.8.7)
|
48
|
+
rspec (~> 2.1.0)
|
49
|
+
tinder (~> 1.4.0)
|
50
|
+
|
51
|
+
METADATA
|
52
|
+
version: 1.0.6
|
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -1,46 +1,9 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
1
|
+
require 'bundler'
|
2
|
+
require 'rspec/core/rake_task'
|
3
3
|
|
4
|
-
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "campfire_bot"
|
8
|
-
gem.summary = %Q{Create bots in your Campfires}
|
9
|
-
gem.description = %Q{Create bots in your Campfires}
|
10
|
-
gem.email = "reddavis@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/reddavis/campfire_bot"
|
12
|
-
gem.authors = ["reddavis"]
|
13
|
-
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
-
gem.add_dependency "tinder", ">= 1.4.0"
|
15
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
-
end
|
17
|
-
Jeweler::GemcutterTasks.new
|
18
|
-
rescue LoadError
|
19
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
-
end
|
4
|
+
Bundler::GemHelper.install_tasks
|
21
5
|
|
22
|
-
|
23
|
-
|
24
|
-
spec.libs << 'lib' << 'spec'
|
25
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
26
|
-
end
|
6
|
+
desc "Run specs"
|
7
|
+
RSpec::Core::RakeTask.new
|
27
8
|
|
28
|
-
|
29
|
-
spec.libs << 'lib' << 'spec'
|
30
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
31
|
-
spec.rcov = true
|
32
|
-
end
|
33
|
-
|
34
|
-
task :spec => :check_dependencies
|
35
|
-
|
36
|
-
task :default => :spec
|
37
|
-
|
38
|
-
require 'rake/rdoctask'
|
39
|
-
Rake::RDocTask.new do |rdoc|
|
40
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
|
-
|
42
|
-
rdoc.rdoc_dir = 'rdoc'
|
43
|
-
rdoc.title = "campfire_bot #{version}"
|
44
|
-
rdoc.rdoc_files.include('README*')
|
45
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
46
|
-
end
|
9
|
+
task :default => :spec
|
data/campfire_bot.gemspec
CHANGED
@@ -1,60 +1,24 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "campfire_bot"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
6
|
s.name = %q{campfire_bot}
|
8
|
-
s.version =
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
7
|
+
s.version = Campfire::Bot::VERSION
|
11
8
|
s.authors = ["reddavis"]
|
12
|
-
s.
|
9
|
+
s.summary = %q{Create bots in your Campfires}
|
13
10
|
s.description = %q{Create bots in your Campfires}
|
14
11
|
s.email = %q{reddavis@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"campfire_bot.gemspec",
|
27
|
-
"examples/basic.rb",
|
28
|
-
"lib/campfire_bot.rb",
|
29
|
-
"spec/campfire_bot_spec.rb",
|
30
|
-
"spec/spec.opts",
|
31
|
-
"spec/spec_helper.rb"
|
32
|
-
]
|
33
12
|
s.homepage = %q{http://github.com/reddavis/campfire_bot}
|
34
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
35
|
-
s.require_paths = ["lib"]
|
36
|
-
s.rubygems_version = %q{1.3.6}
|
37
|
-
s.summary = %q{Create bots in your Campfires}
|
38
|
-
s.test_files = [
|
39
|
-
"spec/campfire_bot_spec.rb",
|
40
|
-
"spec/spec_helper.rb",
|
41
|
-
"examples/basic.rb"
|
42
|
-
]
|
43
13
|
|
44
|
-
|
45
|
-
|
46
|
-
s.specification_version = 3
|
14
|
+
s.add_dependency "tinder", "~> 1.4.0"
|
15
|
+
# s.add_dependency "i18n",
|
47
16
|
|
48
|
-
|
49
|
-
|
50
|
-
s.add_runtime_dependency(%q<tinder>, [">= 1.4.0"])
|
51
|
-
else
|
52
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
53
|
-
s.add_dependency(%q<tinder>, [">= 1.4.0"])
|
54
|
-
end
|
55
|
-
else
|
56
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
57
|
-
s.add_dependency(%q<tinder>, [">= 1.4.0"])
|
58
|
-
end
|
59
|
-
end
|
17
|
+
s.add_development_dependency "rspec", "~> 2.1.0"
|
18
|
+
s.add_development_dependency "rake", "~> 0.8.7"
|
60
19
|
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
s.require_paths = ["lib"]
|
24
|
+
end
|
data/examples/basic.rb
CHANGED
data/lib/campfire_bot.rb
CHANGED
@@ -3,6 +3,8 @@ require "tinder"
|
|
3
3
|
|
4
4
|
module Campfire
|
5
5
|
class Bot
|
6
|
+
VERSION = "0.0.2"
|
7
|
+
|
6
8
|
class << self
|
7
9
|
def config
|
8
10
|
@bot = new
|
@@ -18,7 +20,7 @@ module Campfire
|
|
18
20
|
def login(&block)
|
19
21
|
config = Config.new
|
20
22
|
block.call(config)
|
21
|
-
@campfire = Tinder::Campfire.new(config.subdomain,
|
23
|
+
@campfire = Tinder::Campfire.new(config.subdomain, login_credentials(config)).find_room_by_name(config.room)
|
22
24
|
end
|
23
25
|
|
24
26
|
def start
|
@@ -44,11 +46,19 @@ module Campfire
|
|
44
46
|
|
45
47
|
private
|
46
48
|
|
49
|
+
def login_credentials(config)
|
50
|
+
if config.token
|
51
|
+
{ :token => config.token }
|
52
|
+
else
|
53
|
+
{ :username => config.username, :password => config.password }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
47
57
|
def find_event(command)
|
48
58
|
@events.find {|event| command.match(event.regex)}
|
49
59
|
end
|
50
60
|
end
|
51
61
|
|
52
62
|
class Event < Struct.new(:regex, :action); end
|
53
|
-
class Config < Struct.new(:username, :password, :subdomain, :room); end
|
63
|
+
class Config < Struct.new(:username, :password, :subdomain, :room, :token); end
|
54
64
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,8 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
$:.unshift(File.dirname(__FILE__))
|
2
|
+
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
3
|
|
4
|
-
|
4
|
+
require "campfire_bot"
|
5
|
+
require "rspec"
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
require 'spec'
|
9
|
-
require 'spec/autorun'
|
10
|
-
|
11
|
-
Spec::Runner.configure do |config|
|
12
|
-
|
13
|
-
end
|
7
|
+
RSpec.configure do |config|
|
8
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: campfire_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- reddavis
|
@@ -14,49 +15,72 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-11-17 00:00:00 +00:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
22
|
+
name: tinder
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
|
-
- -
|
27
|
+
- - ~>
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
27
30
|
segments:
|
28
31
|
- 1
|
29
|
-
-
|
30
|
-
-
|
31
|
-
version: 1.
|
32
|
-
type: :
|
32
|
+
- 4
|
33
|
+
- 0
|
34
|
+
version: 1.4.0
|
35
|
+
type: :runtime
|
33
36
|
version_requirements: *id001
|
34
37
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
38
|
+
name: rspec
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
|
-
- -
|
43
|
+
- - ~>
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 11
|
41
46
|
segments:
|
47
|
+
- 2
|
42
48
|
- 1
|
43
|
-
- 4
|
44
49
|
- 0
|
45
|
-
version: 1.
|
46
|
-
type: :
|
50
|
+
version: 2.1.0
|
51
|
+
type: :development
|
47
52
|
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rake
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 49
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
- 8
|
65
|
+
- 7
|
66
|
+
version: 0.8.7
|
67
|
+
type: :development
|
68
|
+
version_requirements: *id003
|
48
69
|
description: Create bots in your Campfires
|
49
70
|
email: reddavis@gmail.com
|
50
71
|
executables: []
|
51
72
|
|
52
73
|
extensions: []
|
53
74
|
|
54
|
-
extra_rdoc_files:
|
55
|
-
|
56
|
-
- README.rdoc
|
75
|
+
extra_rdoc_files: []
|
76
|
+
|
57
77
|
files:
|
78
|
+
- .bundle/config
|
58
79
|
- .document
|
59
80
|
- .gitignore
|
81
|
+
- .rspec
|
82
|
+
- Gemfile
|
83
|
+
- Gemfile.lock
|
60
84
|
- LICENSE
|
61
85
|
- README.rdoc
|
62
86
|
- Rakefile
|
@@ -65,39 +89,41 @@ files:
|
|
65
89
|
- examples/basic.rb
|
66
90
|
- lib/campfire_bot.rb
|
67
91
|
- spec/campfire_bot_spec.rb
|
68
|
-
- spec/spec.opts
|
69
92
|
- spec/spec_helper.rb
|
70
93
|
has_rdoc: true
|
71
94
|
homepage: http://github.com/reddavis/campfire_bot
|
72
95
|
licenses: []
|
73
96
|
|
74
97
|
post_install_message:
|
75
|
-
rdoc_options:
|
76
|
-
|
98
|
+
rdoc_options: []
|
99
|
+
|
77
100
|
require_paths:
|
78
101
|
- lib
|
79
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
80
104
|
requirements:
|
81
105
|
- - ">="
|
82
106
|
- !ruby/object:Gem::Version
|
107
|
+
hash: 3
|
83
108
|
segments:
|
84
109
|
- 0
|
85
110
|
version: "0"
|
86
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
87
113
|
requirements:
|
88
114
|
- - ">="
|
89
115
|
- !ruby/object:Gem::Version
|
116
|
+
hash: 3
|
90
117
|
segments:
|
91
118
|
- 0
|
92
119
|
version: "0"
|
93
120
|
requirements: []
|
94
121
|
|
95
122
|
rubyforge_project:
|
96
|
-
rubygems_version: 1.3.
|
123
|
+
rubygems_version: 1.3.7
|
97
124
|
signing_key:
|
98
125
|
specification_version: 3
|
99
126
|
summary: Create bots in your Campfires
|
100
127
|
test_files:
|
101
128
|
- spec/campfire_bot_spec.rb
|
102
129
|
- spec/spec_helper.rb
|
103
|
-
- examples/basic.rb
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|