sinatra-cometio 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/sinatra-cometio/application.rb +1 -17
- data/lib/sinatra-cometio/javascript.rb +16 -0
- data/lib/sinatra-cometio/options.rb +8 -0
- data/lib/sinatra-cometio/version.rb +1 -1
- data/lib/sinatra/cometio.rb +1 -0
- data/sample/Gemfile.lock +1 -1
- data/test/test_helper.rb +1 -0
- metadata +2 -1
data/History.txt
CHANGED
@@ -1,29 +1,13 @@
|
|
1
1
|
module Sinatra
|
2
2
|
module CometIO
|
3
3
|
|
4
|
-
def cometio=(options)
|
5
|
-
CometIO.options = options
|
6
|
-
end
|
7
|
-
|
8
|
-
def cometio
|
9
|
-
CometIO.options
|
10
|
-
end
|
11
|
-
|
12
4
|
def self.registered(app)
|
13
5
|
app.helpers Sinatra::Streaming
|
14
6
|
app.helpers Sinatra::CometIO::Helpers
|
15
7
|
|
16
8
|
app.get '/cometio/cometio.js' do
|
17
9
|
content_type 'application/javascript'
|
18
|
-
@js ||= (
|
19
|
-
js = ''
|
20
|
-
Dir.glob(File.expand_path '../js/*.js', File.dirname(__FILE__)).sort.each do |i|
|
21
|
-
File.open(i) do |f|
|
22
|
-
js += f.read
|
23
|
-
end
|
24
|
-
end
|
25
|
-
ERB.new(js).result(binding)
|
26
|
-
)
|
10
|
+
@js ||= ERB.new(Sinatra::CometIO.javascript).result(binding)
|
27
11
|
end
|
28
12
|
|
29
13
|
app.get '/cometio/io' do
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Sinatra
|
2
|
+
module CometIO
|
3
|
+
|
4
|
+
def self.javascript(*js_file_names)
|
5
|
+
js_file_names = ['cometio.js', 'event_emitter.js'] if js_file_names.empty?
|
6
|
+
js = ''
|
7
|
+
js_file_names.each do |i|
|
8
|
+
File.open(File.expand_path "../js/#{i}", File.dirname(__FILE__)) do |f|
|
9
|
+
js += f.read
|
10
|
+
end
|
11
|
+
end
|
12
|
+
js
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
data/lib/sinatra/cometio.rb
CHANGED
@@ -7,6 +7,7 @@ require File.expand_path '../sinatra-cometio/version', File.dirname(__FILE__)
|
|
7
7
|
require File.expand_path '../sinatra-cometio/helpers', File.dirname(__FILE__)
|
8
8
|
require File.expand_path '../sinatra-cometio/options', File.dirname(__FILE__)
|
9
9
|
require File.expand_path '../sinatra-cometio/cometio', File.dirname(__FILE__)
|
10
|
+
require File.expand_path '../sinatra-cometio/javascript', File.dirname(__FILE__)
|
10
11
|
require File.expand_path '../sinatra-cometio/application', File.dirname(__FILE__)
|
11
12
|
|
12
13
|
module Sinatra
|
data/sample/Gemfile.lock
CHANGED
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-cometio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/sinatra-cometio/application.rb
|
143
143
|
- lib/sinatra-cometio/cometio.rb
|
144
144
|
- lib/sinatra-cometio/helpers.rb
|
145
|
+
- lib/sinatra-cometio/javascript.rb
|
145
146
|
- lib/sinatra-cometio/options.rb
|
146
147
|
- lib/sinatra-cometio/version.rb
|
147
148
|
- lib/sinatra/cometio.rb
|