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.
Files changed (80) hide show
  1. data/.gitignore +2 -1
  2. data/.rvmrc +1 -0
  3. data/Gemfile.lock +1 -3
  4. data/README.md +25 -20
  5. data/lib/mad_chatter/actions/dsl.rb +4 -10
  6. data/lib/mad_chatter/actions.rb +29 -0
  7. data/lib/mad_chatter/channel.rb +56 -0
  8. data/lib/mad_chatter/config.rb +22 -5
  9. data/lib/mad_chatter/connection.rb +29 -0
  10. data/lib/mad_chatter/extensions.rb +12 -0
  11. data/lib/mad_chatter/markdown_renderer.rb +6 -0
  12. data/lib/mad_chatter/message.rb +39 -12
  13. data/lib/mad_chatter/message_history.rb +8 -5
  14. data/lib/mad_chatter/message_listener.rb +17 -0
  15. data/lib/mad_chatter/message_listeners/code.rb +30 -0
  16. data/lib/mad_chatter/message_listeners/image.rb +27 -0
  17. data/lib/mad_chatter/message_listeners/join.rb +30 -0
  18. data/lib/mad_chatter/message_listeners/markdown.rb +45 -0
  19. data/lib/mad_chatter/message_listeners/nick.rb +26 -0
  20. data/lib/mad_chatter/server.rb +0 -55
  21. data/lib/mad_chatter/servers/em_websocket.rb +5 -14
  22. data/lib/mad_chatter/user.rb +78 -0
  23. data/lib/mad_chatter/users.rb +32 -24
  24. data/lib/mad_chatter/version.rb +1 -1
  25. data/lib/mad_chatter.rb +98 -34
  26. data/mad_chatter.gemspec +1 -1
  27. data/screenshot.png +0 -0
  28. data/spec/actions_spec.rb +7 -0
  29. data/spec/message_history_spec.rb +12 -10
  30. data/spec/message_listeners/code_spec.rb +37 -0
  31. data/spec/message_listeners/join_spec.rb +34 -0
  32. data/spec/message_listeners/markdown_spec.rb +47 -0
  33. data/spec/message_spec.rb +28 -16
  34. data/spec/server_spec.rb +43 -0
  35. data/spec/users_spec.rb +23 -0
  36. data/templates/extensions/example.rb +1 -1
  37. data/templates/extensions.rb +16 -14
  38. data/templates/web/css/bootstrap.css +3363 -0
  39. data/templates/web/css/bootstrap.min.css +610 -0
  40. data/templates/web/css/bootstrap.min.responsive.css +3 -0
  41. data/templates/web/css/bootstrap.responsive.css +567 -0
  42. data/templates/web/css/mad_chatter.css +59 -0
  43. data/templates/web/{styles.css → css/styles.css} +26 -20
  44. data/templates/web/img/glyphicons-halflings-white.png +0 -0
  45. data/templates/web/img/glyphicons-halflings.png +0 -0
  46. data/templates/web/index.html +173 -40
  47. data/templates/web/js/bootstrap.js +1722 -0
  48. data/templates/web/js/bootstrap.min.js +1 -0
  49. data/templates/web/js/mad_chatter.js +292 -0
  50. data/templates/web/{mad_chatter_actions.js → js/mad_chatter_actions.js} +0 -0
  51. data/templates/web/js/mad_chatter_config.js +3 -0
  52. data/templates/web/js/swfobject.js +4 -0
  53. data/templates/web/js/web_socket.js +389 -0
  54. data/templates/web/swf/WebSocketMain.swf +0 -0
  55. metadata +65 -62
  56. data/TODO.txt +0 -10
  57. data/templates/web/mad_chatter.js +0 -161
  58. data/templates/web/mad_chatter_config.js +0 -1
  59. data/templates/web/markitup/jquery.markitup.js +0 -593
  60. data/templates/web/markitup/sets/markdown/images/bold.png +0 -0
  61. data/templates/web/markitup/sets/markdown/images/code.png +0 -0
  62. data/templates/web/markitup/sets/markdown/images/h1.png +0 -0
  63. data/templates/web/markitup/sets/markdown/images/h2.png +0 -0
  64. data/templates/web/markitup/sets/markdown/images/h3.png +0 -0
  65. data/templates/web/markitup/sets/markdown/images/h4.png +0 -0
  66. data/templates/web/markitup/sets/markdown/images/h5.png +0 -0
  67. data/templates/web/markitup/sets/markdown/images/h6.png +0 -0
  68. data/templates/web/markitup/sets/markdown/images/italic.png +0 -0
  69. data/templates/web/markitup/sets/markdown/images/link.png +0 -0
  70. data/templates/web/markitup/sets/markdown/images/list-bullet.png +0 -0
  71. data/templates/web/markitup/sets/markdown/images/list-numeric.png +0 -0
  72. data/templates/web/markitup/sets/markdown/images/picture.png +0 -0
  73. data/templates/web/markitup/sets/markdown/images/preview.png +0 -0
  74. data/templates/web/markitup/sets/markdown/images/quotes.png +0 -0
  75. data/templates/web/markitup/sets/markdown/readme.txt +0 -11
  76. data/templates/web/markitup/sets/markdown/style.css +0 -6
  77. data/templates/web/markitup/skins/mad_chatter/images/handle.png +0 -0
  78. data/templates/web/markitup/skins/mad_chatter/images/menu.png +0 -0
  79. data/templates/web/markitup/skins/mad_chatter/images/submenu.png +0 -0
  80. data/templates/web/markitup/skins/mad_chatter/style.css +0 -121
@@ -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
@@ -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
@@ -1,4 +1,4 @@
1
- # I dont think this works anymore
1
+ # this definitely doesnt work anymore
2
2
 
3
3
  class Example
4
4
  # include MadChatter::Extension
@@ -12,18 +12,20 @@
12
12
  # end
13
13
  #
14
14
 
15
- on_message %r{/youtube http://youtu.be/(.*)} do |youtube_id|
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{/alert (.*)} do |alert_message|
21
- send_action 'show_alert', alert_message
22
- stop_message_handling
23
- end
24
-
25
- on_message %r{/earthquake} do
26
- send_status_message 'Someone has just caused an earthquake!'
27
- send_action 'earthquake'
28
- stop_message_handling
29
- end
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