vnctools 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4424a38d289baa98a4dedc102a0ab958c06d695d
4
+ data.tar.gz: a1445abbe7a4b598bba59b5595b201fbf1b29388
5
+ SHA512:
6
+ metadata.gz: 6cddf04e5aa37b57ab260f83aacc04f434c59f9daad13e2f2a5f283b5a3af91762aca06f4e375e5b6cd2e8e17adc06fa069fd40b226bd0a3beb3e65cdf73f35f
7
+ data.tar.gz: 41d78b145f11de279b5fd3bca4dba1d06a114cf4f57b6f76bf72ab949f2cc44ccbe65511e435fd7551e07d7dcb47af867413eb42e5ef56d635d4c3cff017853b
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-2012 Jari Bakken
190
+ Copyright 2011-2013 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.
@@ -44,5 +44,5 @@ Note on Patches/Pull Requests
44
44
  Copyright
45
45
  =========
46
46
 
47
- Copyright (c) 2011-2012 Jari Bakken. See LICENSE for details.
47
+ Copyright (c) 2011-2013 Jari Bakken. See LICENSE for details.
48
48
 
@@ -1,4 +1,4 @@
1
- module Vnctools
1
+ module VncTools
2
2
  # Your code goes here...
3
3
  end
4
4
 
@@ -35,6 +35,7 @@ module VncTools
35
35
  else
36
36
  output = server(*launch_arguments)
37
37
  @display = output[/desktop is #{host}(\S+)/, 1]
38
+ @display or raise Error, "could not find display in #{output.inspect}"
38
39
  end
39
40
  end
40
41
 
@@ -1,3 +1,3 @@
1
1
  module VncTools
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", __FILE__)
3
3
  module VncTools
4
4
  describe Recorder do
5
5
  context "given a display string" do
6
- let(:process) { mock(ChildProcess, :crashed? => false, :start => nil, :stop => nil, :io => mock("io").as_null_object) }
6
+ let(:process) { double(ChildProcess, :crashed? => false, :start => nil, :stop => nil, :io => double("io").as_null_object) }
7
7
  let(:recorder) { Recorder.new ":1", "out.mp4" }
8
8
 
9
9
  it "knows its display" do
@@ -35,7 +35,7 @@ module VncTools
35
35
  end
36
36
 
37
37
  it "raises an error if the process crashed" do
38
- ChildProcess.stub :build => mock(:start => nil, :crashed? => true)
38
+ ChildProcess.stub :build => double(:start => nil, :crashed? => true)
39
39
 
40
40
  lambda { recorder.start }.should raise_error
41
41
  end
@@ -2,8 +2,8 @@ require File.expand_path("../../spec_helper", __FILE__)
2
2
 
3
3
  module VncTools
4
4
  describe ServerPool do
5
- let(:server) { mock(Server, :start => nil, :stop => nil) }
6
- let(:fake_server_class) { mock(:new => server)}
5
+ let(:server) { double(Server, :start => nil, :stop => nil) }
6
+ let(:fake_server_class) { double(:new => server)}
7
7
  let(:pool) { ServerPool.new(3, fake_server_class) }
8
8
 
9
9
  it "creates 3 instances of the given display class" do
@@ -42,7 +42,7 @@ module VncTools
42
42
  end
43
43
 
44
44
  it "notifies observers" do
45
- observer = mock(Observable)
45
+ observer = double(Observable)
46
46
 
47
47
  observer.should_receive(:update).with :on_display_starting, server
48
48
  observer.should_receive(:update).with :on_display_fetched , server
@@ -4,7 +4,7 @@ module VncTools
4
4
  describe Server do
5
5
  context "managing new displays" do
6
6
  let(:server) { Server.new }
7
- before { server.stub :last_status => mock(:success? => true) }
7
+ before { server.stub :last_status => double(:success? => true) }
8
8
 
9
9
  it "starts a new server" do
10
10
  server.should_receive(:`).with("tightvncserver 2>&1").and_return("desktop is #{Socket.gethostname}:1")
@@ -20,10 +20,10 @@ module VncTools
20
20
 
21
21
  it "forcefully stops the server" do
22
22
  server.should_receive(:`).with("tightvncserver -kill :5 2>&1")
23
- server.stub :last_status => mock(:success? => false)
23
+ server.stub :last_status => double(:success? => false)
24
24
  server.stub :display => ":5"
25
25
 
26
- mock_pathname = mock('Pathname:5.pid', :exist? => true)
26
+ mock_pathname = double('Pathname:5.pid', :exist? => true)
27
27
  Pathname.should_receive(:new).with("#{ENV['HOME']}/.vnc/#{Socket.gethostname}:5.pid").and_return(mock_pathname)
28
28
  mock_pathname.should_receive(:read).and_return 123123
29
29
  mock_pathname.should_receive(:delete)
@@ -34,18 +34,24 @@ module VncTools
34
34
 
35
35
  it "raises Server::Error if the server could not be started" do
36
36
  server.should_receive(:`).and_return("oops")
37
- server.stub :last_status => mock(:success? => false)
37
+ server.stub :last_status => double(:success? => false)
38
38
 
39
39
  lambda { server.start }.should raise_error(Server::Error, /oops/)
40
40
  end
41
41
 
42
+ it "raises Server::Error if the display number could not be parsed" do
43
+ server.should_receive(:`).and_return("oops")
44
+
45
+ lambda { server.start }.should raise_error(Server::Error, /could not find display/)
46
+ end
47
+
42
48
  it "can be overriden to provide custom launch arguments" do
43
49
  server_class = Class.new(Server) {
44
50
  def launch_arguments() %w[-geometry 1280x1024] end
45
51
  }
46
-
52
+
47
53
  server = server_class.new
48
- server.stub :last_status => mock(:success? => true)
54
+ server.stub :last_status => double(:success? => true)
49
55
 
50
56
  server.should_receive(:`).with("tightvncserver -geometry 1280x1024 2>&1").and_return("desktop is #{Socket.gethostname}:1")
51
57
  server.start
@@ -54,7 +60,7 @@ module VncTools
54
60
 
55
61
  context "controlling an existing display" do
56
62
  let(:server) { Server.new ":5" }
57
- before { server.stub :last_status => mock(:success? => true) }
63
+ before { server.stub :last_status => double(:success? => true) }
58
64
 
59
65
  it "starts the server on the given display" do
60
66
  server.should_receive(:`).with("tightvncserver :5 2>&1").and_return("desktop is #{Socket.gethostname}:5")
metadata CHANGED
@@ -1,52 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vnctools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
5
- prerelease:
4
+ version: 0.0.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jari Bakken
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-10-31 00:00:00.000000000 Z
11
+ date: 2013-08-09 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: childprocess
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: simplecov
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -101,27 +92,26 @@ files:
101
92
  - vnctools.gemspec
102
93
  homepage: ''
103
94
  licenses: []
95
+ metadata: {}
104
96
  post_install_message:
105
97
  rdoc_options: []
106
98
  require_paths:
107
99
  - lib
108
100
  required_ruby_version: !ruby/object:Gem::Requirement
109
- none: false
110
101
  requirements:
111
- - - ! '>='
102
+ - - '>='
112
103
  - !ruby/object:Gem::Version
113
104
  version: '0'
114
105
  required_rubygems_version: !ruby/object:Gem::Requirement
115
- none: false
116
106
  requirements:
117
- - - ! '>='
107
+ - - '>='
118
108
  - !ruby/object:Gem::Version
119
109
  version: '0'
120
110
  requirements: []
121
111
  rubyforge_project: vnctools
122
- rubygems_version: 1.8.24
112
+ rubygems_version: 2.0.6
123
113
  signing_key:
124
- specification_version: 3
114
+ specification_version: 4
125
115
  summary: Simple CLI wrappers to control and record VNC displays from Ruby.
126
116
  test_files:
127
117
  - spec/spec_helper.rb