pstree 0.1.0 → 0.2.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
2
  SHA1:
3
- metadata.gz: ad335e8074b06f733803b8ec7cf4be22cd5103dc
4
- data.tar.gz: d8e8be53530293935cd80346e657af3fbe5ed507
3
+ metadata.gz: e014bdaf62c7729a110d61a4a6e843203794f63d
4
+ data.tar.gz: 82a952887e613b3e207156254eca617cca7f1530
5
5
  SHA512:
6
- metadata.gz: 489409a0b6400fea32775ceb01b771acd5bd36b4c41c178ca2aeef1f69beff5b5a67c0172cbf4f09e2b0bb9ad5a36b9cec693ef5159112f43733db80fab1ba15
7
- data.tar.gz: f72c859c9ded4b1fc787e2a92bf7f4d5f71c5f3c178721a7cab8edee6801a645e08efd7d39693d5f80854ebd06a98ac4b2a583fbf6f8847ee9d68560bb06691e
6
+ metadata.gz: ecb0e4c7184909e8f01242a766fa568ef4e7ee3d501ce092aab890a0f25eb5a9512392e11ea368ae0222c2d8f2ea233d30c2fce7d320e6748036ce2c4d7bb48f
7
+ data.tar.gz: 27c9c88f99d4451ac72b4f8e6fc6f4406e8551bab0925b8b650b9972c0ab58817eab1ad82f80575faa08db8b69260ebd0d5570ecf9f8a5d634c7746ed4cd1bd3
data/.gitignore CHANGED
@@ -1,5 +1,4 @@
1
1
  .*.sw[pon]
2
- .bundle
3
2
  .rvmrc
4
3
  Gemfile.lock
5
4
  coverage
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ GemHadar do
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
- ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', '.rvmrc', 'coverage', '.bundle'
16
+ ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', '.rvmrc', 'coverage'
17
17
  readme 'README.rdoc'
18
18
  executables << 'ruby-pstree'
19
19
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/lib/pstree.rb CHANGED
@@ -15,19 +15,36 @@ class PSTree
15
15
 
16
16
  include Enumerable
17
17
 
18
- def initialize(root_pid = nil)
18
+ def initialize(root_pid = nil, charset: 'UTF-8')
19
+ @charset = charset.to_s.upcase
19
20
  @root_pid = root_pid.to_i
20
21
  end
21
22
 
23
+ def children_zero(last)
24
+ if @charset == 'UTF-8'
25
+ last ? '└─ ' : ' '
26
+ else
27
+ last ? '`- ' : ' '
28
+ end
29
+ end
30
+
31
+ def children_not_zero(last)
32
+ if @charset == 'UTF-8'
33
+ last ? '├─ ' : '│ '
34
+ else
35
+ last ? '+- ' : '| '
36
+ end
37
+ end
38
+
22
39
  def to_s
23
40
  build
24
41
  result = ''
25
42
  recurse @root_pid,
26
43
  -> children, last {
27
44
  if children.zero?
28
- result << (last ? '`-- ' : ' ')
45
+ result << children_zero(last)
29
46
  else
30
- result << (last ? '+-- ' : '| ')
47
+ result << children_not_zero(last)
31
48
  end
32
49
  } do |ps|
33
50
  result << ps.to_s << "\n"
@@ -1,6 +1,6 @@
1
1
  class PSTree
2
2
  # PSTree version
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.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:
data/pstree.gemspec CHANGED
@@ -1,37 +1,37 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: pstree 0.1.0 ruby lib
2
+ # stub: pstree 0.2.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.name = "pstree"
6
- s.version = "0.1.0"
5
+ s.name = "pstree".freeze
6
+ s.version = "0.2.0"
7
7
 
8
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
- s.require_paths = ["lib"]
10
- s.authors = ["Florian Frank"]
11
- s.date = "2014-02-06"
12
- s.description = "This library uses the output of the ps command to creaste process tree data structure for the current host."
13
- s.email = "flori@ping.de"
14
- s.executables = ["ruby-pstree"]
15
- s.extra_rdoc_files = ["README.rdoc", "lib/pstree.rb", "lib/pstree/version.rb"]
16
- s.files = [".gitignore", "Gemfile", "README.rdoc", "Rakefile", "VERSION", "bin/ruby-pstree", "lib/pstree.rb", "lib/pstree/version.rb", "pstree.gemspec"]
17
- s.homepage = "http://flori.github.com/pstree"
18
- s.licenses = ["GPL-2"]
19
- s.rdoc_options = ["--title", "Pstree - Ruby library that builds a process tree of this host", "--main", "README.rdoc"]
20
- s.rubygems_version = "2.2.2"
21
- s.summary = "Ruby library that builds a process tree of this host"
8
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
+ s.require_paths = ["lib".freeze]
10
+ s.authors = ["Florian Frank".freeze]
11
+ s.date = "2017-11-07"
12
+ s.description = "This library uses the output of the ps command to creaste process tree data structure for the current host.".freeze
13
+ s.email = "flori@ping.de".freeze
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
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
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
24
24
  s.specification_version = 4
25
25
 
26
26
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
- s.add_development_dependency(%q<gem_hadar>, ["~> 1.0.0"])
28
- s.add_development_dependency(%q<simplecov>, [">= 0"])
27
+ s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.9.1"])
28
+ s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
29
29
  else
30
- s.add_dependency(%q<gem_hadar>, ["~> 1.0.0"])
31
- s.add_dependency(%q<simplecov>, [">= 0"])
30
+ s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.9.1"])
31
+ s.add_dependency(%q<simplecov>.freeze, [">= 0"])
32
32
  end
33
33
  else
34
- s.add_dependency(%q<gem_hadar>, ["~> 1.0.0"])
35
- s.add_dependency(%q<simplecov>, [">= 0"])
34
+ s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.9.1"])
35
+ s.add_dependency(%q<simplecov>.freeze, [">= 0"])
36
36
  end
37
37
  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.1.0
4
+ version: 0.2.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: 2014-02-06 00:00:00.000000000 Z
11
+ date: 2017-11-07 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.0.0
19
+ version: 1.9.1
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.0.0
26
+ version: 1.9.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: simplecov
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 2.2.2
85
+ rubygems_version: 2.6.13
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Ruby library that builds a process tree of this host