mad_chatter 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/.rvmrc +1 -0
- data/Gemfile.lock +1 -3
- data/README.md +25 -20
- data/lib/mad_chatter/actions/dsl.rb +4 -10
- data/lib/mad_chatter/actions.rb +29 -0
- data/lib/mad_chatter/channel.rb +56 -0
- data/lib/mad_chatter/config.rb +22 -5
- data/lib/mad_chatter/connection.rb +29 -0
- data/lib/mad_chatter/extensions.rb +12 -0
- data/lib/mad_chatter/markdown_renderer.rb +6 -0
- data/lib/mad_chatter/message.rb +39 -12
- data/lib/mad_chatter/message_history.rb +8 -5
- data/lib/mad_chatter/message_listener.rb +17 -0
- data/lib/mad_chatter/message_listeners/code.rb +30 -0
- data/lib/mad_chatter/message_listeners/image.rb +27 -0
- data/lib/mad_chatter/message_listeners/join.rb +30 -0
- data/lib/mad_chatter/message_listeners/markdown.rb +45 -0
- data/lib/mad_chatter/message_listeners/nick.rb +26 -0
- data/lib/mad_chatter/server.rb +0 -55
- data/lib/mad_chatter/servers/em_websocket.rb +5 -14
- data/lib/mad_chatter/user.rb +78 -0
- data/lib/mad_chatter/users.rb +32 -24
- data/lib/mad_chatter/version.rb +1 -1
- data/lib/mad_chatter.rb +98 -34
- data/mad_chatter.gemspec +1 -1
- data/screenshot.png +0 -0
- data/spec/actions_spec.rb +7 -0
- data/spec/message_history_spec.rb +12 -10
- data/spec/message_listeners/code_spec.rb +37 -0
- data/spec/message_listeners/join_spec.rb +34 -0
- data/spec/message_listeners/markdown_spec.rb +47 -0
- data/spec/message_spec.rb +28 -16
- data/spec/server_spec.rb +43 -0
- data/spec/users_spec.rb +23 -0
- data/templates/extensions/example.rb +1 -1
- data/templates/extensions.rb +16 -14
- data/templates/web/css/bootstrap.css +3363 -0
- data/templates/web/css/bootstrap.min.css +610 -0
- data/templates/web/css/bootstrap.min.responsive.css +3 -0
- data/templates/web/css/bootstrap.responsive.css +567 -0
- data/templates/web/css/mad_chatter.css +59 -0
- data/templates/web/{styles.css → css/styles.css} +26 -20
- data/templates/web/img/glyphicons-halflings-white.png +0 -0
- data/templates/web/img/glyphicons-halflings.png +0 -0
- data/templates/web/index.html +173 -40
- data/templates/web/js/bootstrap.js +1722 -0
- data/templates/web/js/bootstrap.min.js +1 -0
- data/templates/web/js/mad_chatter.js +292 -0
- data/templates/web/{mad_chatter_actions.js → js/mad_chatter_actions.js} +0 -0
- data/templates/web/js/mad_chatter_config.js +3 -0
- data/templates/web/js/swfobject.js +4 -0
- data/templates/web/js/web_socket.js +389 -0
- data/templates/web/swf/WebSocketMain.swf +0 -0
- metadata +65 -62
- data/TODO.txt +0 -10
- data/templates/web/mad_chatter.js +0 -161
- data/templates/web/mad_chatter_config.js +0 -1
- data/templates/web/markitup/jquery.markitup.js +0 -593
- data/templates/web/markitup/sets/markdown/images/bold.png +0 -0
- data/templates/web/markitup/sets/markdown/images/code.png +0 -0
- data/templates/web/markitup/sets/markdown/images/h1.png +0 -0
- data/templates/web/markitup/sets/markdown/images/h2.png +0 -0
- data/templates/web/markitup/sets/markdown/images/h3.png +0 -0
- data/templates/web/markitup/sets/markdown/images/h4.png +0 -0
- data/templates/web/markitup/sets/markdown/images/h5.png +0 -0
- data/templates/web/markitup/sets/markdown/images/h6.png +0 -0
- data/templates/web/markitup/sets/markdown/images/italic.png +0 -0
- data/templates/web/markitup/sets/markdown/images/link.png +0 -0
- data/templates/web/markitup/sets/markdown/images/list-bullet.png +0 -0
- data/templates/web/markitup/sets/markdown/images/list-numeric.png +0 -0
- data/templates/web/markitup/sets/markdown/images/picture.png +0 -0
- data/templates/web/markitup/sets/markdown/images/preview.png +0 -0
- data/templates/web/markitup/sets/markdown/images/quotes.png +0 -0
- data/templates/web/markitup/sets/markdown/readme.txt +0 -11
- data/templates/web/markitup/sets/markdown/style.css +0 -6
- data/templates/web/markitup/skins/mad_chatter/images/handle.png +0 -0
- data/templates/web/markitup/skins/mad_chatter/images/menu.png +0 -0
- data/templates/web/markitup/skins/mad_chatter/images/submenu.png +0 -0
- data/templates/web/markitup/skins/mad_chatter/style.css +0 -121
data/spec/server_spec.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MadChatter::Server do
|
4
|
+
|
5
|
+
it 'should accept new connections' do
|
6
|
+
# todo
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should allow me to join a room that already exists' do
|
10
|
+
# todo
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should not allow me to join a room that doesnt exist, unless I create it' do
|
14
|
+
# todo
|
15
|
+
end
|
16
|
+
|
17
|
+
# context '#send_message' do
|
18
|
+
# it 'should add regular messages to the message history' do
|
19
|
+
# MadChatter::MessageHistory.all.length.should == 0
|
20
|
+
# message = MadChatter::Message.new('message', 'regular message');
|
21
|
+
# MadChatter::Server.send_message message
|
22
|
+
# MadChatter::MessageHistory.all.length.should == 1
|
23
|
+
# end
|
24
|
+
# it 'should add status messages to the message history' do
|
25
|
+
# MadChatter::MessageHistory.all.length.should == 0
|
26
|
+
# message = MadChatter::Message.new('status', 'status message');
|
27
|
+
# MadChatter::Server.send_message message
|
28
|
+
# MadChatter::MessageHistory.all.length.should == 1
|
29
|
+
# end
|
30
|
+
# it 'should not add action messages to the message history' do
|
31
|
+
# MadChatter::MessageHistory.all.length.should == 0
|
32
|
+
# message = MadChatter::Message.new('action', 'action message');
|
33
|
+
# MadChatter::Server.send_message message
|
34
|
+
# MadChatter::MessageHistory.all.length.should == 0
|
35
|
+
# end
|
36
|
+
# it 'should not add user list messages to the message history' do
|
37
|
+
# MadChatter::MessageHistory.all.length.should == 0
|
38
|
+
# message = MadChatter::Message.new('users', 'list of users');
|
39
|
+
# MadChatter::Server.send_message message
|
40
|
+
# MadChatter::MessageHistory.all.length.should == 0
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
end
|
data/spec/users_spec.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# require 'spec_helper'
|
2
|
+
#
|
3
|
+
# describe MadChatter::Users do
|
4
|
+
#
|
5
|
+
# it 'should have a well-known interface' do
|
6
|
+
# [:users, :add, :update, :remove, :find_username_by_token, :current, :token_exists?].each do |m|
|
7
|
+
# MadChatter::Users.should respond_to(m)
|
8
|
+
# end
|
9
|
+
# end
|
10
|
+
#
|
11
|
+
# it 'should store users and their usernames' do
|
12
|
+
# MadChatter::Users.add 'token1', 'username1'
|
13
|
+
# MadChatter::Users.add 'token2', 'username2'
|
14
|
+
# MadChatter::Users.current.should == ['username1', 'username2']
|
15
|
+
# end
|
16
|
+
#
|
17
|
+
# it 'should encode into JSON correctly' do
|
18
|
+
# MadChatter::Users.add 'token1', 'username1'
|
19
|
+
# MadChatter::Users.add 'token2', 'username2'
|
20
|
+
# MadChatter::Users.to_json.should == '{"type":"users","json":["username1","username2"]}'
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# end
|
data/templates/extensions.rb
CHANGED
@@ -12,18 +12,20 @@
|
|
12
12
|
# end
|
13
13
|
#
|
14
14
|
|
15
|
-
|
16
|
-
send_message "<iframe width='560' height='315' src='http://www.youtube.com/embed/#{youtube_id}' frameborder='0' allowfullscreen></iframe>"
|
17
|
-
stop_message_handling
|
18
|
-
end
|
15
|
+
#nothing in this file will work, now that we have multiple channels, sorry!!
|
19
16
|
|
20
|
-
on_message %r{/
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
on_message %r{
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
17
|
+
# on_message %r{^/youtube http://youtu.be/(.*)$} do |youtube_id|
|
18
|
+
# send_message "<iframe width='560' height='315' src='http://www.youtube.com/embed/#{youtube_id}' frameborder='0' allowfullscreen></iframe>"
|
19
|
+
# stop_message_handling
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# on_message %r{^/alert (.*)$} do |alert_message|
|
23
|
+
# send_action 'show_alert', alert_message
|
24
|
+
# stop_message_handling
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# on_message %r{^/earthquake$} do
|
28
|
+
# send_status_message 'Someone has just caused an earthquake!'
|
29
|
+
# send_action 'earthquake'
|
30
|
+
# stop_message_handling
|
31
|
+
# end
|