killallapps 1.0.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.
- checksums.yaml +7 -0
- data/lib/executor/terminator.rb +36 -0
- data/lib/ps.rb +9 -0
- data/test/test.rb +3 -0
- metadata +45 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: fa619f018a7f16f1887b07aa1ea2f98788fa11b51ad56c993eeb1b7c219bf760
|
|
4
|
+
data.tar.gz: 7cdac36bb59b1015ed4c6559dbee435d9acea21bcfa7c53360aef822b71f8b94
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 816a2d4d6a4da1310f17078090cd9ed6883d2f996569737190f88648dc647493f242381441c7d9c7217db925a061f501ac2a8647521a526266c9f634c00f3559
|
|
7
|
+
data.tar.gz: c46343523768682090dd43a4146c36f742777c7fe6d360e6b85d104627471ccdb0c677a8a7a93ff80bc41d22e9cc6c2be8efceb66ea50d5e1615a0dd9dc35ffe
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module PS
|
|
2
|
+
class Terminator
|
|
3
|
+
def initialize(per)
|
|
4
|
+
@command = per
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def jalankan
|
|
8
|
+
raise RuntimeError, 'Not implemented'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.alive
|
|
12
|
+
return new('ps ax')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.kill
|
|
16
|
+
alive.tap do |instansi|
|
|
17
|
+
instansi.define_singleton_method(:jalankan) do
|
|
18
|
+
perintah = @command
|
|
19
|
+
hasil = `#{perintah}`
|
|
20
|
+
hasil.split(/\n/).each do |baris|
|
|
21
|
+
puts baris
|
|
22
|
+
next if baris.match(/\/usr\/bin\/ps/)
|
|
23
|
+
next if baris.match(/ruby/)
|
|
24
|
+
case baris
|
|
25
|
+
when /^\s+(\d+)/
|
|
26
|
+
pid = Regexp.last_match(1)
|
|
27
|
+
bash = "kill -KILL #{pid}"
|
|
28
|
+
puts bash
|
|
29
|
+
system(bash)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
data/lib/ps.rb
ADDED
data/test/test.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: killallapps
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Reckordp
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: Kill all process that available.
|
|
13
|
+
email:
|
|
14
|
+
- rmuhammad134@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/executor/terminator.rb
|
|
20
|
+
- lib/ps.rb
|
|
21
|
+
- test/test.rb
|
|
22
|
+
homepage: https://github.com/Reckordp/killallapps
|
|
23
|
+
licenses: []
|
|
24
|
+
metadata:
|
|
25
|
+
homepage_uri: https://github.com/Reckordp/killallapps
|
|
26
|
+
source_code_uri: https://github.com/Reckordp/killallapps
|
|
27
|
+
rdoc_options: []
|
|
28
|
+
require_paths:
|
|
29
|
+
- lib
|
|
30
|
+
- test
|
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
32
|
+
requirements:
|
|
33
|
+
- - ">="
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: '0'
|
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
requirements: []
|
|
42
|
+
rubygems_version: 4.0.0
|
|
43
|
+
specification_version: 4
|
|
44
|
+
summary: Killer.
|
|
45
|
+
test_files: []
|