sockd 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6eac67e5bf5c221e1246054c67fe114d0e1ce125
4
- data.tar.gz: cd0fca78d6544e1b4badca98c291313bb2c3955f
3
+ metadata.gz: 22b8a9ad90fe47dae69da26ef9d88774529e9b9a
4
+ data.tar.gz: c94d37f82af935bad426c91209b2cb7258cbdeed
5
5
  SHA512:
6
- metadata.gz: 4dee986312d3761ef7854df1a6f6937ddf3d3a9a086969ea056ec396334d4fb4f4c7e32bcbc3f94c174e019da22d83cc5e32a0232a40dd21797abfeaa9b2652b
7
- data.tar.gz: 92af3f8162ba59946f266c01198c3b4fd08814a4fbba27d1b465989a57b3f1d3f80fbfa19ddfe4f4d6ffd15f4734d07e1916b6ab172f21d315b551e2f21a8bf0
6
+ metadata.gz: 2bd29d45c860985129b625157fc66993f6c88952568d81cfafc1027a08bcaf1b93dc39e8db011a8f516600e737d89f92bc20b77c0e9f660e0792b80f5eb52d4d
7
+ data.tar.gz: 2170f73f868f664ccb9671cea2ffeabbbacb5532fe49cff3e0495113323374f74fbc70c04653107f996769a79380c4dd60bad848799417266b9884a431d61d53
data/lib/sockd.rb CHANGED
@@ -31,7 +31,7 @@ module Sockd
31
31
  raise ParseError, 'no config file path specified, unable to save' unless save_path
32
32
  save_yaml options, save_path
33
33
 
34
- puts "config saved to: #{path}"
34
+ puts "config saved to: #{save_path}"
35
35
  exit
36
36
  end
37
37
 
@@ -154,7 +154,7 @@ module Sockd
154
154
 
155
155
  def read_yaml(options, path)
156
156
  config = YAML.load_file(path).merge!(options)
157
- options.replace(config)
157
+ options.replace Hash[config.map{ |k, v| [k.to_sym, v] }]
158
158
  rescue Errno::EACCES, Errno::EISDIR => e
159
159
  raise ConfigFileError, "unable to read config (#{e.message})"
160
160
  end
data/lib/sockd/runner.rb CHANGED
@@ -134,6 +134,8 @@ module Sockd
134
134
  warn "#{name} process not running"
135
135
  end
136
136
  self
137
+ rescue Errno::EPERM => e
138
+ raise ServiceError, "unable to stop #{name} process (#{e.message})"
137
139
  end
138
140
 
139
141
  # restart our service
@@ -195,9 +197,9 @@ module Sockd
195
197
  ensure
196
198
  server.close
197
199
  end
198
- rescue Errno::EACCES
200
+ rescue Errno::EACCES, Errno::EADDRINUSE => e
199
201
  sock = options[:socket] || "#{options[:host]}:#{options[:port]}"
200
- raise ServiceError, "unable to open socket: #{sock} (check permissions)"
202
+ raise ServiceError, "unable to open socket: #{sock} (#{e.message})"
201
203
  end
202
204
 
203
205
  # return a UNIXSocket or TCPSocket instance depending on config
@@ -260,6 +262,8 @@ module Sockd
260
262
  pid
261
263
  rescue Errno::ESRCH
262
264
  false
265
+ rescue Errno::EPERM
266
+ pid
263
267
  end
264
268
 
265
269
  # reverse of daemon_running?
data/lib/sockd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sockd
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sockd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Greiling
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-18 00:00:00.000000000 Z
11
+ date: 2015-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler