pstree 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/{README.rdoc → README.md} +19 -10
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/pstree.rb +4 -3
- data/lib/pstree/version.rb +1 -1
- data/pstree.gemspec +7 -7
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e5fbd5ee25caa62774236e9ea030cfa597dca95c82990dd0ac63eacdab3335ff
|
4
|
+
data.tar.gz: 55d1be85c1ebe13bf096d05f3ff39a931afb8461e3a8a2d2e4e50ab7dd007682
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a722fe87bf14802dc14bb06cb08a6f7fdfbb09f2afca77fd3ea196240aac9e961ac51e04392266ce9b893331a2a56272338e770e43f2b0474df6b1b37aa452d
|
7
|
+
data.tar.gz: 2f328652a567a1d1c6a67aa4cd75164398b6a4e71031e2d3403c91721a7401bcc8c33dad408b5a38ab0a41f0aad9732f3f85afde3c35878d86cc68b704b03a80
|
data/{README.rdoc → README.md}
RENAMED
@@ -1,29 +1,38 @@
|
|
1
|
-
|
1
|
+
# PSTree - Process Status Tree for UNIX in Ruby
|
2
2
|
|
3
|
-
|
3
|
+
## Description
|
4
4
|
|
5
5
|
This library can be used to create and display a process status tree as a Ruby
|
6
6
|
datastructure.
|
7
7
|
|
8
|
-
|
8
|
+
## Installation
|
9
9
|
|
10
10
|
Install the gem by typing
|
11
11
|
|
12
|
-
# gem install
|
12
|
+
# gem install pstree
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
The homepage of this library is located at
|
14
|
+
## Usage
|
17
15
|
|
18
16
|
You can display a simple process tree by executing the ruby-pstree script.
|
19
17
|
|
18
|
+
```
|
19
|
+
$ ruby-pstree $$
|
20
|
+
34223 -bash (flori)
|
21
|
+
└─ 37124 ruby /Users/flori/.rvm/gems/ruby-2.6.2/bin/ruby-pstree 34223 (flori)
|
22
|
+
└─ 37129 /bin/ps axww -o ppid,pid,user,command (root)
|
23
|
+
```
|
24
|
+
|
25
|
+
## Download
|
26
|
+
|
27
|
+
The homepage of this library is located at
|
28
|
+
|
20
29
|
* http://flori.github.com/pstree
|
21
30
|
|
22
|
-
|
31
|
+
## Author
|
23
32
|
|
24
|
-
Florian Frank
|
33
|
+
Florian Frank <flori@ping.de>
|
25
34
|
|
26
|
-
|
35
|
+
## License
|
27
36
|
|
28
37
|
This is free software; you can redistribute it and/or modify it under the
|
29
38
|
terms of the GNU General Public License Version 2 as published by the Free
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/pstree.rb
CHANGED
@@ -65,7 +65,7 @@ class PSTree
|
|
65
65
|
@process = {}
|
66
66
|
@pstree = Hash.new { |h,k| h[k] = [] }
|
67
67
|
pid = @root_pid.zero? ? nil : @root_pid
|
68
|
-
psoutput = `/bin/ps axww -o ppid,pid,user,command
|
68
|
+
psoutput = `/bin/ps axww -o ppid,pid,user,command`
|
69
69
|
psoutput.each_line do |line|
|
70
70
|
next if line !~ /^\s*\d+/
|
71
71
|
line.strip!
|
@@ -75,7 +75,8 @@ class PSTree
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
def recurse(pid, shift_callback = nil, level = 0, &node_callback)
|
78
|
+
def recurse(pid, shift_callback = nil, level = 0, in_root = false, &node_callback)
|
79
|
+
in_root = in_root || @root_pid == 0 || @root_pid == pid
|
79
80
|
@child_count[level] = @pstree[pid].size
|
80
81
|
for l in 0...level
|
81
82
|
shift_callback and shift_callback.call(@child_count[l], l == level - 1)
|
@@ -84,7 +85,7 @@ class PSTree
|
|
84
85
|
if @pstree.key?(pid)
|
85
86
|
@child_count[level] = @pstree[pid].size - 1
|
86
87
|
@pstree[pid].each do |ps|
|
87
|
-
recurse(ps.pid, shift_callback, level + 1, &node_callback)
|
88
|
+
recurse(ps.pid, shift_callback, level + 1, in_root, &node_callback)
|
88
89
|
@child_count[level] -= 1
|
89
90
|
end
|
90
91
|
end
|
data/lib/pstree/version.rb
CHANGED
data/pstree.gemspec
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: pstree 0.
|
2
|
+
# stub: pstree 0.3.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "pstree".freeze
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.3.0"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["Florian Frank".freeze]
|
11
|
-
s.date = "
|
11
|
+
s.date = "2019-04-15"
|
12
12
|
s.description = "This library uses the output of the ps command to creaste process tree data structure for the current host.".freeze
|
13
13
|
s.email = "flori@ping.de".freeze
|
14
14
|
s.executables = ["ruby-pstree".freeze]
|
15
|
-
s.extra_rdoc_files = ["README.
|
16
|
-
s.files = [".gitignore".freeze, "Gemfile".freeze, "README.
|
15
|
+
s.extra_rdoc_files = ["README.md".freeze, "lib/pstree.rb".freeze, "lib/pstree/version.rb".freeze]
|
16
|
+
s.files = [".gitignore".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/ruby-pstree".freeze, "lib/pstree.rb".freeze, "lib/pstree/version.rb".freeze, "pstree.gemspec".freeze]
|
17
17
|
s.homepage = "http://flori.github.com/pstree".freeze
|
18
18
|
s.licenses = ["GPL-2".freeze]
|
19
|
-
s.rdoc_options = ["--title".freeze, "Pstree - Ruby library that builds a process tree of this host".freeze, "--main".freeze, "README.
|
20
|
-
s.rubygems_version = "
|
19
|
+
s.rdoc_options = ["--title".freeze, "Pstree - Ruby library that builds a process tree of this host".freeze, "--main".freeze, "README.md".freeze]
|
20
|
+
s.rubygems_version = "3.0.3".freeze
|
21
21
|
s.summary = "Ruby library that builds a process tree of this host".freeze
|
22
22
|
|
23
23
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pstree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Frank
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_hadar
|
@@ -45,13 +45,13 @@ executables:
|
|
45
45
|
- ruby-pstree
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files:
|
48
|
-
- README.
|
48
|
+
- README.md
|
49
49
|
- lib/pstree.rb
|
50
50
|
- lib/pstree/version.rb
|
51
51
|
files:
|
52
52
|
- ".gitignore"
|
53
53
|
- Gemfile
|
54
|
-
- README.
|
54
|
+
- README.md
|
55
55
|
- Rakefile
|
56
56
|
- VERSION
|
57
57
|
- bin/ruby-pstree
|
@@ -67,7 +67,7 @@ rdoc_options:
|
|
67
67
|
- "--title"
|
68
68
|
- Pstree - Ruby library that builds a process tree of this host
|
69
69
|
- "--main"
|
70
|
-
- README.
|
70
|
+
- README.md
|
71
71
|
require_paths:
|
72
72
|
- lib
|
73
73
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -81,8 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
|
-
|
85
|
-
rubygems_version: 2.6.13
|
84
|
+
rubygems_version: 3.0.3
|
86
85
|
signing_key:
|
87
86
|
specification_version: 4
|
88
87
|
summary: Ruby library that builds a process tree of this host
|