cometd-rails 0.0.1

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.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +202 -0
  5. data/README.md +39 -0
  6. data/Rakefile +2 -0
  7. data/cometd-rails.gemspec +23 -0
  8. data/lib/cometd/rails/version.rb +5 -0
  9. data/lib/cometd/rails.rb +18 -0
  10. data/vendor/assets/javascripts/.DS_Store +0 -0
  11. data/vendor/assets/javascripts/cometd-dojox-rails.js +2 -0
  12. data/vendor/assets/javascripts/cometd-jquery-rails.js +2 -0
  13. data/vendor/assets/javascripts/common/.DS_Store +0 -0
  14. data/vendor/assets/javascripts/common/AckExtension.js +112 -0
  15. data/vendor/assets/javascripts/common/CallbackPollingTransport.js +166 -0
  16. data/vendor/assets/javascripts/common/CometD.js +2090 -0
  17. data/vendor/assets/javascripts/common/LongPollingTransport.js +111 -0
  18. data/vendor/assets/javascripts/common/ReloadExtension.js +254 -0
  19. data/vendor/assets/javascripts/common/RequestTransport.js +297 -0
  20. data/vendor/assets/javascripts/common/TimeStampExtension.js +42 -0
  21. data/vendor/assets/javascripts/common/TimeSyncExtension.js +216 -0
  22. data/vendor/assets/javascripts/common/Transport.js +142 -0
  23. data/vendor/assets/javascripts/common/TransportRegistry.js +116 -0
  24. data/vendor/assets/javascripts/common/Utils.js +58 -0
  25. data/vendor/assets/javascripts/common/WebSocketTransport.js +410 -0
  26. data/vendor/assets/javascripts/common/cometd-amd.js +7 -0
  27. data/vendor/assets/javascripts/common/cometd-header.js +15 -0
  28. data/vendor/assets/javascripts/common/cometd-json.js +5 -0
  29. data/vendor/assets/javascripts/common/cometd-namespace.js +3 -0
  30. data/vendor/assets/javascripts/common/cometd.require.js +16 -0
  31. data/vendor/assets/javascripts/dojox/.DS_Store +0 -0
  32. data/vendor/assets/javascripts/dojox/ack.js +22 -0
  33. data/vendor/assets/javascripts/dojox/dojox.require.js +5 -0
  34. data/vendor/assets/javascripts/dojox/main.js +95 -0
  35. data/vendor/assets/javascripts/dojox/reload.js +26 -0
  36. data/vendor/assets/javascripts/dojox/timestamp.js +22 -0
  37. data/vendor/assets/javascripts/dojox/timesync.js +22 -0
  38. data/vendor/assets/javascripts/jquery/.DS_Store +0 -0
  39. data/vendor/assets/javascripts/jquery/jquery.cometd-ack.js +33 -0
  40. data/vendor/assets/javascripts/jquery/jquery.cometd-reload.js +41 -0
  41. data/vendor/assets/javascripts/jquery/jquery.cometd-timestamp.js +33 -0
  42. data/vendor/assets/javascripts/jquery/jquery.cometd-timesync.js +33 -0
  43. data/vendor/assets/javascripts/jquery/jquery.cometd.js +140 -0
  44. data/vendor/assets/javascripts/jquery/jquery.cometd.require.js +5 -0
  45. metadata +115 -0
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright (c) 2008-2014 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ (function()
17
+ {
18
+ function bind(AckExtension, cometd)
19
+ {
20
+ var result = new AckExtension();
21
+ cometd.registerExtension('ack', result);
22
+ return result;
23
+ }
24
+
25
+ if (typeof define === 'function' && define.amd)
26
+ {
27
+ define(['org/cometd/AckExtension', 'jquery.cometd'], bind);
28
+ }
29
+ else
30
+ {
31
+ bind(org.cometd.AckExtension, jQuery.cometd);
32
+ }
33
+ })();
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Copyright (c) 2008-2014 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ (function()
17
+ {
18
+ function bind(org_cometd, cookie, ReloadExtension, cometd)
19
+ {
20
+ // Remap cometd COOKIE functions to jquery cookie functions
21
+ // Avoid to set to undefined if the jquery cookie plugin is not present
22
+ if (cookie)
23
+ {
24
+ org_cometd.COOKIE.set = cookie;
25
+ org_cometd.COOKIE.get = cookie;
26
+ }
27
+
28
+ var result = new ReloadExtension();
29
+ cometd.registerExtension('reload', result);
30
+ return result;
31
+ }
32
+
33
+ if (typeof define === 'function' && define.amd)
34
+ {
35
+ define(['org/cometd', 'jquery.cookie', 'org/cometd/ReloadExtension', 'jquery.cometd'], bind);
36
+ }
37
+ else
38
+ {
39
+ bind(org.cometd, jQuery.cookie, org.cometd.ReloadExtension, jQuery.cometd);
40
+ }
41
+ })();
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright (c) 2008-2014 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ (function()
17
+ {
18
+ function bind(TimeStampExtension, cometd)
19
+ {
20
+ var result = new TimeStampExtension();
21
+ cometd.registerExtension('timestamp', result);
22
+ return result;
23
+ }
24
+
25
+ if (typeof define === 'function' && define.amd)
26
+ {
27
+ define(['org/cometd/TimeStampExtension', 'jquery.cometd'], bind);
28
+ }
29
+ else
30
+ {
31
+ bind(org.cometd.TimeStampExtension, jQuery.cometd);
32
+ }
33
+ })();
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright (c) 2008-2014 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ (function()
17
+ {
18
+ function bind(TimeSyncExtension, cometd)
19
+ {
20
+ var result = new TimeSyncExtension();
21
+ cometd.registerExtension('timesync', result);
22
+ return result;
23
+ }
24
+
25
+ if (typeof define === 'function' && define.amd)
26
+ {
27
+ define(['org/cometd/TimeSyncExtension', 'jquery.cometd'], bind);
28
+ }
29
+ else
30
+ {
31
+ bind(org.cometd.TimeSyncExtension, jQuery.cometd);
32
+ }
33
+ })();
@@ -0,0 +1,140 @@
1
+ /*
2
+ * Copyright (c) 2008-2014 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ (function()
17
+ {
18
+ function bind($, org_cometd)
19
+ {
20
+ // Remap cometd JSON functions to jquery JSON functions.
21
+ org_cometd.JSON.toJSON = JSON.stringify;
22
+ org_cometd.JSON.fromJSON = JSON.parse;
23
+
24
+ function _setHeaders(xhr, headers)
25
+ {
26
+ if (headers)
27
+ {
28
+ for (var headerName in headers)
29
+ {
30
+ if (headerName.toLowerCase() === 'content-type')
31
+ {
32
+ continue;
33
+ }
34
+ xhr.setRequestHeader(headerName, headers[headerName]);
35
+ }
36
+ }
37
+ }
38
+
39
+ // Remap toolkit-specific transport calls.
40
+ function LongPollingTransport()
41
+ {
42
+ var _super = new org_cometd.LongPollingTransport();
43
+ var that = org_cometd.Transport.derive(_super);
44
+
45
+ that.xhrSend = function(packet)
46
+ {
47
+ return $.ajax({
48
+ url: packet.url,
49
+ async: packet.sync !== true,
50
+ type: 'POST',
51
+ contentType: 'application/json;charset=UTF-8',
52
+ data: packet.body,
53
+ global: false,
54
+ xhrFields: {
55
+ // For asynchronous calls.
56
+ withCredentials: true
57
+ },
58
+ beforeSend: function(xhr)
59
+ {
60
+ // For synchronous calls.
61
+ xhr.withCredentials = true;
62
+ _setHeaders(xhr, packet.headers);
63
+ // Returning false will abort the XHR send.
64
+ return true;
65
+ },
66
+ success: packet.onSuccess,
67
+ error: function(xhr, reason, exception)
68
+ {
69
+ packet.onError(reason, exception);
70
+ }
71
+ });
72
+ };
73
+
74
+ return that;
75
+ }
76
+
77
+ function CallbackPollingTransport()
78
+ {
79
+ var _super = new org_cometd.CallbackPollingTransport();
80
+ var that = org_cometd.Transport.derive(_super);
81
+
82
+ that.jsonpSend = function(packet)
83
+ {
84
+ $.ajax({
85
+ url: packet.url,
86
+ async: packet.sync !== true,
87
+ type: 'GET',
88
+ dataType: 'jsonp',
89
+ jsonp: 'jsonp',
90
+ data: {
91
+ // In callback-polling, the content must be sent via the 'message' parameter.
92
+ message: packet.body
93
+ },
94
+ beforeSend: function(xhr)
95
+ {
96
+ _setHeaders(xhr, packet.headers);
97
+ // Returning false will abort the XHR send.
98
+ return true;
99
+ },
100
+ success: packet.onSuccess,
101
+ error: function(xhr, reason, exception)
102
+ {
103
+ packet.onError(reason, exception);
104
+ }
105
+ });
106
+ };
107
+
108
+ return that;
109
+ }
110
+
111
+ $.CometD = function(name)
112
+ {
113
+ var cometd = new org_cometd.CometD(name);
114
+
115
+ // Registration order is important.
116
+ if (org_cometd.WebSocket)
117
+ {
118
+ cometd.registerTransport('websocket', new org_cometd.WebSocketTransport());
119
+ }
120
+ cometd.registerTransport('long-polling', new LongPollingTransport());
121
+ cometd.registerTransport('callback-polling', new CallbackPollingTransport());
122
+
123
+ return cometd;
124
+ };
125
+
126
+ // The default cometd instance.
127
+ $.cometd = new $.CometD();
128
+
129
+ return $.cometd;
130
+ }
131
+
132
+ if (typeof define === 'function' && define.amd)
133
+ {
134
+ define(['jquery', 'org/cometd'], bind);
135
+ }
136
+ else
137
+ {
138
+ bind(jQuery, org.cometd);
139
+ }
140
+ })();
@@ -0,0 +1,5 @@
1
+ //= require ./jquery.cometd
2
+ //= require ./jquery.cometd-ack
3
+ //= require ./jquery.cometd-reload
4
+ //= require ./jquery.cometd-timestamp
5
+ //= require ./jquery.cometd-timesync
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cometd-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Carlo Alberto Degli Atti
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: This package wraps the CometD js libraries into Rails
42
+ email:
43
+ - lordkada@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE
51
+ - README.md
52
+ - Rakefile
53
+ - cometd-rails.gemspec
54
+ - lib/cometd/rails.rb
55
+ - lib/cometd/rails/version.rb
56
+ - vendor/assets/javascripts/.DS_Store
57
+ - vendor/assets/javascripts/cometd-dojox-rails.js
58
+ - vendor/assets/javascripts/cometd-jquery-rails.js
59
+ - vendor/assets/javascripts/common/.DS_Store
60
+ - vendor/assets/javascripts/common/AckExtension.js
61
+ - vendor/assets/javascripts/common/CallbackPollingTransport.js
62
+ - vendor/assets/javascripts/common/CometD.js
63
+ - vendor/assets/javascripts/common/LongPollingTransport.js
64
+ - vendor/assets/javascripts/common/ReloadExtension.js
65
+ - vendor/assets/javascripts/common/RequestTransport.js
66
+ - vendor/assets/javascripts/common/TimeStampExtension.js
67
+ - vendor/assets/javascripts/common/TimeSyncExtension.js
68
+ - vendor/assets/javascripts/common/Transport.js
69
+ - vendor/assets/javascripts/common/TransportRegistry.js
70
+ - vendor/assets/javascripts/common/Utils.js
71
+ - vendor/assets/javascripts/common/WebSocketTransport.js
72
+ - vendor/assets/javascripts/common/cometd-amd.js
73
+ - vendor/assets/javascripts/common/cometd-header.js
74
+ - vendor/assets/javascripts/common/cometd-json.js
75
+ - vendor/assets/javascripts/common/cometd-namespace.js
76
+ - vendor/assets/javascripts/common/cometd.require.js
77
+ - vendor/assets/javascripts/dojox/.DS_Store
78
+ - vendor/assets/javascripts/dojox/ack.js
79
+ - vendor/assets/javascripts/dojox/dojox.require.js
80
+ - vendor/assets/javascripts/dojox/main.js
81
+ - vendor/assets/javascripts/dojox/reload.js
82
+ - vendor/assets/javascripts/dojox/timestamp.js
83
+ - vendor/assets/javascripts/dojox/timesync.js
84
+ - vendor/assets/javascripts/jquery/.DS_Store
85
+ - vendor/assets/javascripts/jquery/jquery.cometd-ack.js
86
+ - vendor/assets/javascripts/jquery/jquery.cometd-reload.js
87
+ - vendor/assets/javascripts/jquery/jquery.cometd-timestamp.js
88
+ - vendor/assets/javascripts/jquery/jquery.cometd-timesync.js
89
+ - vendor/assets/javascripts/jquery/jquery.cometd.js
90
+ - vendor/assets/javascripts/jquery/jquery.cometd.require.js
91
+ homepage: ''
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.2.2
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: CometD JS libraries for Rails
115
+ test_files: []