pusher-fake 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f413e0d2160087979e4a64e2992838e859af116c
4
- data.tar.gz: e5934708af8aeb405202c768e279efe6bfdd7745
3
+ metadata.gz: 62beea93e9ce28262adbb1c518dc08339653a1ab
4
+ data.tar.gz: eb3e058b54e30f0c5c0bf16ec34997e20a1d279d
5
5
  SHA512:
6
- metadata.gz: 708cb5fb273ee79db74468d93b1db7bfdf0e2aa66862f202c66bf7157a7a2edee3d92566d07e79f8fda057cbcb8b31228bc27a1893216b272917f3360ca9df62
7
- data.tar.gz: b7985a06e57aacc32c9900fb450853b1e351678c80e2751d05ebfed8fe788ab0a2012d152dd87e11751355658dc58e3b356f329818c603b7a39308bde322c7b6
6
+ metadata.gz: f4f120392332c62301f21506c155e339bedf2ef35ee9dc9a301f9ee020332d72e51d8281b4a036a8e026d77e9d4a6c5b15b414085ba10a96fe9bce00d5af3856
7
+ data.tar.gz: cc290d61c303374212512c59570f1e2b4d469b92343fb0bfc804b4e754bf35ccccba9cb819f7276cd474b26ab581e3fa925a3e7f75ed2d03f2442d6b92056995
@@ -6,7 +6,7 @@ require "thin"
6
6
 
7
7
  module PusherFake
8
8
  # The current version string.
9
- VERSION = "1.4.0"
9
+ VERSION = "1.5.0"
10
10
 
11
11
  autoload :Channel, "pusher-fake/channel"
12
12
  autoload :Configuration, "pusher-fake/configuration"
@@ -30,6 +30,10 @@ module PusherFake
30
30
 
31
31
  # Instantiated from {PusherFake.configuration}. Sets the defaults.
32
32
  def initialize
33
+ reset!
34
+ end
35
+
36
+ def reset!
33
37
  self.app_id = "PUSHER_APP_ID"
34
38
  self.key = "PUSHER_API_KEY"
35
39
  self.logger = STDOUT.to_io
@@ -47,8 +51,7 @@ module PusherFake
47
51
  def to_options(options = {})
48
52
  options.merge(
49
53
  wsHost: socket_options[:host],
50
- wsPort: socket_options[:port],
51
- enabledTransports: ["ws"]
54
+ wsPort: socket_options[:port]
52
55
  )
53
56
  end
54
57
 
@@ -1,3 +1,15 @@
1
+ if Pusher.app_id.nil?
2
+ warn("Warning: `Pusher.app_id` is not set. Should be set before including PusherFake.")
3
+ end
4
+
5
+ if Pusher.key.nil?
6
+ warn("Warning: `Pusher.key` is not set. Should be set before including PusherFake.")
7
+ end
8
+
9
+ if Pusher.secret.nil?
10
+ warn("Warning: `Pusher.secret` is not set. Should be set before including PusherFake.")
11
+ end
12
+
1
13
  # Use the same API key and secret as the live version.
2
14
  PusherFake.configure do |configuration|
3
15
  configuration.app_id = Pusher.app_id
@@ -38,12 +38,6 @@ describe PusherFake::Configuration, "#to_options" do
38
38
  expect(options).to include(wsPort: subject.socket_options[:port])
39
39
  end
40
40
 
41
- it "only enables the WebSocket transport" do
42
- options = subject.to_options
43
-
44
- expect(options).to include(enabledTransports: ["ws"])
45
- end
46
-
47
41
  it "supports passing custom options" do
48
42
  options = subject.to_options(custom: "option")
49
43
 
@@ -1,11 +1,39 @@
1
1
  /*!
2
- * Pusher JavaScript Library v2.2.4
2
+ * Pusher JavaScript Library v3.0.0
3
3
  * http://pusher.com/
4
4
  *
5
5
  * Copyright 2014, Pusher
6
6
  * Released under the MIT licence.
7
7
  */
8
8
 
9
+ // Uses Node, AMD or browser globals to create a module. This example creates
10
+ // a global even when AMD is used. This is useful if you have some scripts
11
+ // that are loaded by an AMD loader, but they still want access to globals.
12
+ // If you do not need to export a global for the AMD case,
13
+ // see returnExports.js.
14
+
15
+ // If you want something that will work in other stricter CommonJS environments,
16
+ // or if you need to create a circular dependency, see commonJsStrictGlobal.js
17
+
18
+ // Defines a module "Pusher".
19
+
20
+ (function (root, factory) {
21
+ if (typeof define === 'function' && define.amd) {
22
+ // AMD. Register as an anonymous module.
23
+ define([], function () {
24
+ return (root.Pusher = factory());
25
+ });
26
+ } else if (typeof exports === 'object') {
27
+ // Node. Does not work with strict CommonJS, but
28
+ // only CommonJS-like enviroments that support module.exports,
29
+ // like Node.
30
+ module.exports = factory();
31
+ } else {
32
+ // Browser globals
33
+ root.Pusher = factory();
34
+ }
35
+ }(this, function () {
36
+
9
37
  ;(function() {
10
38
  function Pusher(app_key, options) {
11
39
  checkAppKey(app_key);
@@ -74,7 +102,7 @@
74
102
  channel.handleEvent(params.event, params.data);
75
103
  }
76
104
  }
77
- // Emit globaly [deprecated]
105
+ // Emit globally [deprecated]
78
106
  if (!internal) {
79
107
  self.global_emitter.emit(params.event, params.data);
80
108
  }
@@ -188,7 +216,7 @@
188
216
 
189
217
  prototype.unsubscribe = function(channel_name) {
190
218
  var channel = this.channels.remove(channel_name);
191
- if (this.connection.state === 'connected') {
219
+ if (channel && this.connection.state === 'connected') {
192
220
  channel.unsubscribe();
193
221
  }
194
222
  };
@@ -573,10 +601,6 @@
573
601
  return document;
574
602
  },
575
603
 
576
- getNavigator: function() {
577
- return navigator;
578
- },
579
-
580
604
  getLocalStorage: function() {
581
605
  try {
582
606
  return window.localStorage;
@@ -588,7 +612,7 @@
588
612
  getClientFeatures: function() {
589
613
  return Pusher.Util.keys(
590
614
  Pusher.Util.filterObject(
591
- { "ws": Pusher.WSTransport, "flash": Pusher.FlashTransport },
615
+ { "ws": Pusher.WSTransport },
592
616
  function (t) { return t.isSupported({}); }
593
617
  )
594
618
  );
@@ -626,7 +650,7 @@
626
650
  }).call(this);
627
651
 
628
652
  ;(function() {
629
- Pusher.VERSION = '2.2.4';
653
+ Pusher.VERSION = '3.0.0';
630
654
  Pusher.PROTOCOL = 7;
631
655
 
632
656
  // DEPRECATED: WS connection parameters
@@ -700,7 +724,6 @@
700
724
 
701
725
  [":def_transport", "ws", "ws", 3, ":ws_options", ":ws_manager"],
702
726
  [":def_transport", "wss", "ws", 3, ":wss_options", ":ws_manager"],
703
- [":def_transport", "flash", "flash", 2, ":ws_options", ":ws_manager"],
704
727
  [":def_transport", "sockjs", "sockjs", 1, ":sockjs_options"],
705
728
  [":def_transport", "xhr_streaming", "xhr_streaming", 1, ":sockjs_options", ":streaming_manager"],
706
729
  [":def_transport", "xdr_streaming", "xdr_streaming", 1, ":sockjs_options", ":streaming_manager"],
@@ -709,7 +732,6 @@
709
732
 
710
733
  [":def", "ws_loop", [":sequential", ":timeouts", ":ws"]],
711
734
  [":def", "wss_loop", [":sequential", ":timeouts", ":wss"]],
712
- [":def", "flash_loop", [":sequential", ":timeouts", ":flash"]],
713
735
  [":def", "sockjs_loop", [":sequential", ":timeouts", ":sockjs"]],
714
736
 
715
737
  [":def", "streaming_loop", [":sequential", ":timeouts",
@@ -746,13 +768,8 @@
746
768
  [":first_connected",
747
769
  [":if", [":is_supported", ":ws"],
748
770
  wsStrategy,
749
- [":if", [":is_supported", ":flash"], [
750
- ":best_connected_ever",
751
- ":flash_loop",
752
- [":delayed", 2000, [":http_fallback_loop"]]
753
- ], [
754
771
  ":http_fallback_loop"
755
- ]]]
772
+ ]
756
773
  ]
757
774
  ]
758
775
  ]
@@ -1980,12 +1997,6 @@
1980
1997
  return getGenericURL("ws", params, getGenericPath(key, "flash=false"));
1981
1998
  }
1982
1999
  },
1983
- /** URL scheme for Flash. Same as WebSocket, but with a flash parameter. */
1984
- flash: {
1985
- getInitial: function(key, params) {
1986
- return getGenericURL("ws", params, getGenericPath(key, "flash=true"));
1987
- }
1988
- },
1989
2000
  /** SockJS URL scheme. Supplies the path separately from the initial URL. */
1990
2001
  sockjs: {
1991
2002
  getInitial: function(key, params) {
@@ -2078,10 +2089,6 @@
2078
2089
  transport: self.name + (self.options.encrypted ? "s" : "")
2079
2090
  }));
2080
2091
 
2081
- if (self.hooks.beforeInitialize) {
2082
- self.hooks.beforeInitialize.call(self);
2083
- }
2084
-
2085
2092
  if (self.hooks.isInitialized()) {
2086
2093
  self.changeState("initialized");
2087
2094
  } else if (self.hooks.file) {
@@ -2344,45 +2351,6 @@
2344
2351
  }
2345
2352
  });
2346
2353
 
2347
- /** Flash transport using the WebSocket protocol. */
2348
- Pusher.FlashTransport = new Pusher.Transport({
2349
- file: "flashfallback",
2350
- urls: Pusher.URLSchemes.flash,
2351
- handlesActivityChecks: false,
2352
- supportsPing: false,
2353
-
2354
- isSupported: function() {
2355
- try {
2356
- return Boolean(new ActiveXObject('ShockwaveFlash.ShockwaveFlash'));
2357
- } catch (e1) {
2358
- try {
2359
- var nav = Pusher.Util.getNavigator();
2360
- return Boolean(
2361
- nav &&
2362
- nav.mimeTypes &&
2363
- nav.mimeTypes["application/x-shockwave-flash"] !== undefined
2364
- );
2365
- } catch (e2) {
2366
- return false;
2367
- }
2368
- }
2369
- },
2370
- beforeInitialize: function() {
2371
- if (window.WEB_SOCKET_SUPPRESS_CROSS_DOMAIN_SWF_ERROR === undefined) {
2372
- window.WEB_SOCKET_SUPPRESS_CROSS_DOMAIN_SWF_ERROR = true;
2373
- }
2374
- window.WEB_SOCKET_SWF_LOCATION =
2375
- Pusher.Dependencies.getRoot({ encrypted: this.options.encrypted }) +
2376
- "/WebSocketMain.swf";
2377
- },
2378
- isInitialized: function() {
2379
- return window.FlashWebSocket !== undefined;
2380
- },
2381
- getSocket: function(url) {
2382
- return new FlashWebSocket(url);
2383
- }
2384
- });
2385
-
2386
2354
  /** SockJS transport. */
2387
2355
  Pusher.SockJSTransport = new Pusher.Transport({
2388
2356
  file: "sockjs",
@@ -2609,7 +2577,6 @@
2609
2577
 
2610
2578
  var transports = {
2611
2579
  ws: Pusher.WSTransport,
2612
- flash: Pusher.FlashTransport,
2613
2580
  sockjs: Pusher.SockJSTransport,
2614
2581
  xhr_streaming: Pusher.XHRStreamingTransport,
2615
2582
  xdr_streaming: Pusher.XDRStreamingTransport,
@@ -2665,8 +2632,7 @@
2665
2632
  (!context.enabledTransports ||
2666
2633
  Pusher.Util.arrayIndexOf(context.enabledTransports, name) !== -1) &&
2667
2634
  (!context.disabledTransports ||
2668
- Pusher.Util.arrayIndexOf(context.disabledTransports, name) === -1) &&
2669
- (name !== "flash" || context.disableFlash !== true);
2635
+ Pusher.Util.arrayIndexOf(context.disabledTransports, name) === -1);
2670
2636
 
2671
2637
  var transport;
2672
2638
  if (enabled) {
@@ -4013,3 +3979,6 @@
4013
3979
  }
4014
3980
  };
4015
3981
  }).call(this);
3982
+
3983
+ return Pusher;
3984
+ }));
@@ -13,7 +13,7 @@
13
13
  <ul></ul>
14
14
  </section>
15
15
 
16
- <script src="/javascripts/vendor/pusher-2.2.4.js"></script>
16
+ <script src="/javascripts/vendor/pusher-3.0.0.js"></script>
17
17
  <script>
18
18
  Pusher.instance = <%= PusherFake.javascript %>;
19
19
  Pusher.instance.connection.bind("state_change", function(states) {
@@ -3,8 +3,6 @@ require "capybara/rspec"
3
3
  Capybara.app = Sinatra::Application
4
4
  Capybara.default_driver = :webkit
5
5
 
6
- Capybara.register_driver(:webkit) do |application|
7
- Capybara::Webkit::Driver.new(application).tap do |driver|
8
- driver.block_unknown_urls
9
- end
6
+ Capybara::Webkit.configure do |config|
7
+ config.block_unknown_urls
10
8
  end
@@ -1,5 +1,8 @@
1
+ require "thin/server"
2
+
1
3
  RSpec.configure do |config|
2
4
  config.before(:each, type: :feature) do
5
+ PusherFake.configuration.reset!
3
6
  PusherFake.configuration.web_options.tap do |options|
4
7
  Pusher.url = "http://PUSHER_API_KEY:PUSHER_API_SECRET@#{options[:host]}:#{options[:port]}/apps/PUSHER_APP_ID"
5
8
  end
@@ -1,9 +1,3 @@
1
- RSpec.configure do |config|
2
- config.before(:each) do
3
- $events = []
4
- end
5
- end
6
-
7
1
  Thread.new do
8
2
  # Not explicitly requiring Thin::Server occasionally results in
9
3
  # Thin::Server.start not being defined.
@@ -31,4 +25,10 @@ end.tap do |thread|
31
25
  at_exit { thread.exit }
32
26
  end
33
27
 
34
- PusherFake.configuration.webhooks = ["http://127.0.0.1:8082"]
28
+ RSpec.configure do |config|
29
+ config.before(:each) do
30
+ $events = []
31
+
32
+ PusherFake.configuration.webhooks = ["http://127.0.0.1:8082"]
33
+ end
34
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pusher-fake
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Dunn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-20 00:00:00.000000000 Z
11
+ date: 2016-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: em-http-request
@@ -72,70 +72,70 @@ dependencies:
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 1.5.1
75
+ version: 1.8.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 1.5.1
82
+ version: 1.8.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pusher
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 0.14.5
89
+ version: 0.16.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 0.14.5
96
+ version: 0.16.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 10.4.2
103
+ version: 10.5.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 10.4.2
110
+ version: 10.5.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 3.2.0
117
+ version: 3.4.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 3.2.0
124
+ version: 3.4.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: sinatra
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 1.4.6
131
+ version: 1.4.7
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 1.4.6
138
+ version: 1.4.7
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: yard
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -190,7 +190,7 @@ files:
190
190
  - spec/lib/pusher_fake_spec.rb
191
191
  - spec/spec_helper.rb
192
192
  - spec/support/application.rb
193
- - spec/support/application/public/javascripts/vendor/pusher-2.2.4.js
193
+ - spec/support/application/public/javascripts/vendor/pusher-3.0.0.js
194
194
  - spec/support/application/views/index.erb
195
195
  - spec/support/capybara.rb
196
196
  - spec/support/coveralls.rb
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  version: '0'
222
222
  requirements: []
223
223
  rubyforge_project:
224
- rubygems_version: 2.2.2
224
+ rubygems_version: 2.4.5.1
225
225
  signing_key:
226
226
  specification_version: 4
227
227
  summary: A fake Pusher server for development and testing.
@@ -245,7 +245,7 @@ test_files:
245
245
  - spec/lib/pusher-fake/webhook_spec.rb
246
246
  - spec/lib/pusher_fake_spec.rb
247
247
  - spec/spec_helper.rb
248
- - spec/support/application/public/javascripts/vendor/pusher-2.2.4.js
248
+ - spec/support/application/public/javascripts/vendor/pusher-3.0.0.js
249
249
  - spec/support/application/views/index.erb
250
250
  - spec/support/application.rb
251
251
  - spec/support/capybara.rb