killall 0.1.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: 4ac3d5808c735e7c53c6d2bb4ba19305a375ebf6
4
+ data.tar.gz: 7af59d15d950997954977c2c003f4da9c9e12fe9
5
+ SHA512:
6
+ metadata.gz: 61000fcd48f5251374a766c50ef00397ed993a046044ddafdecc29639af9b3cf5861fb3d1f53fdd29358e2fdb74ec07cd4ff69a71e265d0649c2456421e03db3
7
+ data.tar.gz: 14a27ea295d3ce6fd4569fe54cd6a50f124a8945800d67cf2537dc83e514642baf19ed32b558f9b18481a1d496871c56f442b7176be837cff8f5babae68deba9
@@ -0,0 +1 @@
1
+ *~
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source :rubygems
2
+
3
+ # specified in killall.gemspec
4
+ gemspec
@@ -0,0 +1,14 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ killall (0.1.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ killall!
@@ -0,0 +1,18 @@
1
+ Killall
2
+ =======
3
+
4
+ A simple gem that provides `killall` functionality to Ruby. Only works in Linux currently.
5
+
6
+ Example
7
+ -------
8
+
9
+ ```
10
+ require 'killall'
11
+
12
+ Process.killall 'rake foo:bar'
13
+ ```
14
+
15
+ Small print
16
+ -----------
17
+
18
+ Copyright (c) Fork Ltd. (http://forkhq.com), released under the MIT license.
@@ -0,0 +1,8 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ begin
5
+ require 'rspec/core/rake_task'
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ rescue LoadError
8
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "killall"
5
+ s.version = '0.1.0'
6
+ s.platform = Gem::Platform::RUBY
7
+ s.authors = ['Tomás Pollak']
8
+ s.email = ['tomas@forkhq.com']
9
+ s.homepage = "https://github.com/tomas/tunable"
10
+ s.summary = "Process.killall('process-name')"
11
+ s.description = "Process.killall('process-name')"
12
+
13
+ s.required_rubygems_version = ">= 1.3.6"
14
+ # s.rubyforge_project = "killall"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
18
+ s.require_path = 'lib'
19
+ end
@@ -0,0 +1,24 @@
1
+ module Process
2
+
3
+ DEFAULT_SIGNAL = 'term'.freeze
4
+
5
+ def self.killall(name, signal = DEFAULT_SIGNAL)
6
+ begin
7
+ killall!(name, signal)
8
+ rescue Errno::ENOENT, Errno::EPERM => e
9
+ # puts "Error: #{e.message}"
10
+ end
11
+ end
12
+
13
+ def self.killall!(name, signal = DEFAULT_SIGNAL)
14
+ pids = `ps -ef | grep -vE \"^USER|grep\" | grep '#{name}' | awk '{print $2}'`.chomp.split("\n")
15
+
16
+ # puts "Found #{pids.count} processes matching '#{name}'"
17
+ raise Errno::ENOENT if pids.empty?
18
+
19
+ pids.each do |pid|
20
+ Process.kill(signal, pid.to_i)
21
+ end
22
+ end
23
+
24
+ end
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: killall
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tomás Pollak
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-19 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Process.killall('process-name')
14
+ email:
15
+ - tomas@forkhq.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - Gemfile
22
+ - Gemfile.lock
23
+ - README.md
24
+ - Rakefile
25
+ - killall.gemspec
26
+ - lib/killall.rb
27
+ homepage: https://github.com/tomas/tunable
28
+ licenses: []
29
+ metadata: {}
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.3.6
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 2.2.0
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: Process.killall('process-name')
50
+ test_files: []
51
+ has_rdoc: