death 0.4.1 → 0.5.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.
- data/bin/death +4 -21
- data/bin/lml +4 -21
- data/death.gemspec +4 -1
- data/lib/death.rb +5 -0
- data/lib/death/command.rb +34 -0
- data/lib/death/core_ext/process.rb +12 -0
- data/lib/death/version.rb +1 -1
- metadata +5 -2
data/bin/death
CHANGED
@@ -1,24 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require 'open3'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
require 'java'
|
7
|
-
java.lang.System.getProperty('os.name') == 'Mac OS X'
|
8
|
-
else
|
9
|
-
RUBY_PLATFORM =~ /darwin/
|
10
|
-
end
|
11
|
-
end
|
3
|
+
lib_path = File.expand_path('../../lib', __FILE__)
|
4
|
+
$:.unshift(lib_path)
|
12
5
|
|
13
|
-
|
14
|
-
|
15
|
-
10.times { system('say -v Ralph deeeeeeeeeeeattttth &') }
|
16
|
-
|
17
|
-
Open3.popen3("kill #{ARGV.join(' ')}") do |stdin, stdout, stderr|
|
18
|
-
msg = stderr.read
|
19
|
-
if msg =~ /kill: illegal process id: kill/
|
20
|
-
puts 'death: illegal process id: kill'
|
21
|
-
else
|
22
|
-
puts "#{msg.gsub(/kill/, 'death')}"
|
23
|
-
end
|
24
|
-
end
|
6
|
+
require 'death'
|
7
|
+
Death::Command.death(ARGV.shift, ARGV.shift, ARGV)
|
data/bin/lml
CHANGED
@@ -1,24 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require 'open3'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
require 'java'
|
7
|
-
java.lang.System.getProperty('os.name') == 'Mac OS X'
|
8
|
-
else
|
9
|
-
RUBY_PLATFORM =~ /darwin/
|
10
|
-
end
|
11
|
-
end
|
3
|
+
lib_path = File.expand_path('../../lib', __FILE__)
|
4
|
+
$:.unshift(lib_path)
|
12
5
|
|
13
|
-
|
14
|
-
|
15
|
-
10.times { system('say -v Ralph deeeeeeeeeeeattttth &') }
|
16
|
-
|
17
|
-
Open3.popen3("kill #{ARGV.join(' ')}") do |stdin, stdout, stderr|
|
18
|
-
msg = stderr.read
|
19
|
-
if msg =~ /kill: illegal process id: kill/
|
20
|
-
puts 'death: illegal process id: kill'
|
21
|
-
else
|
22
|
-
puts "#{msg.gsub(/kill/, 'death')}"
|
23
|
-
end
|
24
|
-
end
|
6
|
+
require 'death'
|
7
|
+
Death::Command.death(ARGV.shift, ARGV.shift, ARGV)
|
data/death.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = Death::VERSION
|
8
8
|
|
9
9
|
s.authors = ['ITO Koichi']
|
10
|
-
s.date = '2012-
|
10
|
+
s.date = '2012-05-16'
|
11
11
|
s.description = 'kill command wrapper. say "DEATH" with death voice. Operating environment is Mac OS X only.'
|
12
12
|
s.email = 'koic.ito@gmail.com'
|
13
13
|
s.extra_rdoc_files = [
|
@@ -15,6 +15,9 @@ Gem::Specification.new do |s|
|
|
15
15
|
]
|
16
16
|
s.files = [
|
17
17
|
'README.rdoc',
|
18
|
+
'lib/death.rb',
|
19
|
+
'lib/death/command.rb',
|
20
|
+
'lib/death/core_ext/process.rb',
|
18
21
|
'lib/death/version.rb',
|
19
22
|
'bin/death',
|
20
23
|
'death.gemspec',
|
data/lib/death.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'open3'
|
3
|
+
|
4
|
+
module Death::Command
|
5
|
+
class << self
|
6
|
+
def death(signal, pid, *pids)
|
7
|
+
raise 'death command is supporting only Mac OS X.' unless support_os?
|
8
|
+
|
9
|
+
10.times { system('say -v Ralph deeeeeeeeeeeattttth &') }
|
10
|
+
|
11
|
+
Open3.popen3("kill #{[signal, pid, pids].join(' ')}") do |stdin, stdout, stderr|
|
12
|
+
msg = stderr.read
|
13
|
+
if msg =~ /kill: illegal process id: kill/
|
14
|
+
puts 'death: illegal process id: kill'
|
15
|
+
else
|
16
|
+
puts "#{msg.gsub(/kill/, 'death')}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
alias lml death
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def support_os?
|
26
|
+
if RUBY_PLATFORM == 'java'
|
27
|
+
require 'java'
|
28
|
+
java.lang.System.getProperty('os.name') == 'Mac OS X'
|
29
|
+
else
|
30
|
+
RUBY_PLATFORM =~ /darwin/
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/death/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: death
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: kill command wrapper. say "DEATH" with death voice. Operating environment
|
15
15
|
is Mac OS X only.
|
@@ -22,6 +22,9 @@ extra_rdoc_files:
|
|
22
22
|
- README.rdoc
|
23
23
|
files:
|
24
24
|
- README.rdoc
|
25
|
+
- lib/death.rb
|
26
|
+
- lib/death/command.rb
|
27
|
+
- lib/death/core_ext/process.rb
|
25
28
|
- lib/death/version.rb
|
26
29
|
- bin/death
|
27
30
|
- death.gemspec
|