websocket-rails 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # WebsocketRails Change Log
2
2
 
3
+ February 28 2013
4
+
5
+ ## Version 0.4.1
6
+
7
+ * Fix bug in ControllerFactory#reload! that prevented the handling of
8
+ internal events when running in the Development environment. Fixes issue #50. - Thanks to @nessche
9
+
10
+ * Only reload controller classes when Rails config.cache_classes is set
11
+ to false instead of always reloading when in the Rails development
12
+ environment. This better respects the Rails configuration options.
13
+ Addresses issue #51. - Thanks to @ngauthier
14
+
3
15
  February 27 2013
4
16
 
5
17
  ## Version 0.4.0
@@ -1,3 +1,7 @@
1
1
  Rails.application.routes.draw do
2
- match "/websocket", :to => WebsocketRails::ConnectionManager.new
2
+ if Rails.version >= '4.0.0'
3
+ get "/websocket", :to => WebsocketRails::ConnectionManager.new
4
+ else
5
+ match "/websocket", :to => WebsocketRails::ConnectionManager.new
6
+ end
3
7
  end
@@ -59,11 +59,13 @@ module WebsocketRails
59
59
  # Reloads the controller class to pick up code changes
60
60
  # while in the development environment.
61
61
  def reload!(controller)
62
- return unless defined?(Rails) and Rails.env.development?
63
-
64
- class_name = controller.name
65
- filename = class_name.underscore
66
- load "#{filename}.rb"
62
+ return unless defined?(Rails) and !Rails.configuration.cache_classes
63
+ # we don't reload our own controller as we assume it provide as 'library'
64
+ unless controller == WebsocketRails::InternalController
65
+ class_name = controller.name
66
+ filename = class_name.underscore
67
+ load "#{filename}.rb"
68
+ end
67
69
  end
68
70
 
69
71
  end
@@ -6,7 +6,12 @@ module WebsocketRails
6
6
 
7
7
  paths["app"] << "lib/rails/app"
8
8
  paths["app/controllers"] << "lib/rails/app/controllers"
9
- paths["config/routes"] << "lib/rails/config/routes.rb"
9
+
10
+ if ::Rails.version >= '4.0.0'
11
+ paths["config/routes.rb"] << "lib/rails/config/routes.rb"
12
+ else
13
+ paths["config/routes"] << "lib/rails/config/routes.rb"
14
+ end
10
15
 
11
16
  rake_tasks do
12
17
  require 'websocket-rails'
@@ -1,3 +1,3 @@
1
1
  module WebsocketRails
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -14,3 +14,13 @@ Connecting to database specified by database.yml
14
14
  Connecting to database specified by database.yml
15
15
  Connecting to database specified by database.yml
16
16
  Connecting to database specified by database.yml
17
+ Connecting to database specified by database.yml
18
+ Connecting to database specified by database.yml
19
+ Connecting to database specified by database.yml
20
+ Connecting to database specified by database.yml
21
+ Connecting to database specified by database.yml
22
+ Connecting to database specified by database.yml
23
+ Connecting to database specified by database.yml
24
+ Connecting to database specified by database.yml
25
+ Connecting to database specified by database.yml
26
+ Connecting to database specified by database.yml
@@ -31,6 +31,19 @@ module WebsocketRails
31
31
  end
32
32
 
33
33
  describe "#new_for_event" do
34
+
35
+ context "when Rails is defined and env is set to development" do
36
+
37
+ it "creates and returns a controller instance of the InternalController" do
38
+ rails_env = double(:rails_env)
39
+ Rails.stub(:env).and_return rails_env
40
+ rails_env.stub(:development?).and_return true
41
+ controller = subject.new_for_event(event, InternalController)
42
+ controller.class.should == InternalController
43
+ end
44
+
45
+ end
46
+
34
47
  it "creates and returns a new controller instance" do
35
48
  controller = subject.new_for_event(event, TestController)
36
49
  controller.class.should == TestController
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: websocket-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-02-27 00:00:00.000000000 Z
14
+ date: 2013-02-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -300,7 +300,7 @@ files:
300
300
  - CHANGELOG.md
301
301
  homepage: http://danknox.github.com/websocket-rails/
302
302
  licenses: []
303
- post_install_message: ! " Welcome to WebsocketRails v0.4.0!\n\n There have been
303
+ post_install_message: ! " Welcome to WebsocketRails v0.4.1!\n\n There have been
304
304
  a few significant changes in the public\n API, so if you are upgrading please be
305
305
  sure to read the\n CHANGELOG located at:\n\n http://github.com/DanKnox/websocket-rails/CHANGELOG.md\n"
306
306
  rdoc_options: []
@@ -314,7 +314,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
314
314
  version: '0'
315
315
  segments:
316
316
  - 0
317
- hash: 500969557461387914
317
+ hash: -416918436862506067
318
318
  required_rubygems_version: !ruby/object:Gem::Requirement
319
319
  none: false
320
320
  requirements:
@@ -323,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
323
323
  version: '0'
324
324
  segments:
325
325
  - 0
326
- hash: 500969557461387914
326
+ hash: -416918436862506067
327
327
  requirements: []
328
328
  rubyforge_project: websocket-rails
329
329
  rubygems_version: 1.8.23