sinatra-websocketio 0.1.0 → 0.1.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.
- data/History.txt +4 -0
- data/lib/sinatra-websocketio/application.rb +1 -17
- data/lib/sinatra-websocketio/javascript.rb +16 -0
- data/lib/sinatra-websocketio/options.rb +8 -0
- data/lib/sinatra-websocketio/version.rb +1 -1
- data/lib/sinatra/websocketio.rb +1 -0
- data/sinatra-websocketio.gemspec +1 -1
- data/test/test_helper.rb +2 -1
- metadata +3 -2
data/History.txt
CHANGED
|
@@ -1,28 +1,12 @@
|
|
|
1
1
|
module Sinatra
|
|
2
2
|
module WebSocketIO
|
|
3
3
|
|
|
4
|
-
def websocketio=(options)
|
|
5
|
-
WebSocketIO.options = options
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def websocketio
|
|
9
|
-
WebSocketIO.options
|
|
10
|
-
end
|
|
11
|
-
|
|
12
4
|
def self.registered(app)
|
|
13
5
|
app.helpers Sinatra::WebSocketIO::Helpers
|
|
14
6
|
|
|
15
7
|
app.get '/websocketio/websocketio.js' do
|
|
16
8
|
content_type 'application/javascript'
|
|
17
|
-
@js ||= (
|
|
18
|
-
js = ''
|
|
19
|
-
Dir.glob(File.expand_path '../js/*.js', File.dirname(__FILE__)).each do |i|
|
|
20
|
-
File.open(i) do |f|
|
|
21
|
-
js += f.read
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
ERB.new(js).result(binding)
|
|
25
|
-
)
|
|
9
|
+
@js ||= ERB.new(Sinatra::WebSocketIO.javascript).result(binding)
|
|
26
10
|
end
|
|
27
11
|
end
|
|
28
12
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Sinatra
|
|
2
|
+
module WebSocketIO
|
|
3
|
+
|
|
4
|
+
def self.javascript(*js_file_names)
|
|
5
|
+
js_file_names = ['websocketio.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/websocketio.rb
CHANGED
|
@@ -8,6 +8,7 @@ require File.expand_path '../sinatra-websocketio/version', File.dirname(__FILE__
|
|
|
8
8
|
require File.expand_path '../sinatra-websocketio/helpers', File.dirname(__FILE__)
|
|
9
9
|
require File.expand_path '../sinatra-websocketio/options', File.dirname(__FILE__)
|
|
10
10
|
require File.expand_path '../sinatra-websocketio/websocketio', File.dirname(__FILE__)
|
|
11
|
+
require File.expand_path '../sinatra-websocketio/javascript', File.dirname(__FILE__)
|
|
11
12
|
require File.expand_path '../sinatra-websocketio/application', File.dirname(__FILE__)
|
|
12
13
|
|
|
13
14
|
module Sinatra
|
data/sinatra-websocketio.gemspec
CHANGED
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
|
|
|
9
9
|
gem.email = ["hashimoto@shokai.org"]
|
|
10
10
|
gem.description = %q{Node.js like WebSocket I/O plugin for Sinatra.}
|
|
11
11
|
gem.summary = gem.description
|
|
12
|
-
gem.homepage = "
|
|
12
|
+
gem.homepage = "http://shokai.github.com/sinatra-websocketio"
|
|
13
13
|
|
|
14
14
|
gem.files = `git ls-files`.split($/).reject{|i| i=="Gemfile.lock" }
|
|
15
15
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/test/test_helper.rb
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
|
|
2
4
|
require 'minitest/autorun'
|
|
3
5
|
require 'em-websocketio-client'
|
|
4
6
|
require File.expand_path 'app', File.dirname(__FILE__)
|
|
5
7
|
|
|
6
|
-
$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
|
|
7
8
|
|
|
8
9
|
['SIGHUP', 'SIGINT', 'SIGKILL', 'SIGTERM'].each do |sig|
|
|
9
10
|
Kernel.trap sig do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sinatra-websocketio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -159,6 +159,7 @@ files:
|
|
|
159
159
|
- lib/sinatra-websocketio.rb
|
|
160
160
|
- lib/sinatra-websocketio/application.rb
|
|
161
161
|
- lib/sinatra-websocketio/helpers.rb
|
|
162
|
+
- lib/sinatra-websocketio/javascript.rb
|
|
162
163
|
- lib/sinatra-websocketio/options.rb
|
|
163
164
|
- lib/sinatra-websocketio/version.rb
|
|
164
165
|
- lib/sinatra-websocketio/websocketio.rb
|
|
@@ -179,7 +180,7 @@ files:
|
|
|
179
180
|
- test/app/main.rb
|
|
180
181
|
- test/test_helper.rb
|
|
181
182
|
- test/test_websocketio.rb
|
|
182
|
-
homepage:
|
|
183
|
+
homepage: http://shokai.github.com/sinatra-websocketio
|
|
183
184
|
licenses: []
|
|
184
185
|
post_install_message:
|
|
185
186
|
rdoc_options: []
|