pstree 0.2.0 → 0.3.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.
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: 2429e1d084cac9859aaa8677db294d46d95c99fa6d2c56f550782ce33a195447
4
+ data.tar.gz: 307882fe91950b9d5176ab73034c27765833f8c6927593603ef413e6318f1368
5
5
  SHA512:
6
- metadata.gz: ecb0e4c7184909e8f01242a766fa568ef4e7ee3d501ce092aab890a0f25eb5a9512392e11ea368ae0222c2d8f2ea233d30c2fce7d320e6748036ce2c4d7bb48f
7
- data.tar.gz: 27c9c88f99d4451ac72b4f8e6fc6f4406e8551bab0925b8b650b9972c0ab58817eab1ad82f80575faa08db8b69260ebd0d5570ecf9f8a5d634c7746ed4cd1bd3
6
+ metadata.gz: b3b5616d54fbeba092270820559bdb0cff8d56955183db5793af12afccf41db76741e5c102efa227fac481abd88051520ac79893af2eac5d86b8c4e366e9c457
7
+ data.tar.gz: 4fe3d17d87130083f37dffe188f766e030d4df8c3f353a2a5ee3bfe46c34aa9b4b53dc47a02e12aab34a00232fb1b61db1c74d0bdbfad6123537ad9b57aaf3ba
@@ -0,0 +1,72 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ master ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ master ]
20
+ schedule:
21
+ - cron: '38 16 * * 4'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'ruby' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v3
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v2
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+
52
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53
+ # queries: security-extended,security-and-quality
54
+
55
+
56
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57
+ # If this step fails, then you should remove it and run the build manually (see below)
58
+ - name: Autobuild
59
+ uses: github/codeql-action/autobuild@v2
60
+
61
+ # ℹ️ Command-line programs to run using the OS shell.
62
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63
+
64
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
65
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66
+
67
+ # - run: |
68
+ # echo "Run, Build Application using script"
69
+ # ./location_of_script_within_repo/buildscript.sh
70
+
71
+ - name: Perform CodeQL Analysis
72
+ uses: github/codeql-action/analyze@v2
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.2.3
@@ -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
@@ -8,13 +8,13 @@ GemHadar do
8
8
  module_type 'class'
9
9
  author 'Florian Frank'
10
10
  email 'flori@ping.de'
11
- homepage "http://flori.github.com/#{name}"
11
+ homepage "https://github.com/flori/#{name}"
12
12
  summary 'Ruby library that builds a process tree of this host'
13
13
  description 'This library uses the output of the ps command to creaste process tree data structure for the current host.'
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.1
@@ -1,6 +1,6 @@
1
1
  class PSTree
2
2
  # PSTree version
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.1'
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:
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 #{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
data/pstree.gemspec CHANGED
@@ -1,37 +1,27 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: pstree 0.2.0 ruby lib
2
+ # stub: pstree 0.3.1 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.1"
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 = "2024-03-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]
17
- s.homepage = "http://flori.github.com/pstree".freeze
15
+ s.extra_rdoc_files = ["README.md".freeze, "lib/pstree.rb".freeze, "lib/pstree/version.rb".freeze]
16
+ s.files = [".github/workflows/codeql-analysis.yml".freeze, ".gitignore".freeze, ".tool-versions".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
+ s.homepage = "https://github.com/flori/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.4.19".freeze
21
21
  s.summary = "Ruby library that builds a process tree of this host".freeze
22
22
 
23
- if s.respond_to? :specification_version then
24
- s.specification_version = 4
23
+ s.specification_version = 4
25
24
 
26
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
- s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.9.1"])
28
- s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
29
- else
30
- s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.9.1"])
31
- s.add_dependency(%q<simplecov>.freeze, [">= 0"])
32
- end
33
- else
34
- s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.9.1"])
35
- s.add_dependency(%q<simplecov>.freeze, [">= 0"])
36
- end
25
+ s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.14.0"])
26
+ s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
37
27
  end
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2024-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.9.1
19
+ version: 1.14.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.9.1
26
+ version: 1.14.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: simplecov
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -45,29 +45,31 @@ 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
+ - ".github/workflows/codeql-analysis.yml"
52
53
  - ".gitignore"
54
+ - ".tool-versions"
53
55
  - Gemfile
54
- - README.rdoc
56
+ - README.md
55
57
  - Rakefile
56
58
  - VERSION
57
59
  - bin/ruby-pstree
58
60
  - lib/pstree.rb
59
61
  - lib/pstree/version.rb
60
62
  - pstree.gemspec
61
- homepage: http://flori.github.com/pstree
63
+ homepage: https://github.com/flori/pstree
62
64
  licenses:
63
65
  - GPL-2
64
66
  metadata: {}
65
- post_install_message:
67
+ post_install_message:
66
68
  rdoc_options:
67
69
  - "--title"
68
70
  - Pstree - Ruby library that builds a process tree of this host
69
71
  - "--main"
70
- - README.rdoc
72
+ - README.md
71
73
  require_paths:
72
74
  - lib
73
75
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -81,9 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
83
  - !ruby/object:Gem::Version
82
84
  version: '0'
83
85
  requirements: []
84
- rubyforge_project:
85
- rubygems_version: 2.6.13
86
- signing_key:
86
+ rubygems_version: 3.4.19
87
+ signing_key:
87
88
  specification_version: 4
88
89
  summary: Ruby library that builds a process tree of this host
89
90
  test_files: []