cerberus 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/Changelog.txt +21 -1
  2. data/Rakefile +2 -2
  3. data/lib/cerberus/cli.rb +1 -1
  4. data/lib/cerberus/constants.rb +1 -1
  5. data/lib/cerberus/manager.rb +5 -5
  6. data/lib/cerberus/publisher/base.rb +1 -1
  7. data/lib/cerberus/publisher/irc.rb +8 -13
  8. data/lib/cerberus/publisher/mail.rb +1 -0
  9. data/lib/cerberus/scm/git.rb +1 -1
  10. data/lib/vendor/addressable/CHANGELOG +88 -0
  11. data/lib/vendor/addressable/LICENSE +20 -0
  12. data/lib/vendor/addressable/README +50 -0
  13. data/lib/vendor/addressable/Rakefile +74 -0
  14. data/lib/vendor/addressable/addressable.gemspec +30 -0
  15. data/lib/vendor/addressable/lib/addressable/idna.rb +4871 -0
  16. data/lib/vendor/addressable/lib/addressable/template.rb +1049 -0
  17. data/lib/vendor/addressable/lib/addressable/uri.rb +2078 -0
  18. data/lib/vendor/addressable/lib/addressable/version.rb +36 -0
  19. data/lib/vendor/addressable/spec/addressable/idna_spec.rb +194 -0
  20. data/lib/vendor/addressable/spec/addressable/template_spec.rb +2152 -0
  21. data/lib/vendor/addressable/spec/addressable/uri_spec.rb +3914 -0
  22. data/lib/vendor/addressable/spec/data/rfc3986.txt +3419 -0
  23. data/lib/vendor/addressable/tasks/clobber.rake +2 -0
  24. data/lib/vendor/addressable/tasks/gem.rake +68 -0
  25. data/lib/vendor/addressable/tasks/git.rake +40 -0
  26. data/lib/vendor/addressable/tasks/metrics.rake +22 -0
  27. data/lib/vendor/addressable/tasks/rdoc.rake +29 -0
  28. data/lib/vendor/addressable/tasks/rubyforge.rake +89 -0
  29. data/lib/vendor/addressable/tasks/spec.rake +47 -0
  30. data/lib/vendor/addressable/website/index.html +110 -0
  31. data/lib/vendor/shout-bot/TODO +2 -0
  32. data/lib/vendor/shout-bot/lib/shout-bot.rb +76 -0
  33. data/lib/vendor/shout-bot/shout-bot.gemspec +13 -0
  34. data/lib/vendor/tinder/CHANGELOG.txt +39 -0
  35. data/lib/vendor/tinder/Manifest.txt +10 -0
  36. data/lib/vendor/tinder/README.txt +48 -0
  37. data/lib/vendor/tinder/Rakefile +45 -0
  38. data/lib/vendor/tinder/VERSION +1 -0
  39. data/lib/vendor/tinder/init.rb +1 -0
  40. data/lib/vendor/tinder/lib/tinder.rb +12 -0
  41. data/lib/vendor/tinder/lib/tinder/campfire.rb +75 -0
  42. data/lib/vendor/tinder/lib/tinder/connection.rb +74 -0
  43. data/lib/vendor/tinder/lib/tinder/multipart.rb +63 -0
  44. data/lib/vendor/tinder/lib/tinder/room.rb +225 -0
  45. data/lib/vendor/tinder/site/index.html +101 -0
  46. data/lib/vendor/tinder/site/stylesheets/style.css +77 -0
  47. data/lib/vendor/tinder/spec/fixtures/rooms.json +18 -0
  48. data/lib/vendor/tinder/spec/fixtures/rooms/room80749.json +21 -0
  49. data/lib/vendor/tinder/spec/fixtures/rooms/room80751.json +21 -0
  50. data/lib/vendor/tinder/spec/fixtures/rooms/show.json +21 -0
  51. data/lib/vendor/tinder/spec/fixtures/users/me.json +11 -0
  52. data/lib/vendor/tinder/spec/spec.opts +2 -0
  53. data/lib/vendor/tinder/spec/spec_helper.rb +12 -0
  54. data/lib/vendor/tinder/spec/tinder/campfire_spec.rb +53 -0
  55. data/lib/vendor/tinder/spec/tinder/connection_spec.rb +29 -0
  56. data/lib/vendor/tinder/spec/tinder/room_spec.rb +98 -0
  57. data/lib/vendor/tinder/tinder.gemspec +79 -0
  58. data/test/functional_test.rb +19 -4
  59. data/test/integration_test.rb +1 -1
  60. data/test/irc_publisher_test.rb +4 -4
  61. data/test/mock/manager.rb +1 -1
  62. metadata +58 -20
  63. data/lib/vendor/irc/README +0 -23
  64. data/lib/vendor/irc/lib/IRC.rb +0 -164
  65. data/lib/vendor/irc/lib/IRCChannel.rb +0 -33
  66. data/lib/vendor/irc/lib/IRCConnection.rb +0 -134
  67. data/lib/vendor/irc/lib/IRCEvent.rb +0 -91
  68. data/lib/vendor/irc/lib/IRCUser.rb +0 -23
  69. data/lib/vendor/irc/lib/IRCUtil.rb +0 -49
  70. data/lib/vendor/irc/lib/eventmap.yml +0 -247
@@ -0,0 +1,101 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
+ <title>Tinder</title>
8
+ <link rel="stylesheet" type="text/css" href="http://opensoul.org/stylesheets/code.css" />
9
+ <link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
10
+ <link href="http://opensoul.org/stylesheets/ci.css" rel="stylesheet" type="text/css" />
11
+ <script src="http://opensoul.org/javascripts/code_highlighter.js" type="text/javascript"></script>
12
+ <script src="http://opensoul.org/javascripts/ruby.js" type="text/javascript"></script>
13
+ </head>
14
+
15
+ <body>
16
+ <div id="collectiveidea">
17
+ <a href="http://collectiveidea.com"><img src="http://opensoul.org/images/header_logo.gif" alt="Collective Idea" class="logo" width="17" height="22" /></a>
18
+ <ul class="links">
19
+ <li><a href="http://daniel.collectiveidea.com/blog">Daniel</a></li>
20
+ <li><a href="http://opensoul.org">Brandon</a></li>
21
+ <li class="name"><a href="http://collectiveidea.com"><img src="http://opensoul.org/images/header_collectiveidea.gif" alt="Collective Idea" width="123" height="21" /></a></li>
22
+ </ul>
23
+ </div>
24
+ <div id="main">
25
+ <div id="header">
26
+ <h1><a href="/">Tinder</a></h1>
27
+ <p>Getting the campfire started</p>
28
+ <ul id="nav">
29
+ <li><a href="tinder">API Docs</a></li>
30
+ <li><a href="http://rubyforge.org/projects/tinder">RubyForge</a></li>
31
+ <li><a href="http://opensoul.org/tags/tinder">Blog</a></li>
32
+ </ul>
33
+ </div>
34
+ <div id="content">
35
+ <p>Tinder is an API for interfacing with <a href="http://campfirenow.com">Campfire</a>, the 37Signals chat application.</p>
36
+ <h2>Example</h2>
37
+
38
+ <pre><code class="ruby">campfire = Tinder::Campfire.new 'mysubdomain'
39
+ campfire.login 'myemail@example.com', 'mypassword'</code></pre>
40
+
41
+ <h3>Create, find and destroy rooms</h3>
42
+ <pre><code class="ruby">room = campfire.create_room 'New Room', 'My new campfire room to test tinder'
43
+ room = campfire.find_room_by_name 'Other Room'
44
+ room.destroy</code></pre>
45
+
46
+ <h3>Speak and Paste</h3>
47
+ <pre><code class="ruby">room.speak 'Hello world!'
48
+ room.paste File.read(&quot;path/to/your/file.txt&quot;)</code></pre>
49
+
50
+ <h3>Listening</h3>
51
+ <pre><code class="ruby">room.listen
52
+ #=&gt; [{:person=&gt;&quot;Brandon&quot;, :message=&gt;&quot;I'm getting very sleepy&quot;, :user_id=&gt;&quot;148583&quot;, :id=&gt;&quot;16434003&quot;}]
53
+
54
+ # or in block form
55
+ room.listen do |m|
56
+ room.speak 'Welcome!' if m[:message] == /hello/
57
+ end</code></pre>
58
+
59
+ <h3>Guest Access</h3>
60
+ <pre><code class="ruby">room.toggle_guest_access
61
+ room.guest_url #=> http://mysubdomain.campfirenow.com/11111
62
+ room.guest_invite_code #=> 11111</code></pre>
63
+
64
+ <h3>Change the name and topic</h3>
65
+ <pre><code class="ruby">room.name = 'Tinder Demo'
66
+ room.topic = 'Showing how to change the room name and topic with tinder…'</code></pre>
67
+
68
+ <h3>Users</h3>
69
+ <pre><code class="ruby">room.users
70
+ campfire.users # users in all rooms</code></pre>
71
+
72
+ <h3>Transcripts</h3>
73
+ <pre><code class="ruby">transcript = room.transcript(room.available_transcripts.first)
74
+ #=&gt; [{:message=&gt;&quot;foobar!&quot;, :user_id=&gt;&quot;99999&quot;, :person=&gt;&quot;Brandon&quot;, :id=&gt;&quot;18659245&quot;, :timestamp=&gt;Tue May 05 07:15:00 -0700 2009}]
75
+ </code></pre>
76
+
77
+ <p>See the <a href="tinder">API documentation</a> for more details.</p>
78
+
79
+ <h2>Installation</h2>
80
+
81
+ <p>Tinder can be installed as a gem or a Rails plugin. Install the gem by executing:</p>
82
+
83
+ <pre>gem install tinder</pre>
84
+
85
+ <p>Or, download it from <a href="http://rubyforge.org/frs/?group_id=2922">RubyForge</a>.</p>
86
+
87
+ <h2>Source</h2>
88
+
89
+ <p>Contributions are welcome and appreciated! The source is available from:</p>
90
+
91
+ <pre>http://github.com/collectiveidea/tinder</pre>
92
+ </div>
93
+ </div>
94
+ <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
95
+ </script>
96
+ <script type="text/javascript">
97
+ _uacct = "UA-194397-8";
98
+ urchinTracker();
99
+ </script>
100
+ </body>
101
+ </html>
@@ -0,0 +1,77 @@
1
+ body {
2
+ font-family: "Lucida Grande", Helvetica, Arial, sans-serif;
3
+ font-size: 76%;
4
+ background: #2A2A2A;
5
+ margin: 0;
6
+ padding: 0;
7
+ }
8
+
9
+ #collectiveidea {
10
+ border-bottom: 1px solid #444;
11
+ }
12
+
13
+ a {
14
+ color: #2D5385;
15
+ }
16
+
17
+ #main {
18
+ background-color: #FFF;
19
+ width: 700px;
20
+ margin: 0 auto;
21
+ border: 5px #CCC;
22
+ border-left-style: solid;
23
+ border-right-style: solid;
24
+ padding: 0 1em;
25
+ }
26
+
27
+ #header {
28
+ position: relative;
29
+ border-bottom: 1px solid #999;
30
+ padding: 1em;
31
+ }
32
+
33
+ #header h1 {
34
+ margin: 0;
35
+ padding: 0;
36
+ color: #2D5385;
37
+ }
38
+
39
+ #header h1 a {
40
+ text-decoration: none;
41
+ }
42
+
43
+ #header p {
44
+ margin: 0;
45
+ padding: 0;
46
+ font-size: 0.8em;
47
+ color: #999;
48
+ }
49
+
50
+ #nav {
51
+ list-style: none;
52
+ position: absolute;
53
+ right: 0;
54
+ top: 0.6em;
55
+ }
56
+ #nav li {
57
+ display: inline;
58
+ padding: 0 0.5em;
59
+ }
60
+
61
+ #content {
62
+ padding: 1em 0;
63
+ }
64
+
65
+ dl {
66
+ background-color: #DDD;
67
+ padding: 1em;
68
+ border: 1px solid #CCC;
69
+ }
70
+ dl .pronunciation {
71
+ color: #C00;
72
+ }
73
+ dl .description {
74
+ text-transform: uppercase;
75
+ font-size: 0.8em;
76
+ font-family: fixed;
77
+ }
@@ -0,0 +1,18 @@
1
+ {"rooms": [
2
+ {
3
+ "name": "Room 1",
4
+ "created_at": "2007/03/16 18:03:21 +0000",
5
+ "updated_at": "2007/03/16 18:03:21 +0000",
6
+ "topic": "Testing",
7
+ "id": 80749,
8
+ "membership_limit": 4
9
+ },
10
+ {
11
+ "name": "Room 2",
12
+ "created_at": "2007/03/16 18:04:54 +0000",
13
+ "updated_at": "2007/03/16 18:04:54 +0000",
14
+ "topic": "test",
15
+ "id": 80751,
16
+ "membership_limit": 4
17
+ }]
18
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "room": {
3
+ "full": false,
4
+ "name": "Room 1",
5
+ "created_at": "2007/03/16 18:03:21 +0000",
6
+ "updated_at": "2007/03/16 18:03:21 +0000",
7
+ "users": [{
8
+ "type": "Member",
9
+ "created_at": "2006/12/07 21:20:39 +0000",
10
+ "email_address": "jane@example.com",
11
+ "admin": true,
12
+ "id": 1,
13
+ "name": "Jane Doe"
14
+ }],
15
+ "topic": "Testing",
16
+ "active_token_value": "90cf7",
17
+ "id": 80749,
18
+ "open_to_guests": true,
19
+ "membership_limit": 4
20
+ }
21
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "room": {
3
+ "full": false,
4
+ "name": "Room 2",
5
+ "created_at": "2007/03/16 18:03:21 +0000",
6
+ "updated_at": "2007/03/16 18:03:21 +0000",
7
+ "users": [{
8
+ "type": "Member",
9
+ "created_at": "2006/12/07 21:20:39 +0000",
10
+ "email_address": "john@example.com",
11
+ "admin": true,
12
+ "id": 2,
13
+ "name": "John Doe"
14
+ }],
15
+ "topic": "Testing",
16
+ "active_token_value": "90cf7",
17
+ "id": 80751,
18
+ "open_to_guests": true,
19
+ "membership_limit": 4
20
+ }
21
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "room": {
3
+ "full": false,
4
+ "name": "Room 1",
5
+ "created_at": "2007/03/16 18:03:21 +0000",
6
+ "updated_at": "2007/03/16 18:03:21 +0000",
7
+ "users": [{
8
+ "type": "Member",
9
+ "created_at": "2006/12/07 21:20:39 +0000",
10
+ "email_address": "brandon@opensoul.org",
11
+ "admin": true,
12
+ "id": 129553,
13
+ "name": "Brandon Keepers"
14
+ }],
15
+ "topic": "Testing",
16
+ "active_token_value": "90cf7",
17
+ "id": 80749,
18
+ "open_to_guests": true,
19
+ "membership_limit": 4
20
+ }
21
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "user": {
3
+ "email_address": "user@example.com",
4
+ "type": "Member",
5
+ "created_at": "2006/04/06 00:38:28 +0000",
6
+ "admin": true,
7
+ "id": 12345,
8
+ "name": "John Doe",
9
+ "api_auth_token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
10
+ }
11
+ }
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --backtrace
@@ -0,0 +1,12 @@
1
+ $:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
2
+
3
+ require 'rubygems'
4
+ require 'spec'
5
+ require 'tinder'
6
+ require 'fakeweb'
7
+
8
+ FakeWeb.allow_net_connect = false
9
+
10
+ def fixture(name)
11
+ File.read(File.dirname(__FILE__) + "/fixtures/#{name}")
12
+ end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ describe Tinder::Campfire do
4
+ before do
5
+ @campfire = Tinder::Campfire.new('test', :token => 'mytoken')
6
+ end
7
+
8
+ describe "rooms" do
9
+ before do
10
+ FakeWeb.register_uri(:get, "http://mytoken:X@test.campfirenow.com/rooms.json",
11
+ :body => fixture('rooms.json'), :content_type => "application/json")
12
+ end
13
+
14
+ it "should return rooms" do
15
+ @campfire.rooms.size.should == 2
16
+ @campfire.rooms.first.should be_kind_of(Tinder::Room)
17
+ end
18
+
19
+ it "should set the room name and id" do
20
+ room = @campfire.rooms.first
21
+ room.name.should == 'Room 1'
22
+ room.id.should == 80749
23
+ end
24
+ end
25
+
26
+ describe "users" do
27
+ before do
28
+ FakeWeb.register_uri(:get, "http://mytoken:X@test.campfirenow.com/rooms.json",
29
+ :body => fixture('rooms.json'), :content_type => "application/json")
30
+ [80749, 80751].each do |id|
31
+ FakeWeb.register_uri(:get, "http://mytoken:X@test.campfirenow.com/room/#{id}.json",
32
+ :body => fixture("rooms/room#{id}.json"), :content_type => "application/json")
33
+ end
34
+ end
35
+
36
+ it "should return a sorted list of users in all rooms" do
37
+ @campfire.users.length.should == 2
38
+ @campfire.users.first[:name].should == "Jane Doe"
39
+ @campfire.users.last[:name].should == "John Doe"
40
+ end
41
+ end
42
+
43
+ describe "me" do
44
+ before do
45
+ FakeWeb.register_uri(:get, "http://mytoken:X@test.campfirenow.com/users/me.json",
46
+ :body => fixture('users/me.json'), :content_type => "application/json")
47
+ end
48
+
49
+ it "should return the current user's information" do
50
+ @campfire.me["name"].should == "John Doe"
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe Tinder::Connection do
4
+ describe "authentication" do
5
+ it "should raise an exception with bad credentials" do
6
+ FakeWeb.register_uri(:get, "http://foo:X@test.campfirenow.com/rooms.json",
7
+ :status => ["401", "Unauthorized"])
8
+ connection = Tinder::Connection.new('test', :token => 'foo')
9
+ lambda { connection.get('/rooms.json') }.should raise_error(Tinder::AuthenticationFailed)
10
+ end
11
+
12
+ it "should lookup token when username/password provided" do
13
+ FakeWeb.register_uri(:get, "http://user:pass@test.campfirenow.com/users/me.json",
14
+ :body => fixture('users/me.json'), :content_type => "application/json")
15
+ connection = Tinder::Connection.new('test', :username => 'user', :password => 'pass')
16
+ connection.token.should.should == "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
17
+ end
18
+
19
+
20
+ it "should use basic auth for credentials" do
21
+ FakeWeb.register_uri(:get, "http://mytoken:X@test.campfirenow.com/rooms.json",
22
+ :body => fixture('rooms.json'), :content_type => "application/json")
23
+ connection = Tinder::Connection.new('test', :token => 'mytoken')
24
+ lambda { connection.get('/rooms.json') }.should_not raise_error
25
+ end
26
+ end
27
+
28
+
29
+ end
@@ -0,0 +1,98 @@
1
+ require 'spec_helper'
2
+
3
+ describe Tinder::Room do
4
+ before do
5
+ FakeWeb.register_uri(:get, "http://mytoken:X@test.campfirenow.com/room/80749.json",
6
+ :body => fixture('rooms/show.json'), :content_type => "application/json")
7
+ @room = Tinder::Room.new(Tinder::Connection.new('test', :token => 'mytoken'), 'id' => 80749)
8
+ end
9
+
10
+ describe "join" do
11
+ FakeWeb.register_uri(:post, "http://mytoken:X@test.campfirenow.com/room/80749/join.json", :status => '200')
12
+
13
+ it "should post to join url" do
14
+ @room.join
15
+ end
16
+ end
17
+
18
+ describe "leave" do
19
+ before do
20
+ FakeWeb.register_uri(:post, "http://mytoken:X@test.campfirenow.com/room/80749/leave.json", :status => '200')
21
+ end
22
+
23
+ it "should post to leave url" do
24
+ @room.leave
25
+ end
26
+ end
27
+
28
+ describe "lock" do
29
+ before do
30
+ FakeWeb.register_uri(:post, "http://mytoken:X@test.campfirenow.com/room/80749/lock.json", :status => '200')
31
+ end
32
+
33
+ it "should post to lock url" do
34
+ @room.lock
35
+ end
36
+ end
37
+
38
+ describe "unlock" do
39
+ before do
40
+ FakeWeb.register_uri(:post, "http://mytoken:X@test.campfirenow.com/room/80749/unlock.json", :status => '200')
41
+ end
42
+
43
+ it "should post to unlock url" do
44
+ @room.unlock
45
+ end
46
+ end
47
+
48
+ describe "guest_url" do
49
+ it "should use guest_invite_code if active" do
50
+ @room.stub!(:guest_access_enabled? => true, :guest_invite_code => '123')
51
+ @room.guest_url.should == "http://test.campfirenow.com/123"
52
+ end
53
+
54
+ it "should return nil when guest access is not enabled" do
55
+ @room.stub!(:guest_access_enabled?).and_return(false)
56
+ @room.guest_url.should be_nil
57
+ end
58
+ end
59
+
60
+ it "should set guest_invite_code" do
61
+ @room.guest_invite_code.should == "90cf7"
62
+ end
63
+
64
+ it "should set guest_access_enabled?" do
65
+ @room.guest_access_enabled?.should be_true
66
+ end
67
+
68
+ describe "name=" do
69
+ it "should put to update the room" do
70
+ FakeWeb.register_uri(:put, "http://mytoken:X@test.campfirenow.com/room/80749.json",
71
+ :status => '200')
72
+ @room.name = "Foo"
73
+ end
74
+ end
75
+
76
+ describe "listen" do
77
+ before do
78
+ require 'twitter/json_stream'
79
+ # Get EventMachine out of the way. We could be using em-spec, but seems like overkill for testing one method.
80
+ module EventMachine; def self.run; yield end end
81
+ @stream = mock(Twitter::JSONStream)
82
+ @stream.stub!(:each_item)
83
+ end
84
+
85
+ it "should get from the streaming url" do
86
+ Twitter::JSONStream.should_receive(:connect).
87
+ with({:host=>"streaming.campfirenow.com", :path=>"/room/80749/live.json", :auth=>"mytoken:X", :timeout=>2}).
88
+ and_return(@stream)
89
+ @room.listen { }
90
+ end
91
+
92
+ it "should raise an exception if no block is given" do
93
+ lambda {
94
+ @room.listen
95
+ }.should raise_error("no block provided")
96
+ end
97
+ end
98
+ end