rmpd 1.1.12 → 1.1.13

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: bb4988929e39ec902157e3f0cc7bbdd5f84620d7
4
+ data.tar.gz: df089ffe90ceb7121317eaa749466adba80628c6
5
+ SHA512:
6
+ metadata.gz: 45b1d3ec4b78bcfc4499c54e33c3f6d827b7e6b2e87c1ef7bd1c36f4e45b2a6ce548b9ee6afd3c57ed79f41b69a95b7388b8f01f4772b3b6bfbc2a35ad392ee7
7
+ data.tar.gz: 9f246fef27256d620ab5e48142b8c835a41d55987e8bc5af6c1aa1095cf499a393a1f22dd04bca305a4f020f4ba080de727c6a05ff550668d8ef9a4c13053122
@@ -0,0 +1,27 @@
1
+ // -*- groovy -*-
2
+
3
+ node {
4
+ workspace = pwd()
5
+
6
+ stage "Clone"
7
+ git branch: 'master', url: 'ssh://git@gitlab.xmtp.net:2222/mildred/rmpd.git', credentialsId: 'ssh-jenkins'
8
+
9
+ stage "Bundle"
10
+ sh '''#!/bin/bash -l
11
+ bundle install'''
12
+
13
+ stage "Test"
14
+ sh '''#!/bin/bash -l
15
+ bundle exec rake'''
16
+
17
+ stage "Build"
18
+ sh '''#!/bin/bash -l
19
+ bundle exec gem build ./rmpd.gemspec'''
20
+
21
+ stage name: "Deploy", concurrency: 1
22
+ sh '''#!/bin/bash
23
+ gem=$(ls rmpd*.gem | sort -n | tail -n 1)
24
+ ver=$(echo $gem | sed -e 's/^rmpd-//' -e 's/\\.gem$//')
25
+ bundle exec gem search --remote '^rmpd\\b' | grep -q $ver || bundle exec gem push $gem
26
+ '''
27
+ }
@@ -10,7 +10,9 @@ module Rmpd
10
10
 
11
11
  def kill
12
12
  _kill
13
+ @socket_mu.lock
13
14
  @socket.close
15
+ @socket_mu.unlock
14
16
  end
15
17
 
16
18
  alias_method :disable_output, :disableoutput
@@ -16,14 +16,22 @@ module Rmpd
16
16
  def initialize(config_file=nil)
17
17
  @config = Rmpd::Config.new(config_file)
18
18
  @socket = nil
19
+ @socket_mu = Mutex.new
19
20
  end
20
21
 
21
22
  def close
23
+ @socket_mu.lock
22
24
  @socket.close
25
+ @socket_mu.unlock
23
26
  end
24
27
 
25
28
  def connect
26
- return unless @socket.nil? || @socket.closed?
29
+ @socket_mu.lock
30
+ unless @socket.nil? || @socket.closed?
31
+ @socket_mu.unlock
32
+ return
33
+ end
34
+ @socket_mu.unlock
27
35
 
28
36
  if %r{^/} === @config.hostname
29
37
  connect_unix_socket
@@ -36,14 +44,20 @@ module Rmpd
36
44
  end
37
45
 
38
46
  def connect_unix_socket
39
- @socket = UNIXSocket.new(@config.hostname)
40
- rescue StandardError => error
41
- @socket = nil
42
- raise MpdConnRefusedError.new(error)
47
+ @socket_mu.lock
48
+ begin
49
+ @socket = UNIXSocket.new(@config.hostname)
50
+ rescue StandardError => error
51
+ @socket = nil
52
+ raise MpdConnRefusedError.new(error)
53
+ ensure
54
+ @socket_mu.unlock
55
+ end
43
56
  end
44
57
 
45
58
  def connect_inet_socket
46
59
  Socket::getaddrinfo(@config.hostname, @config.port, nil, SOCK_STREAM).each do |info|
60
+ @socket_mu.lock
47
61
  begin
48
62
  sockaddr = Socket.pack_sockaddr_in(info[1], info[3])
49
63
  @socket = Socket.new(info[4], info[5], 0)
@@ -53,6 +67,8 @@ module Rmpd
53
67
  raise MpdConnRefusedError.new(error)
54
68
  else
55
69
  break
70
+ ensure
71
+ @socket_mu.unlock
56
72
  end
57
73
  end
58
74
  end
@@ -60,8 +76,9 @@ module Rmpd
60
76
  def send_command(command, *args)
61
77
  tries = 0
62
78
 
79
+ connect
80
+ @socket_mu.lock
63
81
  begin
64
- connect
65
82
  @socket.puts("#{command} #{quote(args).join(" ")}".strip)
66
83
  rescue Errno::EPIPE, EOFError
67
84
  @socket.close
@@ -70,16 +87,21 @@ module Rmpd
70
87
  else
71
88
  raise MpdError.new("Retry count exceeded")
72
89
  end
90
+ ensure
91
+ @socket_mu.unlock
73
92
  end
74
93
  end
75
94
 
76
95
  def read_response
77
96
  response = []
78
97
 
79
- while (line = @socket.readline.force_encoding("UTF-8"))
80
- response << line.strip
81
- break if END_RE === line
98
+ @socket_mu.synchronize do
99
+ while (line = @socket.readline.force_encoding("UTF-8"))
100
+ response << line.strip
101
+ break if END_RE === line
102
+ end
82
103
  end
104
+
83
105
  response
84
106
  end
85
107
 
@@ -1,3 +1,3 @@
1
1
  module Rmpd
2
- VERSION = "1.1.12"
2
+ VERSION = "1.1.13"
3
3
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  s.add_development_dependency("rspec", "~> 2.6.0")
23
- s.add_development_dependency("debugger")
23
+ s.add_development_dependency("byebug")
24
24
  s.add_development_dependency("rake")
25
25
  s.add_development_dependency("pry")
26
26
  end
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmpd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.12
5
- prerelease:
4
+ version: 1.1.13
6
5
  platform: ruby
7
6
  authors:
8
7
  - Eric Wollesen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2016-08-22 00:00:00.000000000 Z
11
+ date: 2016-09-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: 2.6.0
22
20
  type: :development
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: 2.6.0
30
27
  - !ruby/object:Gem::Dependency
31
- name: debugger
28
+ name: byebug
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: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
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
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: pry
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
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
77
68
  version: '0'
78
69
  description: Music Player Daemon client in Ruby
@@ -82,10 +73,11 @@ executables: []
82
73
  extensions: []
83
74
  extra_rdoc_files: []
84
75
  files:
85
- - .gitignore
86
- - .rspec
87
- - .rvmrc
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".rvmrc"
88
79
  - Gemfile
80
+ - Jenkinsfile
89
81
  - Rakefile
90
82
  - console.rb
91
83
  - lib/rmpd.rb
@@ -120,27 +112,25 @@ files:
120
112
  - spec/spec_rcov.opts
121
113
  homepage: http://github.com/ewollesen/rmpd
122
114
  licenses: []
115
+ metadata: {}
123
116
  post_install_message:
124
117
  rdoc_options: []
125
118
  require_paths:
126
119
  - lib
127
120
  required_ruby_version: !ruby/object:Gem::Requirement
128
- none: false
129
121
  requirements:
130
- - - ! '>='
122
+ - - ">="
131
123
  - !ruby/object:Gem::Version
132
124
  version: '0'
133
125
  required_rubygems_version: !ruby/object:Gem::Requirement
134
- none: false
135
126
  requirements:
136
- - - ! '>='
127
+ - - ">="
137
128
  - !ruby/object:Gem::Version
138
129
  version: '0'
139
130
  requirements: []
140
131
  rubyforge_project:
141
- rubygems_version: 1.8.23
132
+ rubygems_version: 2.5.1
142
133
  signing_key:
143
- specification_version: 3
134
+ specification_version: 4
144
135
  summary: Music Player Daemon client in Ruby
145
136
  test_files: []
146
- has_rdoc: