death 0.4.1 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/bin/death CHANGED
@@ -1,24 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- require 'open3'
3
2
 
4
- def support_os?
5
- if RUBY_PLATFORM == 'java'
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
- raise 'death command is supporting only Mac OS X.' unless support_os?
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
- def support_os?
5
- if RUBY_PLATFORM == 'java'
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
- raise 'death command is supporting only Mac OS X.' unless support_os?
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)
@@ -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-04-27'
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',
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ module Death; end
4
+ require 'death/command'
5
+ require 'death/core_ext/process'
@@ -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
@@ -0,0 +1,12 @@
1
+ module Process
2
+ def death(signal, pid, *pids)
3
+ Death::Command.death(signal, pid, pids)
4
+ end
5
+
6
+ def lml(signal, pid, *pids)
7
+ Death::Command.lml(signal, pid, pids)
8
+ end
9
+
10
+ module_function :death, :lml
11
+ end
12
+
@@ -1,4 +1,4 @@
1
1
  module Death
2
- VERSION = '0.4.1'
2
+ VERSION = '0.5.1'
3
3
  end
4
4
 
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.1
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-04-27 00:00:00.000000000 Z
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