sinatra-cometio 0.5.9 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/README.md +7 -2
- data/Rakefile +6 -0
- data/lib/sinatra-cometio/version.rb +1 -1
- data/sinatra-cometio.gemspec +1 -0
- data/test/app.rb +7 -34
- data/test/app/main.rb +0 -5
- data/test/test_cometio.rb +0 -8
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4c765b3c03f7d0d9f4119ee6eaeca36412039e1
|
4
|
+
data.tar.gz: c796d5fbfba6045eb227f2c1c5e57aadc79b28d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1497b9122f45e9ce82e494c321411249d76102403ea46ce4ef7c1ddb068121f4e757a4a5ef470072e4e7a205b234a8c0996a2120b68f8971b6588c2aa4bb8365
|
7
|
+
data.tar.gz: 0e3d08e27a8d18fcbe380e8bad85d88105b3ee39c3540a7f41a321a6e1888c167766f2af9cfaca23545d4d4da4a909b70cd0e41896bc47b0fdb9b40b4aaa0816
|
data/History.txt
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/sinatra-cometio.gemspec
CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.description = %q{Comet component for Sinatra RocketIO}
|
11
11
|
gem.summary = gem.description
|
12
12
|
gem.homepage = "https://github.com/shokai/sinatra-cometio"
|
13
|
+
gem.license = "MIT"
|
13
14
|
|
14
15
|
gem.files = `git ls-files`.split($/).reject{|i| i=="Gemfile.lock" }
|
15
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/test/app.rb
CHANGED
@@ -8,50 +8,23 @@ class App
|
|
8
8
|
ENV['PORT'] || 5000
|
9
9
|
end
|
10
10
|
|
11
|
-
def self.
|
12
|
-
"http://localhost:#{port}
|
11
|
+
def self.url
|
12
|
+
"http://localhost:#{port}"
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.
|
16
|
-
|
15
|
+
def self.cometio_url
|
16
|
+
"http://localhost:#{port}/cometio/io"
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.app_dir
|
20
20
|
File.expand_path 'app', File.dirname(__FILE__)
|
21
21
|
end
|
22
22
|
|
23
|
-
def self.pid
|
24
|
-
return unless @running
|
25
|
-
File.open(pid_file) do |f|
|
26
|
-
pid = f.gets.strip.to_i
|
27
|
-
return pid if pid > 0
|
28
|
-
end
|
29
|
-
return
|
30
|
-
end
|
31
|
-
|
32
23
|
def self.start
|
33
|
-
return if
|
34
|
-
File.delete pid_file if File.exists? pid_file
|
35
|
-
Thread.new do
|
36
|
-
IO::popen "cd #{app_dir} && PID_FILE=#{pid_file} rackup config.ru -p #{port} > /dev/null 2>&1"
|
37
|
-
end
|
24
|
+
return if running
|
38
25
|
@running = true
|
39
|
-
|
40
|
-
|
41
|
-
sleep 0.1
|
42
|
-
return true
|
43
|
-
end
|
44
|
-
sleep 1
|
45
|
-
end
|
46
|
-
@running = false
|
47
|
-
return false
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.stop
|
51
|
-
return unless @running
|
52
|
-
system "kill #{pid}"
|
53
|
-
File.delete pid_file if File.exists? pid_file
|
54
|
-
@running = false
|
26
|
+
cmd = "cd #{app_dir} && bundle exec rackup config.ru -p #{port}"
|
27
|
+
system cmd
|
55
28
|
end
|
56
29
|
|
57
30
|
end
|
data/test/app/main.rb
CHANGED
data/test/test_cometio.rb
CHANGED
@@ -2,14 +2,6 @@ require File.expand_path 'test_helper', File.dirname(__FILE__)
|
|
2
2
|
|
3
3
|
class TestCometio < MiniTest::Test
|
4
4
|
|
5
|
-
def setup
|
6
|
-
App.start
|
7
|
-
end
|
8
|
-
|
9
|
-
def teardown
|
10
|
-
App.stop
|
11
|
-
end
|
12
|
-
|
13
5
|
def test_simple
|
14
6
|
client = Sinatra::CometIO::Client.new(App.cometio_url).connect
|
15
7
|
post_data = {:time => Time.now.to_s, :msg => 'hello!!'}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-cometio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Hashimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -217,7 +217,8 @@ files:
|
|
217
217
|
- test/test_cometio.rb
|
218
218
|
- test/test_helper.rb
|
219
219
|
homepage: https://github.com/shokai/sinatra-cometio
|
220
|
-
licenses:
|
220
|
+
licenses:
|
221
|
+
- MIT
|
221
222
|
metadata: {}
|
222
223
|
post_install_message:
|
223
224
|
rdoc_options: []
|
@@ -235,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
236
|
version: '0'
|
236
237
|
requirements: []
|
237
238
|
rubyforge_project:
|
238
|
-
rubygems_version: 2.
|
239
|
+
rubygems_version: 2.1.5
|
239
240
|
signing_key:
|
240
241
|
specification_version: 4
|
241
242
|
summary: Comet component for Sinatra RocketIO
|