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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e014bdaf62c7729a110d61a4a6e843203794f63d
4
- data.tar.gz: 82a952887e613b3e207156254eca617cca7f1530
2
+ SHA256:
3
+ metadata.gz: e5fbd5ee25caa62774236e9ea030cfa597dca95c82990dd0ac63eacdab3335ff
4
+ data.tar.gz: 55d1be85c1ebe13bf096d05f3ff39a931afb8461e3a8a2d2e4e50ab7dd007682
5
5
  SHA512:
6
- metadata.gz: ecb0e4c7184909e8f01242a766fa568ef4e7ee3d501ce092aab890a0f25eb5a9512392e11ea368ae0222c2d8f2ea233d30c2fce7d320e6748036ce2c4d7bb48f
7
- data.tar.gz: 27c9c88f99d4451ac72b4f8e6fc6f4406e8551bab0925b8b650b9972c0ab58817eab1ad82f80575faa08db8b69260ebd0d5570ecf9f8a5d634c7746ed4cd1bd3
6
+ metadata.gz: 2a722fe87bf14802dc14bb06cb08a6f7fdfbb09f2afca77fd3ea196240aac9e961ac51e04392266ce9b893331a2a56272338e770e43f2b0474df6b1b37aa452d
7
+ data.tar.gz: 2f328652a567a1d1c6a67aa4cd75164398b6a4e71031e2d3403c91721a7401bcc8c33dad408b5a38ab0a41f0aad9732f3f85afde3c35878d86cc68b704b03a80
@@ -1,29 +1,38 @@
1
- = PSTree - Process Status Tree for UNIX in Ruby
1
+ # PSTree - Process Status Tree for UNIX in Ruby
2
2
 
3
- == Description
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
- == Installation
8
+ ## Installation
9
9
 
10
10
  Install the gem by typing
11
11
 
12
- # gem install term-ansicolor
12
+ # gem install pstree
13
13
 
14
- == Download
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
- == Author
31
+ ## Author
23
32
 
24
- Florian Frank mailto:flori@ping.de
33
+ Florian Frank <flori@ping.de>
25
34
 
26
- == License
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
@@ -14,7 +14,7 @@ GemHadar do
14
14
  licenses << 'GPL-2'
15
15
  test_dir 'tests'
16
16
  ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', '.rvmrc', 'coverage'
17
- readme 'README.rdoc'
17
+ readme 'README.md'
18
18
  executables << 'ruby-pstree'
19
19
 
20
20
  development_dependency 'simplecov'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -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 #{pid}`
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
@@ -1,6 +1,6 @@
1
1
  class PSTree
2
2
  # PSTree version
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -1,23 +1,23 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: pstree 0.2.0 ruby lib
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.2.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 = "2017-11-07"
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.rdoc".freeze, "lib/pstree.rb".freeze, "lib/pstree/version.rb".freeze]
16
- s.files = [".gitignore".freeze, "Gemfile".freeze, "README.rdoc".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/ruby-pstree".freeze, "lib/pstree.rb".freeze, "lib/pstree/version.rb".freeze, "pstree.gemspec".freeze]
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.rdoc".freeze]
20
- s.rubygems_version = "2.6.13".freeze
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.2.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: 2017-11-07 00:00:00.000000000 Z
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.rdoc
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.rdoc
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.rdoc
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
- rubyforge_project:
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