vnctools 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
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] [Jari Bakken]
190
+ Copyright 2011-2012 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
@@ -8,20 +8,27 @@ Simple CLI wrappers to control and record VNC displays from Ruby.
8
8
  Usage
9
9
  =============
10
10
 
11
- # `tightvncserver`
12
- server = VncTools::Server.new
13
- server.start
14
-
15
- # `ffmpeg`
16
- recorder = VncTools::Recorder.new(server.display, "movie.mp4")
17
- recorder.start
11
+ ```ruby
12
+ # `tightvncserver`
13
+ server = VncTools::Server.new
14
+ server.start
15
+
16
+ # `ffmpeg`
17
+ recorder = VncTools::Recorder.new(server.display, "movie.mp4")
18
+ recorder.start
18
19
 
19
- ENV['DISPLAY'] = server.display
20
- ...
20
+ ENV['DISPLAY'] = server.display
21
+ ...
21
22
 
22
- recorder.stop
23
- server.stop
23
+ recorder.stop
24
+ server.stop
25
+ ```
26
+
27
+ Requirements
28
+ ============
24
29
 
30
+ * Linux
31
+ * tightvncserver (apt-get install tightvncserver)
25
32
 
26
33
  Note on Patches/Pull Requests
27
34
  =============================
@@ -37,5 +44,5 @@ Note on Patches/Pull Requests
37
44
  Copyright
38
45
  =========
39
46
 
40
- Copyright (c) 2011 Jari Bakken. See LICENSE for details.
47
+ Copyright (c) 2011-2012 Jari Bakken. See LICENSE for details.
41
48
 
@@ -3,16 +3,21 @@ module VncTools
3
3
  include Observable
4
4
 
5
5
  def initialize(capacity, klass = Server)
6
- @capacity = capacity
7
- @servers = Array.new(capacity) { klass.new }
8
- @running = []
6
+ @capacity = capacity
7
+ @running = []
8
+ @server_class = klass
9
+
10
+ create_servers
9
11
  end
10
12
 
11
13
  def stop
12
- running.each do |s|
14
+ running.dup.each do |s|
13
15
  fire :on_display_stopping, s
14
- s.stop
16
+ stop_server s
17
+ running.delete s
15
18
  end
19
+
20
+ create_servers
16
21
  end
17
22
 
18
23
  def size
@@ -51,13 +56,26 @@ module VncTools
51
56
 
52
57
  if server.display.nil?
53
58
  fire :on_display_starting, server
54
- server.start
59
+ start_server server
55
60
  @running << server
56
61
  end
57
62
 
58
63
  server
59
64
  end
60
65
 
66
+ def create_servers
67
+ @servers = Array.new(@capacity) { @server_class.new }
68
+ end
69
+
70
+ # can be overridden by subclasses
71
+ def start_server(server)
72
+ server.start
73
+ end
74
+
75
+ def stop_server(server)
76
+ server.stop
77
+ end
78
+
61
79
  class TooManyDisplaysError < StandardError
62
80
  end
63
81
 
@@ -1,3 +1,3 @@
1
1
  module VncTools
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,91 +1,87 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: vnctools
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 4
10
- version: 0.0.4
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jari Bakken
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-11-10 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-05-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: childprocess
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: simplecov
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: simplecov
32
+ requirement: !ruby/object:Gem::Requirement
38
33
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
46
38
  type: :development
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: rspec
50
39
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
52
49
  none: false
53
- requirements:
50
+ requirements:
54
51
  - - ~>
55
- - !ruby/object:Gem::Version
56
- hash: 9
57
- segments:
58
- - 2
59
- - 5
60
- version: "2.5"
52
+ - !ruby/object:Gem::Version
53
+ version: '2.5'
61
54
  type: :development
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: rake
65
55
  prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
67
57
  none: false
68
- requirements:
58
+ requirements:
69
59
  - - ~>
70
- - !ruby/object:Gem::Version
71
- hash: 63
72
- segments:
73
- - 0
74
- - 9
75
- - 2
60
+ - !ruby/object:Gem::Version
61
+ version: '2.5'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
76
69
  version: 0.9.2
77
70
  type: :development
78
- version_requirements: *id004
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.9.2
79
78
  description: Simple CLI wrappers to control and record VNC displays from Ruby.
80
- email:
79
+ email:
81
80
  - jari.bakken@gmail.com
82
81
  executables: []
83
-
84
82
  extensions: []
85
-
86
83
  extra_rdoc_files: []
87
-
88
- files:
84
+ files:
89
85
  - .gitignore
90
86
  - .rspec
91
87
  - .travis.yml
@@ -103,41 +99,33 @@ files:
103
99
  - spec/vnctools/server_pool_spec.rb
104
100
  - spec/vnctools/server_spec.rb
105
101
  - vnctools.gemspec
106
- homepage: ""
102
+ homepage: ''
107
103
  licenses: []
108
-
109
104
  post_install_message:
110
105
  rdoc_options: []
111
-
112
- require_paths:
106
+ require_paths:
113
107
  - lib
114
- required_ruby_version: !ruby/object:Gem::Requirement
108
+ required_ruby_version: !ruby/object:Gem::Requirement
115
109
  none: false
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- hash: 3
120
- segments:
121
- - 0
122
- version: "0"
123
- required_rubygems_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
115
  none: false
125
- requirements:
126
- - - ">="
127
- - !ruby/object:Gem::Version
128
- hash: 3
129
- segments:
130
- - 0
131
- version: "0"
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
132
120
  requirements: []
133
-
134
121
  rubyforge_project: vnctools
135
- rubygems_version: 1.8.10
122
+ rubygems_version: 1.8.24
136
123
  signing_key:
137
124
  specification_version: 3
138
125
  summary: Simple CLI wrappers to control and record VNC displays from Ruby.
139
- test_files:
126
+ test_files:
140
127
  - spec/spec_helper.rb
141
128
  - spec/vnctools/recorder_spec.rb
142
129
  - spec/vnctools/server_pool_spec.rb
143
130
  - spec/vnctools/server_spec.rb
131
+ has_rdoc: