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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7408bd7681a4d44cf58af2c4e65cc8552b83d07
4
- data.tar.gz: e30f146a73c61df70d8260783dc7dbbb47a91208
3
+ metadata.gz: c2184dccf480c922ee731562b8343a45b3fddced
4
+ data.tar.gz: 6084956ad72d841c55adde6540e9204f378c8966
5
5
  SHA512:
6
- metadata.gz: d830f0906e12c3da8195394ace96d7be4a50ad14a6a54efa939581bab8cfa0ff4cbe53a4bc6d99b2e1e025ff62a6f671a9e08bad7b2590b1b8756dbe9a9b0690
7
- data.tar.gz: ac20cd5c947df89dc63b3960998ef690c1c7681952ea4a4efc96b3ad1ed8d7affafae4f29e9f7a101a8b130e31e2932510bb717d97cf61ea1b03d012925b9aee
6
+ metadata.gz: e6581d7fc4fc5d42cd6a9b5cac2a6727633cf856f5102322f2ff68379b3ed14c6157378b2cd2100e116c180a4360ea5221131d057c2626c47dcb4d8c79bcc586
7
+ data.tar.gz: 787f054cc41e6beda3c56ea3755235b064a8ea61d9f1d2c0c9e405d4b513d787890ec3906901f0fb6dd0cfec295beedebf27c16d7ae4879b800326a3493238bd
@@ -1,3 +1,4 @@
1
1
  module Death; end
2
2
  require 'death/command'
3
3
  require 'death/core_ext/process'
4
+ require 'death/voice'
@@ -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
- raise 'death command is supporting only Mac OS X.' unless supported_os?
7
+ Death::Voice.say('deeeeeeeeeeeattttth')
9
8
 
10
- sound_pressure { system('say -v Ralph deeeeeeeeeeeattttth &') }
9
+ command = "kill #{[signal, pid, pids].flatten.compact.shelljoin}"
11
10
 
12
- Open3.popen3("kill #{[signal, pid, pids].flatten.shelljoin}") do |stdin, stdout, stderr|
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
@@ -1,3 +1,3 @@
1
1
  module Death
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
@@ -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.0
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-10 00:00:00.000000000 Z
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