vlc-client 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e93182279e83b89bc91c7fd08478ad97dda296da
4
- data.tar.gz: 5ad6b5688d2babebc662003918331874878405e8
3
+ metadata.gz: ae9ecda809fe61433d61d38c263715eebc2d99f3
4
+ data.tar.gz: 46c6ef80d8507cb05d6a32f0f274e7eaf629cfbb
5
5
  SHA512:
6
- metadata.gz: 06f1446c87b4cf6939bbc84a470881246803091f4af8f658c3f73a865828759caee8a988d43e1e3e159d603f052b08074dc63f1e3abe54eb6a88348a719c5bcf
7
- data.tar.gz: 8f80b8fb1b534516441df59b3f10c3a502eafa0bc7c40377a1db6e721bdda04ffb2f49aa18067dae0605a6e9d0db30f2b967f656730181a054948265df7eddee
6
+ metadata.gz: e6f404e88f192deca0dd42e1acef2d4808bb70675b5a2a370cb293e9056e905fe1346f8ca56fc42b0780bb279ae47b5a9eb5df73fbe73cafd838ad95b0169cf2
7
+ data.tar.gz: 41e9cda0d0b842f7a7e4e25917a7ae5cbc3c4bfd7623465a99e5dda5a7675342eb9e6640ac01abfdacc394e20849cc3cd67af996ef1b0d99d9d0b5f61d38143c
@@ -1,3 +1,8 @@
1
+ before_install:
2
+ #This is a temporary workaround a rubygems bug! Remove later
3
+ #see: https://github.com/bundler/bundler/issues/2784 & https://github.com/rubygems/rubygems/pull/763
4
+ - gem update --system 2.1.11
5
+ - gem --version
1
6
  language: ruby
2
7
  script: bundle exec rake --verbose --trace
3
8
  bundler_args: --without development
@@ -10,4 +15,4 @@ rvm:
10
15
  - 1.9.2
11
16
  - 1.9.3
12
17
  - 2.0.0
13
- - ruby-head
18
+ - ruby-head
data/README.md CHANGED
@@ -90,7 +90,7 @@ vlc.connect
90
90
 
91
91
  ## Notice
92
92
 
93
- vlc-client has been tested on linux but it should work on any VLC installation as long and the command line is responsive for `vlc` and `cvlc` calls. On Mac OSX these are not available by default. They can be created with:
93
+ vlc-client has been tested on linux but it should work on any VLC installation as long as the command line is responsive for `vlc` and `cvlc` calls. On Mac OSX these are not available by default. They can be created with:
94
94
 
95
95
  ```
96
96
  ln -s /Applications/VLC.app/Contents/MacOS/VLC /usr/local/bin/vlc
@@ -24,6 +24,7 @@ module VLC
24
24
  include VLC::Client::VideoControls
25
25
  include VLC::Client::ConnectionManagement
26
26
 
27
+ attr_reader :connection
27
28
  attr_accessor :host,
28
29
  :port,
29
30
  :server
@@ -69,8 +70,6 @@ module VLC
69
70
  bind_server(server, options) unless server.nil?
70
71
  end
71
72
 
72
- attr_reader :connection
73
-
74
73
  private
75
74
  def bind_server(server, options = {})
76
75
  @connection.host = server.host
@@ -45,9 +45,21 @@ module VLC
45
45
  #
46
46
  def start(detached = false)
47
47
  return @pid if running?
48
- rd, wr = IO.pipe
49
-
50
48
  detached ? @deamon = true : setup_traps
49
+
50
+ if RUBY_VERSION >= '1.9'
51
+ @pid = Process.spawn(headless? ? 'cvlc' : 'vlc',
52
+ '--extraintf', 'rc', '--rc-host', "#{@host}:#{@port}",
53
+ :pgroup => detached,
54
+ :in => '/dev/null',
55
+ :out => '/dev/null',
56
+ :err => '/dev/null')
57
+
58
+ return @pid
59
+ end
60
+
61
+ # for Ruby 1.8 and below
62
+ rd, wr = IO.pipe
51
63
  if Process.fork #parent
52
64
  wr.close
53
65
  @pid = rd.read.to_i
@@ -104,9 +116,20 @@ module VLC
104
116
 
105
117
  private
106
118
  def setup_traps
107
- trap("EXIT") { stop }
108
- trap("INT") { stop }
109
- trap("CLD") { @pid = NullObject.new; @deamon = false }
119
+ trap("EXIT") do
120
+ stop
121
+ exit
122
+ end
123
+
124
+ trap("INT") do
125
+ stop
126
+ exit
127
+ end
128
+
129
+ trap("CLD") do
130
+ @pid = NullObject.new
131
+ @deamon = false
132
+ end
110
133
  end
111
134
 
112
135
  def detach
@@ -119,4 +142,4 @@ module VLC
119
142
  end
120
143
  end
121
144
  end
122
- end
145
+ end
@@ -1,3 +1,3 @@
1
1
  module VLC
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -30,39 +30,21 @@ module Mocks
30
30
  end
31
31
 
32
32
  def mock_system_calls(opts = {})
33
- if opts.fetch(:daemonized, false)
34
- Process.should_receive(:fork).once.ordered.and_return(false)
35
-
36
- if RUBY_VERSION < "1.9"
37
- Process.should_receive(:setsid).once.ordered
38
- Process.should_receive(:fork).once.ordered.and_return(false)
39
- Dir.should_receive(:chdir).once.with("/")
40
- else
41
- Process.should_receive(:daemon).once
42
- end
43
- Process.should_receive(:pid).once.and_return(99)
44
-
45
- rd = double('rd', :close => true)
46
- wd = double('wd', :write => true, :close => true)
47
- IO.stub(:pipe).and_return([rd, wd])
48
-
49
- [STDIN, STDOUT, STDERR].each { |std| std.stub(:reopen) }
50
-
33
+ if RUBY_VERSION < "1.9"
34
+ # ruby 1.8.x system call stubs
35
+ rd = double('rd', :read => 99, :close => true)
36
+ wr = double('wr', :close => true)
37
+ IO.stub(:pipe).and_return([rd, wr])
38
+ Process.stub(:fork).twice.and_return(true)
39
+ Process.stub(:pid).once.and_return(99)
51
40
  Kernel.stub(:exec)
41
+ [STDIN, STDOUT, STDERR].each { |std| std.stub(:reopen) }
52
42
  else
53
- Process.stub(:fork).and_return(true)
54
-
55
- rd = double('rd', :read => 99, :close => true)
56
- wd = double('wd', :close => true)
57
- IO.stub(:pipe).and_return([rd, wd])
58
-
59
- Process.should_receive(:kill).once.with('INT', 99) if opts.fetch(:kill, true)
43
+ # ruby 1.9+ process spwan mock
44
+ Process.should_receive(:spawn).once.and_return(99)
60
45
  end
61
- end
62
46
 
63
- def mock_sub_systems
64
- mock_system_calls
65
- mock_tcp_server
47
+ Process.should_receive(:kill).once.with('INT', 99) if opts.fetch(:kill, true)
66
48
  end
67
49
 
68
50
  def mock_file(filename)
@@ -76,4 +58,4 @@ end
76
58
 
77
59
  RSpec.configure do |cfg|
78
60
  cfg.include(Mocks)
79
- end
61
+ end
@@ -18,7 +18,6 @@ describe VLC::System do
18
18
  end
19
19
 
20
20
  it 'handles server lifecycle management to client code' do
21
- mock_system_calls(:kill => false)
22
21
  mock_tcp_server(:close => false)
23
22
 
24
23
  vlc = VLC::System.new('127.0.0.1', 9999, :auto_start => false)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vlc-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Guinada
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-15 00:00:00.000000000 Z
11
+ date: 2014-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: retryable