death 0.6.0 → 0.6.1
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 +4 -4
- data/lib/death.rb +1 -0
- data/lib/death/command.rb +3 -21
- data/lib/death/version.rb +1 -1
- data/lib/death/voice.rb +29 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2184dccf480c922ee731562b8343a45b3fddced
|
4
|
+
data.tar.gz: 6084956ad72d841c55adde6540e9204f378c8966
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6581d7fc4fc5d42cd6a9b5cac2a6727633cf856f5102322f2ff68379b3ed14c6157378b2cd2100e116c180a4360ea5221131d057c2626c47dcb4d8c79bcc586
|
7
|
+
data.tar.gz: 787f054cc41e6beda3c56ea3755235b064a8ea61d9f1d2c0c9e405d4b513d787890ec3906901f0fb6dd0cfec295beedebf27c16d7ae4879b800326a3493238bd
|
data/lib/death.rb
CHANGED
data/lib/death/command.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
|
-
require 'facter'
|
2
1
|
require 'open3'
|
3
2
|
require 'shellwords'
|
4
3
|
|
5
4
|
module Death::Command
|
6
5
|
class << self
|
7
6
|
def death(signal, pid, *pids)
|
8
|
-
|
7
|
+
Death::Voice.say('deeeeeeeeeeeattttth')
|
9
8
|
|
10
|
-
|
9
|
+
command = "kill #{[signal, pid, pids].flatten.compact.shelljoin}"
|
11
10
|
|
12
|
-
Open3.popen3(
|
11
|
+
Open3.popen3(command) do |stdin, stdout, stderr|
|
13
12
|
msg = stderr.read
|
14
13
|
if /kill: illegal process id: kill/ === msg
|
15
14
|
puts 'death: illegal process id: kill'
|
@@ -20,22 +19,5 @@ module Death::Command
|
|
20
19
|
end
|
21
20
|
|
22
21
|
alias lml death
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def sound_pressure
|
27
|
-
processor_count = Facter[:processorcount].value
|
28
|
-
|
29
|
-
(processor_count * 3).times { yield }
|
30
|
-
end
|
31
|
-
|
32
|
-
def supported_os?
|
33
|
-
if RUBY_PLATFORM == 'java'
|
34
|
-
require 'java'
|
35
|
-
java.lang.System.getProperty('os.name') == 'Mac OS X'
|
36
|
-
else
|
37
|
-
/darwin/ === RUBY_PLATFORM
|
38
|
-
end
|
39
|
-
end
|
40
22
|
end
|
41
23
|
end
|
data/lib/death/version.rb
CHANGED
data/lib/death/voice.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'facter'
|
2
|
+
require 'shellwords'
|
3
|
+
|
4
|
+
module Death::Voice
|
5
|
+
class << self
|
6
|
+
def say(message)
|
7
|
+
raise 'death command is supporting only Mac OS X.' unless supported_os?
|
8
|
+
|
9
|
+
sound_pressure { system("say -v Ralph #{Shellwords.shellescape(message)} &") }
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def sound_pressure
|
15
|
+
processor_count = Facter[:processorcount].value
|
16
|
+
|
17
|
+
(processor_count * 3).times { yield }
|
18
|
+
end
|
19
|
+
|
20
|
+
def supported_os?
|
21
|
+
if RUBY_PLATFORM == 'java'
|
22
|
+
require 'java'
|
23
|
+
java.lang.System.getProperty('os.name') == 'Mac OS X'
|
24
|
+
else
|
25
|
+
/darwin/ === RUBY_PLATFORM
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: death
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ITO Koichi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facter
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- lib/death/command.rb
|
57
57
|
- lib/death/core_ext/process.rb
|
58
58
|
- lib/death/version.rb
|
59
|
+
- lib/death/voice.rb
|
59
60
|
homepage: http://github.com/koic/death-command
|
60
61
|
licenses:
|
61
62
|
- MIT
|