vnctools 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/LICENSE +1 -1
- data/README.mdown +3 -3
- data/lib/vnctools/server.rb +11 -0
- data/lib/vnctools/server_pool.rb +5 -2
- data/lib/vnctools/version.rb +1 -1
- data/spec/vnctools/server_pool_spec.rb +13 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8220175c00e0319f5ec2f710d196b3c7e7742b74
|
4
|
+
data.tar.gz: b36cbf5873c53f8c7326b35789ba5325bd18116a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fddce38135a2713fbbb02f19f6f033bb2379a0a3cbab7985a18f413f6a2211da8c369a8b46ba91fbd4401ee5a748d30f193d95c0c0d9252c1184120e639dd2f5
|
7
|
+
data.tar.gz: 2df7438a254aa66d6c197b91ce08ec01b7235f3b79d1482e526cba413ee82cbdb995d23fcea2c5a12a030c79460c841847a3e330de22b9b5c34c7115734ddb9f
|
data/.travis.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
rvm:
|
2
|
-
- 1.
|
3
|
-
-
|
4
|
-
- 1.
|
2
|
+
- 1.9.3
|
3
|
+
- 2.0.0
|
4
|
+
- 2.1.0
|
data/LICENSE
CHANGED
@@ -187,7 +187,7 @@
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
188
188
|
identification within third-party archives.
|
189
189
|
|
190
|
-
Copyright 2011-
|
190
|
+
Copyright 2011-2014 Jari Bakken
|
191
191
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
193
193
|
you may not use this file except in compliance with the License.
|
data/README.mdown
CHANGED
@@ -16,10 +16,10 @@ server.start
|
|
16
16
|
# `ffmpeg`
|
17
17
|
recorder = VncTools::Recorder.new(server.display, "movie.mp4")
|
18
18
|
recorder.start
|
19
|
-
|
19
|
+
|
20
20
|
ENV['DISPLAY'] = server.display
|
21
21
|
...
|
22
|
-
|
22
|
+
|
23
23
|
recorder.stop
|
24
24
|
server.stop
|
25
25
|
```
|
@@ -44,5 +44,5 @@ Note on Patches/Pull Requests
|
|
44
44
|
Copyright
|
45
45
|
=========
|
46
46
|
|
47
|
-
Copyright (c) 2011-
|
47
|
+
Copyright (c) 2011-2014 Jari Bakken. See LICENSE for details.
|
48
48
|
|
data/lib/vnctools/server.rb
CHANGED
@@ -56,6 +56,17 @@ module VncTools
|
|
56
56
|
pid_path.delete if pid_path.exist?
|
57
57
|
end
|
58
58
|
|
59
|
+
def alive?
|
60
|
+
pid_path.exist? && Process.kill(0, Integer(pid_path.read))
|
61
|
+
rescue Errno::ESRCH
|
62
|
+
pid_path.delete if pid_path.exist?
|
63
|
+
false
|
64
|
+
end
|
65
|
+
|
66
|
+
def dead?
|
67
|
+
!alive?
|
68
|
+
end
|
69
|
+
|
59
70
|
def pid_path
|
60
71
|
@pid_path ||= Pathname.new(File.expand_path("~/.vnc/#{host}#{display}.pid"))
|
61
72
|
end
|
data/lib/vnctools/server_pool.rb
CHANGED
@@ -54,9 +54,11 @@ module VncTools
|
|
54
54
|
def next_server
|
55
55
|
server = @servers.shift
|
56
56
|
|
57
|
-
if server.display.nil?
|
57
|
+
if server.display.nil? || server.dead?
|
58
|
+
server = @server_class.new if server.dead?
|
59
|
+
|
58
60
|
fire :on_display_starting, server
|
59
|
-
start_server
|
61
|
+
start_server(server)
|
60
62
|
@running << server
|
61
63
|
end
|
62
64
|
|
@@ -72,6 +74,7 @@ module VncTools
|
|
72
74
|
server.start
|
73
75
|
end
|
74
76
|
|
77
|
+
# can be overridden by subclasses
|
75
78
|
def stop_server(server)
|
76
79
|
server.stop
|
77
80
|
end
|
data/lib/vnctools/version.rb
CHANGED
@@ -2,7 +2,7 @@ require File.expand_path("../../spec_helper", __FILE__)
|
|
2
2
|
|
3
3
|
module VncTools
|
4
4
|
describe ServerPool do
|
5
|
-
let(:server) { double(Server, :start => nil, :stop => nil) }
|
5
|
+
let(:server) { double(Server, :start => nil, :stop => nil, :dead? => false) }
|
6
6
|
let(:fake_server_class) { double(:new => server)}
|
7
7
|
let(:pool) { ServerPool.new(3, fake_server_class) }
|
8
8
|
|
@@ -25,6 +25,18 @@ module VncTools
|
|
25
25
|
pool.release obj
|
26
26
|
end
|
27
27
|
|
28
|
+
it 'replaces a dead server from the pool' do
|
29
|
+
server.stub(:dead? => true)
|
30
|
+
fake_server_class.should_receive(:new).exactly(3).times
|
31
|
+
pool # create pool to trigger the above
|
32
|
+
|
33
|
+
replacement_server = double(Server, :dead? => false)
|
34
|
+
fake_server_class.should_receive(:new).once.and_return(replacement_server)
|
35
|
+
replacement_server.should_receive(:start)
|
36
|
+
|
37
|
+
pool.get.should == replacement_server
|
38
|
+
end
|
39
|
+
|
28
40
|
it "can stop the pool" do
|
29
41
|
pool.stub(:running => [server])
|
30
42
|
server.should_receive(:stop)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vnctools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jari Bakken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: childprocess
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubyforge_project: vnctools
|
112
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.1.10
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Simple CLI wrappers to control and record VNC displays from Ruby.
|