death 0.5.1 → 0.6.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b7408bd7681a4d44cf58af2c4e65cc8552b83d07
4
+ data.tar.gz: e30f146a73c61df70d8260783dc7dbbb47a91208
5
+ SHA512:
6
+ metadata.gz: d830f0906e12c3da8195394ace96d7be4a50ad14a6a54efa939581bab8cfa0ff4cbe53a4bc6d99b2e1e025ff62a6f671a9e08bad7b2590b1b8756dbe9a9b0690
7
+ data.tar.gz: ac20cd5c947df89dc63b3960998ef690c1c7681952ea4a4efc96b3ad1ed8d7affafae4f29e9f7a101a8b130e31e2932510bb717d97cf61ea1b03d012925b9aee
@@ -0,0 +1,40 @@
1
+ # death
2
+
3
+ kill command wrapper. say "DEATH" with death voice.
4
+
5
+ ## INSTALL
6
+
7
+ ```
8
+ $ gem install death
9
+ ```
10
+
11
+ ## SYNOPSIS
12
+
13
+ ```
14
+ death [-s signal_name] pid ...
15
+ death -l [exit_status]
16
+ death -signal_name pid ...
17
+ death -signal_number pid ...
18
+ ```
19
+
20
+ ### shortcut command
21
+
22
+ ```
23
+ lml
24
+ ```
25
+
26
+ ## Operating environment
27
+
28
+ Mac OS X (only)
29
+
30
+ ## LICENCE
31
+
32
+ The MIT Licence
33
+
34
+ ## Contributing
35
+
36
+ 1. Fork it
37
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
38
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
39
+ 4. Push to the branch (`git push origin my-new-feature`)
40
+ 5. Create new Pull Request
data/bin/death CHANGED
@@ -4,4 +4,4 @@ lib_path = File.expand_path('../../lib', __FILE__)
4
4
  $:.unshift(lib_path)
5
5
 
6
6
  require 'death'
7
- Death::Command.death(ARGV.shift, ARGV.shift, ARGV)
7
+ Process.death(ARGV.shift, ARGV.shift, ARGV)
data/bin/lml CHANGED
@@ -4,4 +4,4 @@ lib_path = File.expand_path('../../lib', __FILE__)
4
4
  $:.unshift(lib_path)
5
5
 
6
6
  require 'death'
7
- Death::Command.death(ARGV.shift, ARGV.shift, ARGV)
7
+ Process.death(ARGV.shift, ARGV.shift, ARGV)
@@ -6,26 +6,22 @@ Gem::Specification.new do |s|
6
6
  s.name = 'death'
7
7
  s.version = Death::VERSION
8
8
 
9
+ s.license = 'MIT'
10
+
9
11
  s.authors = ['ITO Koichi']
10
- s.date = '2012-05-16'
11
12
  s.description = 'kill command wrapper. say "DEATH" with death voice. Operating environment is Mac OS X only.'
12
13
  s.email = 'koic.ito@gmail.com'
13
- s.extra_rdoc_files = [
14
- 'README.rdoc'
15
- ]
16
- s.files = [
17
- 'README.rdoc',
18
- 'lib/death.rb',
19
- 'lib/death/command.rb',
20
- 'lib/death/core_ext/process.rb',
21
- 'lib/death/version.rb',
14
+ s.files = Dir[
15
+ 'README.md',
16
+ 'lib/**/*',
22
17
  'bin/death',
23
18
  'death.gemspec',
24
19
  'LICENSE'
25
20
  ]
21
+ s.add_dependency('facter')
22
+ s.add_development_dependency('rspec', '>= 3.0.0')
26
23
  s.homepage = 'http://github.com/koic/death-command'
27
24
  s.require_paths = ['lib']
28
25
  s.summary = 'kill command wrapper. say "DEATH" with death voice.'
29
26
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
30
27
  end
31
-
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env ruby
2
-
3
1
  module Death; end
4
2
  require 'death/command'
5
3
  require 'death/core_ext/process'
@@ -1,16 +1,17 @@
1
- #!/usr/bin/env ruby
1
+ require 'facter'
2
2
  require 'open3'
3
+ require 'shellwords'
3
4
 
4
5
  module Death::Command
5
6
  class << self
6
7
  def death(signal, pid, *pids)
7
- raise 'death command is supporting only Mac OS X.' unless support_os?
8
+ raise 'death command is supporting only Mac OS X.' unless supported_os?
8
9
 
9
- 10.times { system('say -v Ralph deeeeeeeeeeeattttth &') }
10
+ sound_pressure { system('say -v Ralph deeeeeeeeeeeattttth &') }
10
11
 
11
- Open3.popen3("kill #{[signal, pid, pids].join(' ')}") do |stdin, stdout, stderr|
12
+ Open3.popen3("kill #{[signal, pid, pids].flatten.shelljoin}") do |stdin, stdout, stderr|
12
13
  msg = stderr.read
13
- if msg =~ /kill: illegal process id: kill/
14
+ if /kill: illegal process id: kill/ === msg
14
15
  puts 'death: illegal process id: kill'
15
16
  else
16
17
  puts "#{msg.gsub(/kill/, 'death')}"
@@ -22,12 +23,18 @@ module Death::Command
22
23
 
23
24
  private
24
25
 
25
- def support_os?
26
+ def sound_pressure
27
+ processor_count = Facter[:processorcount].value
28
+
29
+ (processor_count * 3).times { yield }
30
+ end
31
+
32
+ def supported_os?
26
33
  if RUBY_PLATFORM == 'java'
27
34
  require 'java'
28
35
  java.lang.System.getProperty('os.name') == 'Mac OS X'
29
36
  else
30
- RUBY_PLATFORM =~ /darwin/
37
+ /darwin/ === RUBY_PLATFORM
31
38
  end
32
39
  end
33
40
  end
@@ -9,4 +9,3 @@ module Process
9
9
 
10
10
  module_function :death, :lml
11
11
  end
12
-
@@ -1,4 +1,3 @@
1
1
  module Death
2
- VERSION = '0.5.1'
2
+ VERSION = '0.6.0'
3
3
  end
4
-
metadata CHANGED
@@ -1,16 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: death
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
5
- prerelease:
4
+ version: 0.6.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - ITO Koichi
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-05-16 00:00:00.000000000 Z
13
- dependencies: []
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: facter
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 3.0.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 3.0.0
14
41
  description: kill command wrapper. say "DEATH" with death voice. Operating environment
15
42
  is Mac OS X only.
16
43
  email: koic.ito@gmail.com
@@ -18,41 +45,39 @@ executables:
18
45
  - death
19
46
  - lml
20
47
  extensions: []
21
- extra_rdoc_files:
22
- - README.rdoc
48
+ extra_rdoc_files: []
23
49
  files:
24
- - README.rdoc
50
+ - LICENSE
51
+ - README.md
52
+ - bin/death
53
+ - bin/lml
54
+ - death.gemspec
25
55
  - lib/death.rb
26
56
  - lib/death/command.rb
27
57
  - lib/death/core_ext/process.rb
28
58
  - lib/death/version.rb
29
- - bin/death
30
- - death.gemspec
31
- - LICENSE
32
- - !binary |-
33
- YmluL2xtbA==
34
59
  homepage: http://github.com/koic/death-command
35
- licenses: []
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
36
63
  post_install_message:
37
64
  rdoc_options: []
38
65
  require_paths:
39
66
  - lib
40
67
  required_ruby_version: !ruby/object:Gem::Requirement
41
- none: false
42
68
  requirements:
43
- - - ! '>='
69
+ - - ">="
44
70
  - !ruby/object:Gem::Version
45
71
  version: '0'
46
72
  required_rubygems_version: !ruby/object:Gem::Requirement
47
- none: false
48
73
  requirements:
49
- - - ! '>='
74
+ - - ">="
50
75
  - !ruby/object:Gem::Version
51
76
  version: '0'
52
77
  requirements: []
53
78
  rubyforge_project:
54
- rubygems_version: 1.8.21
79
+ rubygems_version: 2.4.5
55
80
  signing_key:
56
- specification_version: 3
81
+ specification_version: 4
57
82
  summary: kill command wrapper. say "DEATH" with death voice.
58
83
  test_files: []
@@ -1,27 +0,0 @@
1
- = death
2
-
3
- kill command wrapper. say "DEATH" with death voice.
4
-
5
- == INSTALL
6
-
7
- $ gem install death
8
-
9
- == SYNOPSIS
10
-
11
- death [-s signal_name] pid ...
12
- death -l [exit_status]
13
- death -signal_name pid ...
14
- death -signal_number pid ...
15
-
16
- === shortcut command
17
-
18
- lml
19
-
20
- == Operating environment
21
-
22
- Mac OS X (only)
23
-
24
- == LICENCE
25
-
26
- MIT
27
-