robut 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.travis.yml +11 -0
  2. data/Gemfile +2 -3
  3. data/README.rdoc +38 -19
  4. data/examples/Chatfile +10 -4
  5. data/lib/robut.rb +3 -0
  6. data/lib/robut/connection.rb +10 -72
  7. data/lib/robut/plugin.rb +94 -13
  8. data/lib/robut/plugin/echo.rb +3 -13
  9. data/lib/robut/plugin/google_images.rb +17 -0
  10. data/lib/robut/plugin/help.rb +7 -15
  11. data/lib/robut/plugin/meme.rb +22 -53
  12. data/lib/robut/plugin/pick.rb +18 -0
  13. data/lib/robut/plugin/ping.rb +3 -9
  14. data/lib/robut/plugin/quips.rb +60 -0
  15. data/lib/robut/plugin/say.rb +6 -12
  16. data/lib/robut/plugin/stock.rb +45 -0
  17. data/lib/robut/pm.rb +40 -0
  18. data/lib/robut/presence.rb +35 -0
  19. data/lib/robut/room.rb +30 -0
  20. data/lib/robut/version.rb +1 -1
  21. data/test/mocks/connection_mock.rb +2 -18
  22. data/test/mocks/presence_mock.rb +25 -0
  23. data/test/test_helper.rb +3 -1
  24. data/test/unit/connection_test.rb +58 -25
  25. data/test/unit/plugin/alias_test.rb +5 -4
  26. data/test/unit/plugin/echo_test.rb +5 -4
  27. data/test/unit/plugin/help_test.rb +4 -3
  28. data/test/unit/plugin/later_test.rb +7 -6
  29. data/test/unit/plugin/lunch_test.rb +6 -5
  30. data/test/unit/plugin/pick_test.rb +35 -0
  31. data/test/unit/plugin/ping_test.rb +4 -3
  32. data/test/unit/plugin/quips_test.rb +58 -0
  33. data/test/unit/plugin/say_test.rb +4 -3
  34. data/test/unit/plugin/weather_test.rb +15 -14
  35. data/test/unit/plugin_test.rb +62 -1
  36. data/test/unit/room_test.rb +51 -0
  37. metadata +28 -20
  38. data/lib/robut/plugin/rdio.rb +0 -96
  39. data/lib/robut/plugin/rdio/public/css/rdio.css +0 -141
  40. data/lib/robut/plugin/rdio/public/css/style.css +0 -79
  41. data/lib/robut/plugin/rdio/public/css/style_after.css +0 -42
  42. data/lib/robut/plugin/rdio/public/images/background.png +0 -0
  43. data/lib/robut/plugin/rdio/public/images/no-album.png +0 -0
  44. data/lib/robut/plugin/rdio/public/index.html +0 -43
  45. data/lib/robut/plugin/rdio/public/js/libs/dd_belatedpng.js +0 -13
  46. data/lib/robut/plugin/rdio/public/js/libs/jquery-1.5.1.min.js +0 -16
  47. data/lib/robut/plugin/rdio/public/js/libs/modernizr-1.7.min.js +0 -2
  48. data/lib/robut/plugin/rdio/public/js/rdio.js +0 -129
  49. data/lib/robut/plugin/rdio/public/js/script.js +0 -3
  50. data/lib/robut/plugin/rdio/server.rb +0 -57
@@ -1,3 +0,0 @@
1
- $(function(){
2
- $("#jquery-test").html("jQuery is loaded");
3
- });
@@ -1,57 +0,0 @@
1
- require 'sinatra'
2
- require 'json'
3
-
4
- class Robut::Plugin::Rdio
5
- include Robut::Plugin
6
-
7
- # A simple server to communicate new Rdio sources to the Web
8
- # Playback API. The client will update
9
- # Robut::Plugin::Rdio::Server.queue with any new sources, and a call
10
- # to /queue.json will pull those new sources as a json object.
11
- class Server < Sinatra::Base
12
-
13
- set :root, File.dirname(__FILE__)
14
-
15
- class << self
16
- # A list of items that haven't been fetched by the web playback
17
- # API yet.
18
- attr_accessor :queue
19
-
20
- # The playback token for +domain+. If you're accessing Rdio over
21
- # localhost, you shouldn't need to change this. Otherwise,
22
- # download the rdio-python plugin:
23
- #
24
- # https://github.com/rdio/rdio-python
25
- #
26
- # and generate a new token for your domain:
27
- #
28
- # ./rdio-call --consumer-key=YOUR_CONSUMER_KEY --consumer-secret=YOUR_CONSUMER_SECRET getPlaybackToken domain=YOUR_DOMAIN
29
- attr_accessor :token
30
-
31
- # The domain associated with +token+. Defaults to localhost.
32
- attr_accessor :domain
33
- end
34
- self.queue = []
35
-
36
- # Renders a simple Rdio web player.
37
- get '/' do
38
- File.read(File.expand_path('public/index.html', File.dirname(__FILE__)))
39
- end
40
-
41
- get '/js/vars.js' do
42
- content_type 'text/javascript'
43
- <<END
44
- var rdio_token = '#{self.class.token}';
45
- var rdio_domain = '#{self.class.domain}';
46
- END
47
- end
48
-
49
- # Returns the sources that haven't been fetched yet.
50
- get '/queue.json' do
51
- queue = self.class.queue.dup
52
- self.class.queue = []
53
- queue.to_json
54
- end
55
- end
56
- end
57
-