sse-rails-engine 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0411f6e00ac35a1bb1dd364030fe70e7c76594e4
4
- data.tar.gz: 328d7581ef610647abb1897f12e3d3a19cb62c3f
3
+ metadata.gz: 7793cd5c317e56e1d7ba0099d48b4ffbaf401166
4
+ data.tar.gz: bd04618ad62d2cf1645ad6dcb39832abde4ebb2f
5
5
  SHA512:
6
- metadata.gz: f47bb352417ed48af36bf1b10faf89fcf7b89c0d375d3551d4924f8af24b8cdd4af69692edca030f3f9fc6d9bd8b7f21084c22db546ad57251ca9e5f4765ebf8
7
- data.tar.gz: ed05f3ecdcf8438fe28a368e00b6a03e95f6cb5b1d4ae9a4712ae6c11da10cd7f354f2ad74b1466df1ff6e55e167628a4970d5627b5ce384b7eac8f9d2103a01
6
+ metadata.gz: 3a88b9a69c47446be9b73ae4e1f8944a8a7ee487f92c899a5e2b3842beb7020407b3379e24f871b434f57bf51cc3fa1df51a03c478c7dfbb14395cfe55823eb5
7
+ data.tar.gz: aaf940645b4345b30c6ca584c937301101d4bba6caa55256a29919bb048e2a5fed1a0c88740558a34643f7e7f5881c7ab8d2a6ff63af06971cf6a627f0226358
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  begin
2
4
  require 'bundler/setup'
3
5
  rescue LoadError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  headers = [
2
4
  'HTTP/1.1 200 OK',
3
5
  'Content-Type: text/event-stream',
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rack/lock'
2
4
  Rails.configuration.middleware.delete Rack::Lock
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  SseRailsEngine::Engine.routes.draw do
2
4
  root to: SseRailsEngine.manager
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'sse_rails_engine/engine'
2
4
  require 'sse_rails_engine/connection'
3
5
  require 'sse_rails_engine/manager'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SseRailsEngine
2
4
  class Connection
3
5
  attr_accessor :stream, :channels
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SseRailsEngine
2
4
  class Engine < ::Rails::Engine
3
5
  isolate_namespace SseRailsEngine
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SseRailsEngine
2
4
  # This class provides the ability to track SSE connections and broadcast events
3
5
  # to all connected clients from anywhere in your Rails app.
@@ -32,7 +34,7 @@ module SseRailsEngine
32
34
  # Perform full hijack of socket (http://old.blog.phusion.nl/2013/01/23/the-new-rack-socket-hijacking-api/)
33
35
  open_connection(socket, env)
34
36
  else
35
- fail RackHijackUnsupported, 'This Rack server does not support hijacking, ensure you are using >= v1.5 of Rack'
37
+ raise RackHijackUnsupported, 'This Rack server does not support hijacking, ensure you are using >= v1.5 of Rack'
36
38
  end
37
39
  end
38
40
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SseRailsEngine
2
- VERSION = '1.5.0'
4
+ VERSION = '1.6.0'
3
5
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # desc "Explaining what the task does"
2
3
  # task :sse_rails_engine do
3
4
  # # Task goes here
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../test_helper'
2
4
 
3
5
  describe SseRailsEngine do
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../../test_helper'
2
4
 
3
5
  describe SseRailsEngine::Manager do
4
6
  let(:manager) { SseRailsEngine.manager }
5
- let(:env1) { Hashie::Mash.new('rack.hijack?' => true, 'rack.hijack' => ->() {}, 'rack.hijack_io' => StringIO.new) }
6
- let(:env2) { Hashie::Mash.new('rack.hijack?' => true, 'rack.hijack' => ->() {}, 'rack.hijack_io' => StringIO.new) }
7
+ let(:env1) { { 'rack.hijack?' => true, 'rack.hijack' => ->() {}, 'rack.hijack_io' => StringIO.new } }
8
+ let(:env2) { { 'rack.hijack?' => true, 'rack.hijack' => ->() {}, 'rack.hijack_io' => StringIO.new } }
7
9
 
8
10
  before do
9
11
  SseRailsEngine.instance_variable_set(:@manager, nil)
@@ -75,7 +77,8 @@ describe SseRailsEngine::Manager do
75
77
  manager.register(env1)
76
78
  manager.send_event('foo')
77
79
  env1['rack.hijack_io'].string.must_equal(
78
- SseRailsEngine::Connection.sse_header + "event: foo\ndata: \n\n", 'env1 should have received event')
80
+ SseRailsEngine::Connection.sse_header + "event: foo\ndata: \n\n", 'env1 should have received event'
81
+ )
79
82
  end
80
83
 
81
84
  it 'does not send events to clients that didnt register for them' do
@@ -83,7 +86,8 @@ describe SseRailsEngine::Manager do
83
86
  manager.register(env1)
84
87
  manager.send_event('test')
85
88
  env1['rack.hijack_io'].string.must_equal(
86
- SseRailsEngine::Connection.sse_header, 'env2 should not have received event')
89
+ SseRailsEngine::Connection.sse_header, 'env2 should not have received event'
90
+ )
87
91
  end
88
92
 
89
93
  it 'filters msgs depending on channels requested' do
@@ -92,8 +96,10 @@ describe SseRailsEngine::Manager do
92
96
  manager.register(env2)
93
97
  manager.send_event('test')
94
98
  env1['rack.hijack_io'].string.must_equal(
95
- SseRailsEngine::Connection.sse_header + "event: test\ndata: \n\n", 'env1 should have received event')
99
+ SseRailsEngine::Connection.sse_header + "event: test\ndata: \n\n", 'env1 should have received event'
100
+ )
96
101
  env2['rack.hijack_io'].string.must_equal(
97
- SseRailsEngine::Connection.sse_header, 'env2 should not have received event')
102
+ SseRailsEngine::Connection.sse_header, 'env2 should not have received event'
103
+ )
98
104
  end
99
105
  end
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Configure Rails Environment
2
4
  ENV['RAILS_ENV'] = 'test'
3
5
 
6
+ require 'bundler/setup'
4
7
  require 'codeclimate-test-reporter'
5
8
  CodeClimate::TestReporter.start if ENV['CODECLIMATE_REPO_TOKEN']
6
9
 
7
- require File.expand_path('../../test/dummy/config/environment.rb', __FILE__)
10
+ require File.expand_path('../../test/dummy/config/environment.rb', __FILE__)
8
11
  require 'rails/test_help'
9
12
  require 'minitest/rails'
10
13
  require 'mocha/mini_test'
11
- require 'hashie'
12
14
 
13
15
  # Filter out Minitest backtrace while allowing backtrace from other libraries
14
16
  # to be shown.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sse-rails-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Hender
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-16 00:00:00.000000000 Z
11
+ date: 2017-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,34 +16,34 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: 4.2.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.1'
22
+ version: '5.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '4.0'
29
+ version: 4.2.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.1'
32
+ version: '5.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: minitest-rails
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '2.0'
39
+ version: '3.0'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '2.0'
46
+ version: '3.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: mocha
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -72,34 +72,20 @@ dependencies:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
- - !ruby/object:Gem::Dependency
76
- name: hashie
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '3.0'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '3.0'
89
75
  - !ruby/object:Gem::Dependency
90
76
  name: codeclimate-test-reporter
91
77
  requirement: !ruby/object:Gem::Requirement
92
78
  requirements:
93
79
  - - "~>"
94
80
  - !ruby/object:Gem::Version
95
- version: '0'
81
+ version: '0.0'
96
82
  type: :development
97
83
  prerelease: false
98
84
  version_requirements: !ruby/object:Gem::Requirement
99
85
  requirements:
100
86
  - - "~>"
101
87
  - !ruby/object:Gem::Version
102
- version: '0'
88
+ version: '0.0'
103
89
  - !ruby/object:Gem::Dependency
104
90
  name: rubocop
105
91
  requirement: !ruby/object:Gem::Requirement
@@ -187,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
173
  version: '0'
188
174
  requirements: []
189
175
  rubyforge_project:
190
- rubygems_version: 2.4.5
176
+ rubygems_version: 2.5.2
191
177
  signing_key:
192
178
  specification_version: 4
193
179
  summary: Provides SSE connection tracking and broadcasting of events from anywhere