rkilly 0.0.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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/rkilly +3 -0
  3. data/lib/rkilly.rb +38 -0
  4. metadata +62 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3ae71ed523f25593859f09d5bafe98891ed81392
4
+ data.tar.gz: ab436125ec617e57aa0f208b02e34660a1007130
5
+ SHA512:
6
+ metadata.gz: e41c3fe903859f7ffbd916b274f1e437ee091aee0ebf973ccc4a1a47459db79e236f1e4cf248181b1ded6745e17a2a71b01b93f532de3243ac444ea67682daca
7
+ data.tar.gz: 01d6f93ae9c63d01b35c9975120e61911f2ffb8e18b28d8e5555c82b2655eddc109d935e4015dabd3edc9d1ff3ba187062d2941b259be59f1652695ba21c6c50
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'Rkilly'
@@ -0,0 +1,38 @@
1
+ module Rkilly
2
+ require 'rubygems'
3
+ require 'commander/import'
4
+
5
+ program :version, '0.0.1'
6
+ program :description, 'Easily kill processes'
7
+
8
+ command :kill do |c|
9
+ c.syntax = 'kill [process name]'
10
+ c.summary = 'Easily kill a process'
11
+ c.description = 'Finds all processes that match [process name] and allows you to kill any specific match or all matches.'
12
+ c.action do |args, options|
13
+ pname = args[0]
14
+ data_array = %x(ps aux | grep #{pname} | grep -v grep | awk '{print $2, $11, $12, $13}').split("\n").drop(1)
15
+
16
+ container_array = []
17
+ data_array.each do |cols|
18
+ elements = cols.split(' ')
19
+ elements = [elements.first, elements[1...elements.size].join(' ')]
20
+ elements.each_slice(2) { |slice| container_array << slice }
21
+ end
22
+
23
+ choose 'Which would you like to kill?' do |menu|
24
+ container_array.map { |e| e.last }.each_with_index do |choice, index|
25
+ menu.choice(choice) do
26
+ %x(kill -9 #{container_array[index].first.to_i})
27
+ end
28
+ end
29
+
30
+ menu.choice('All') do
31
+ container_array.map { |e| e.first }.each do |pid|
32
+ %x(kill -9 #{pid.to_i})
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rkilly
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Christopher Berube
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: commander
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
27
+ description: Provides a kill command which finds all processes that match the provided
28
+ argument and allows you to kill any specific match or all matches.
29
+ email:
30
+ - cberube@adharmonics.com
31
+ executables:
32
+ - rkilly
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - bin/rkilly
37
+ - lib/rkilly.rb
38
+ homepage: https://github.com/crberube/rkilly
39
+ licenses:
40
+ - MIT
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 2.2.2
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: Easily kill processes
62
+ test_files: []