Browse code

Potrebne gemy pre websocket

Cinan Rakosnik authored on 10/03/2013 at 11:57:17
Showing 6 changed files
... ...
@@ -5,4 +5,4 @@ You are allowed to:
5 5
 2. Remove generators
6 6
 3. Add installed generators
7 7
 To add new installed generators automatically delete this file and reload the project.
8
+--><GeneratorsGroup><Generator name="active_record:migration" /><Generator name="active_record:model" /><Generator name="active_record:observer" /><Generator name="active_record:session_migration" /><Generator name="assets" /><Generator name="coffee:assets" /><Generator name="controller" /><Generator name="erb:controller" /><Generator name="erb:mailer" /><Generator name="erb:scaffold" /><Generator name="factory_girl:model" /><Generator name="generator" /><Generator name="helper" /><Generator name="integration_test" /><Generator name="jquery:install" /><Generator name="js:assets" /><Generator name="mailer" /><Generator name="migration" /><Generator name="model" /><Generator name="mongoid:config" /><Generator name="observer" /><Generator name="performance_test" /><Generator name="resource" /><Generator name="rspec:controller" /><Generator name="rspec:helper" /><Generator name="rspec:install" /><Generator name="rspec:integration" /><Generator name="rspec:mailer" /><Generator name="rspec:model" /><Generator name="rspec:observer" /><Generator name="rspec:scaffold" /><Generator name="rspec:view" /><Generator name="scaffold" /><Generator name="scaffold_controller" /><Generator name="session_migration" /><Generator name="task" /><Generator name="websocket_rails:install" /></GeneratorsGroup></Settings>
... ...
@@ -4,4 +4,4 @@ You are allowed to:
4 4
 1. Remove rake task
5 5
 2. Add existing rake tasks
6 6
 To add existing rake tasks automatically delete this file and reload the project.
7
+--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="List versions of all Rails frameworks and the environment" fullCmd="about" taksId="about" /><RakeGroup description="" fullCmd="" taksId="assets"><RakeTask description="Remove compiled assets" fullCmd="assets:clean" taksId="clean" /><RakeTask description="Compile all the assets named in config.assets.precompile" fullCmd="assets:precompile" taksId="precompile" /><RakeGroup description="" fullCmd="" taksId="clean"><RakeTask description="" fullCmd="assets:clean:all" taksId="all" /></RakeGroup><RakeTask description="" fullCmd="assets:environment" taksId="environment" /><RakeGroup description="" fullCmd="" taksId="precompile"><RakeTask description="" fullCmd="assets:precompile:all" taksId="all" /><RakeTask description="" fullCmd="assets:precompile:nondigest" taksId="nondigest" /><RakeTask description="" fullCmd="assets:precompile:primary" taksId="primary" /></RakeGroup></RakeGroup><RakeGroup description="" fullCmd="" taksId="db"><RakeTask description="Drops all the collections for the database for the current Rails.env" fullCmd="db:drop" taksId="drop" /><RakeGroup description="" fullCmd="" taksId="mongoid"><RakeTask description="Create the indexes defined on your mongoid models" fullCmd="db:mongoid:create_indexes" taksId="create_indexes" /><RakeTask description="Drops the database for the current Rails.env" fullCmd="db:mongoid:drop" taksId="drop" /><RakeTask description="Remove the indexes defined on your mongoid models without questions!" fullCmd="db:mongoid:remove_indexes" taksId="remove_indexes" /></RakeGroup><RakeTask description="Delete data and seed" fullCmd="db:reseed" taksId="reseed" /><RakeTask description="Load the seed data from db/seeds.rb" fullCmd="db:seed" taksId="seed" /><RakeTask description="Create the database, and initialize with the seed data" fullCmd="db:setup" taksId="setup" /><RakeTask description="" fullCmd="db:create" taksId="create" /><RakeTask description="" fullCmd="db:create_indexes" taksId="create_indexes" /><RakeTask description="" fullCmd="db:migrate" taksId="migrate" /><RakeTask description="" fullCmd="db:remove_indexes" taksId="remove_indexes" /><RakeGroup description="" fullCmd="" taksId="schema"><RakeTask description="" fullCmd="db:schema:load" taksId="load" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="test"><RakeTask description="" fullCmd="db:test:prepare" taksId="prepare" /></RakeGroup></RakeGroup><RakeGroup description="" fullCmd="" taksId="doc"><RakeTask description="Generate docs for the app -- also available doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/rdoc-template.rb, TITLE=&quot;Custom Title&quot;)" fullCmd="doc:app" taksId="app" /><RakeTask description="" fullCmd="doc:clobber" taksId="clobber" /><RakeTask description="" fullCmd="doc:clobber_app" taksId="clobber_app" /><RakeTask description="" fullCmd="doc:clobber_plugins" taksId="clobber_plugins" /><RakeTask description="" fullCmd="doc:clobber_rails" taksId="clobber_rails" /><RakeTask description="" fullCmd="doc:guides" taksId="guides" /><RakeTask description="" fullCmd="doc:plugins" taksId="plugins" /><RakeTask description="" fullCmd="doc:rails" taksId="rails" /><RakeTask description="" fullCmd="doc:reapp" taksId="reapp" /><RakeTask description="" fullCmd="doc:rerails" taksId="rerails" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="log"><RakeTask description="Truncates all *.log files in log/ to zero bytes" fullCmd="log:clear" taksId="clear" /></RakeGroup><RakeTask description="Prints out your Rack middleware stack" fullCmd="middleware" taksId="middleware" /><RakeTask description="Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)" fullCmd="notes" taksId="notes" /><RakeGroup description="" fullCmd="" taksId="notes"><RakeTask description="Enumerate a custom annotation, specify with ANNOTATION=CUSTOM" fullCmd="notes:custom" taksId="custom" /><RakeTask description="" fullCmd="notes:fixme" taksId="fixme" /><RakeTask description="" fullCmd="notes:optimize" taksId="optimize" /><RakeTask description="" fullCmd="notes:todo" taksId="todo" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="rails"><RakeTask description="Applies the template supplied by LOCATION=(/path/to/template) or URL" fullCmd="rails:template" taksId="template" /><RakeTask description="Update configs and some other initially generated files (or use just update:configs, update:scripts, or update:application_controller)" fullCmd="rails:update" taksId="update" /><RakeGroup description="" fullCmd="" taksId="templates"><RakeTask description="" fullCmd="rails:templates:copy" taksId="copy" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="update"><RakeTask description="" fullCmd="rails:update:application_controller" taksId="application_controller" /><RakeTask description="" fullCmd="rails:update:configs" taksId="configs" /><RakeTask description="" fullCmd="rails:update:scripts" taksId="scripts" /></RakeGroup></RakeGroup><RakeTask description="Print out all defined routes in match order, with names" fullCmd="routes" taksId="routes" /><RakeTask description="Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions)" fullCmd="secret" taksId="secret" /><RakeTask description="Report code statistics (KLOCs, etc) from the application" fullCmd="stats" taksId="stats" /><RakeTask description="Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:profile, test:plugins)" fullCmd="test" taksId="test" /><RakeGroup description="" fullCmd="" taksId="test"><RakeTask description="Run tests for {:recent=&gt;&quot;test:prepare&quot;} / Test recent changes" fullCmd="test:recent" taksId="recent" /><RakeTask description="Run tests for {:single=&gt;&quot;test:prepare&quot;}" fullCmd="test:single" taksId="single" /><RakeTask description="Run tests for {:uncommitted=&gt;&quot;test:prepare&quot;} / Test changes since last checkin (only Subversion and Git)" fullCmd="test:uncommitted" taksId="uncommitted" /><RakeTask description="" fullCmd="test:benchmark" taksId="benchmark" /><RakeTask description="" fullCmd="test:functionals" taksId="functionals" /><RakeTask description="" fullCmd="test:integration" taksId="integration" /><RakeTask description="" fullCmd="test:plugins" taksId="plugins" /><RakeTask description="" fullCmd="test:prepare" taksId="prepare" /><RakeTask description="" fullCmd="test:profile" taksId="profile" /><RakeTask description="" fullCmd="test:run" taksId="run" /><RakeTask description="" fullCmd="test:units" taksId="units" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="time"><RakeGroup description="" fullCmd="" taksId="zones"><RakeTask description="Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter, e.g., OFFSET=-6" fullCmd="time:zones:all" taksId="all" /><RakeTask description="" fullCmd="time:zones:local" taksId="local" /><RakeTask description="" fullCmd="time:zones:us" taksId="us" /></RakeGroup></RakeGroup><RakeGroup description="" fullCmd="" taksId="tmp"><RakeTask description="Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sockets:clear)" fullCmd="tmp:clear" taksId="clear" /><RakeTask description="Creates tmp directories for sessions, cache, sockets, and pids" fullCmd="tmp:create" taksId="create" /><RakeGroup description="" fullCmd="" taksId="cache"><RakeTask description="" fullCmd="tmp:cache:clear" taksId="clear" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="pids"><RakeTask description="" fullCmd="tmp:pids:clear" taksId="clear" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="sessions"><RakeTask description="" fullCmd="tmp:sessions:clear" taksId="clear" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="sockets"><RakeTask description="" fullCmd="tmp:sockets:clear" taksId="clear" /></RakeGroup></RakeGroup><RakeGroup description="" fullCmd="" taksId="websocket_rails"><RakeTask description="Start the WebsocketRails standalone server" fullCmd="websocket_rails:start_server" taksId="start_server" /><RakeTask description="Stop the WebsocketRails standalone server" fullCmd="websocket_rails:stop_server" taksId="stop_server" /></RakeGroup><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="doc" taksId="doc" /><RakeTask description="" fullCmd="doc/api" taksId="doc/api" /><RakeTask description="" fullCmd="doc/api/index.html" taksId="doc/api/index.html" /><RakeTask description="" fullCmd="doc/app" taksId="doc/app" /><RakeTask description="" fullCmd="doc/app/index.html" taksId="doc/app/index.html" /><RakeTask description="" fullCmd="environment" taksId="environment" /><RakeTask description="" fullCmd="rails_env" taksId="rails_env" /></RakeGroup></Settings>
... ...
@@ -6,6 +6,9 @@ gem 'rails', '~> 3.2.11'
6 6
 # gem 'rails', :git => 'git://github.com/rails/rails.git'
7 7
 
8 8
 gem "mongoid", "~> 3.0.20"
9
+gem "xmpp4r", "~> 0.5"
10
+gem "thin", "~> 1.5.0"
11
+gem "websocket-rails", "~> 0.4.2"
9 12
 
10 13
 # Gems used only for assets and not required
11 14
 # in production environments by default.
... ...
@@ -41,7 +44,6 @@ end
41 41
 gem 'jquery-rails'
42 42
 gem "haml", "~> 3.1.7"
43 43
 gem "haml-rails", "~> 0.3.5"
44
-gem "xmpp4r", "~> 0.5"
45 44
 
46 45
 # To use ActiveModel has_secure_password
47 46
 # gem 'bcrypt-ruby', '~> 3.0.0'
... ...
@@ -61,8 +61,12 @@ GEM
61 61
       sass (~> 3.1)
62 62
     compass-rails (1.0.3)
63 63
       compass (>= 0.12.2, < 0.14)
64
+    daemons (1.1.9)
64 65
     diff-lcs (1.1.3)
66
+    em-synchrony (1.0.3)
67
+      eventmachine (>= 1.0.0.beta.1)
65 68
     erubis (2.7.0)
69
+    eventmachine (1.0.3)
66 70
     execjs (1.4.0)
67 71
       multi_json (~> 1.0)
68 72
     factory_girl (4.2.0)
... ...
@@ -70,6 +74,8 @@ GEM
70 70
     factory_girl_rails (4.2.1)
71 71
       factory_girl (~> 4.2.0)
72 72
       railties (>= 3.0.0)
73
+    faye-websocket (0.4.7)
74
+      eventmachine (>= 0.12.0)
73 75
     ffi (1.3.1)
74 76
     fssm (0.2.10)
75 77
     haml (3.1.7)
... ...
@@ -81,6 +87,7 @@ GEM
81 81
     hashie (1.2.0)
82 82
     highline (1.6.15)
83 83
     hike (1.2.1)
84
+    hiredis (0.4.5)
84 85
     i18n (0.6.1)
85 86
     journey (1.0.4)
86 87
     jquery-rails (2.2.1)
... ...
@@ -146,6 +153,7 @@ GEM
146 146
     rake (10.0.3)
147 147
     rdoc (3.12.1)
148 148
       json (~> 1.4)
149
+    redis (3.0.3)
149 150
     rspec-core (2.12.2)
150 151
     rspec-expectations (2.12.1)
151 152
       diff-lcs (~> 1.1.3)
... ...
@@ -174,6 +182,10 @@ GEM
174 174
       rack (~> 1.0)
175 175
       tilt (~> 1.1, != 1.3.0)
176 176
     test-unit (2.5.4)
177
+    thin (1.5.0)
178
+      daemons (>= 1.0.9)
179
+      eventmachine (>= 0.12.6)
180
+      rack (>= 1.0.0)
177 181
     thor (0.17.0)
178 182
     tilt (1.3.3)
179 183
     timecop (0.5.9.2)
... ...
@@ -185,6 +197,14 @@ GEM
185 185
       execjs (>= 0.3.0)
186 186
       multi_json (~> 1.0, >= 1.0.2)
187 187
     websocket (1.0.7)
188
+    websocket-rails (0.4.2)
189
+      em-synchrony
190
+      faye-websocket
191
+      hiredis
192
+      rack
193
+      rails
194
+      redis
195
+      thin
188 196
     xmpp4r (0.5)
189 197
     xpath (1.0.0)
190 198
       nokogiri (~> 1.3)
... ...
@@ -210,6 +230,8 @@ DEPENDENCIES
210 210
   rspec-rails
211 211
   sass-rails (~> 3.2.3)
212 212
   test-unit
213
+  thin (~> 1.5.0)
213 214
   timecop
214 215
   uglifier (>= 1.0.3)
216
+  websocket-rails (~> 0.4.2)
215 217
   xmpp4r (~> 0.5)
... ...
@@ -14,3 +14,5 @@
14 14
 //= require jquery_ujs
15 15
 //= require _main
16 16
 //= require_tree .
17
+//= require websocket_rails/main
18
+
17 19
new file mode 100644
... ...
@@ -0,0 +1,44 @@
0
+WebsocketRails.setup do |config|
1
+
2
+  # Uncomment to override the default log level. The log level can be
3
+  # any of the standard Logger log levels. By default it will mirror the
4
+  # current Rails environment log level.
5
+  # config.log_level = :debug
6
+
7
+  # Uncomment to change the default log file path.
8
+  # config.log_path = "#{Rails.root}/log/websocket_rails.log"
9
+
10
+  # Set to true if you wish to log the internal websocket_rails events
11
+  # such as the keepalive `websocket_rails.ping` event.
12
+  # config.log_internal_events = false
13
+
14
+  # Change to true to enable standalone server mode
15
+  # Start the standalone server with rake websocket_rails:start_server
16
+  # * Requires Redis
17
+  config.standalone = false
18
+
19
+  # Change to true to enable channel synchronization between
20
+  # multiple server instances.
21
+  # * Requires Redis.
22
+  config.synchronize = false
23
+
24
+  # Uncomment and edit to point to a different redis instance.
25
+  # Will not be used unless standalone or synchronization mode
26
+  # is enabled.
27
+  # config.redis_options = {:host => 'localhost', :port => '6379'}
28
+end
29
+
30
+WebsocketRails::EventMap.describe do
31
+  # You can use this file to map incoming events to controller actions.
32
+  # One event can be mapped to any number of controller actions. The
33
+  # actions will be executed in the order they were subscribed.
34
+  #
35
+  # Uncomment and edit the next line to handle the client connected event:
36
+  #   subscribe :client_connected, :to => Controller, :with_method => :method_name
37
+  #
38
+  # Here is an example of mapping namespaced events:
39
+  #   namespace :product do
40
+  #     subscribe :new, :to => ProductController, :with_method => :new_product
41
+  #   end
42
+  # The above will handle an event triggered on the client like `product.new`.
43
+end