term-slides 0.13.0 → 0.14.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
  SHA256:
3
- metadata.gz: 7303882ed8374ac8cf3256cd706c9a5687c8abc7cc3696fec7ee088780fd56fb
4
- data.tar.gz: 119277402543cbc0f5611635c7e2471dcb283d812d6ae03ef370f0395f0beeec
3
+ metadata.gz: c0f6ce8ea24b563ab91dabfdaa5e3062acdd203eea706bbd6580b9635f71e5c4
4
+ data.tar.gz: 1ebbefa2999d127f7e59d8ebeedca2b727cf3645dbe2b9bfeecf865b8129b2b0
5
5
  SHA512:
6
- metadata.gz: 775784799ab636f6f0deb82018d4bb0ba18178fc835f9545ceb3a477aeb4939cae7a7e5af20efafb3f78e9a36056b3dbfaef3e136e3d243a7dc41f351a9421e2
7
- data.tar.gz: '09c7ae6a4eb3d72bde5bac34f0c9d7c499a81a44a9a2faebd3fda30f42eb0172d4518d2b4bcd543359a1081d686bd1c3b828f747d64cd918f264539605d0b133'
6
+ metadata.gz: b6e1ab7f5fe6e8dbad00c033bebf1cc0d7e75cef175b68e06a331c8208f86c51f97828bd7d7e087abe37a4e7c699bef130c87d028c458fe7890c6c75d4999688
7
+ data.tar.gz: cf1229bd69ba27081fbf6dd34efb04e8247dc74cccb4e514a2122e46d8acf53aea07fbc0cc9bb05643e5af2b767348bce48c3ad4435c215cfc2a84edf8d969a8
data/examples/basic.rb CHANGED
@@ -7,7 +7,7 @@ TermSlides::Slides.new(ARGV) do
7
7
  text ""
8
8
  t "t is an alias for text"
9
9
  end
10
- slide("code (requires vimcat)") do
10
+ slide("code") do
11
11
  code :rb, """
12
12
  def example_code(a, b)
13
13
  p a
@@ -21,13 +21,13 @@ TermSlides::Slides.new(ARGV) do
21
21
  row :sym1, :sym2
22
22
  end
23
23
  end
24
- slide("diagram (requires dot (graphviz), terminal must support it)") do
24
+ slide("diagram (requires dot (graphviz))") do
25
25
  diagram 'digraph {
26
26
  a -> b
27
27
  dpi = 55
28
28
  }'
29
29
  end
30
- slide("image (terminal must support it)") do
30
+ slide("image") do
31
31
  image "#{File.dirname(__FILE__)}/cat.jpg"
32
32
  end
33
33
  end.run
data/lib/term-slides.rb CHANGED
@@ -29,12 +29,25 @@ module TermSlides
29
29
  def render_text text
30
30
  puts center(text.text)
31
31
  end
32
+ def pstree pid = Process.pid
33
+ processes = []
34
+ while pid != 0
35
+ `/bin/ps axww -q #{pid} -o ppid,command`.each_line do |line|
36
+ next if line !~ /^\s*\d+/
37
+ line.strip!
38
+ result = line.split(/\s+/, 2)
39
+ processes << result[1].split(" ").first.split("/").last
40
+ pid = result[0].to_i
41
+ end
42
+ end
43
+ processes
44
+ end
32
45
  def render_image_file path
33
46
  commands = {
34
47
  "kitty" => %w(kitty +kitten icat),
35
48
  "terminology" => %w(tycat)
36
49
  }
37
- ptree = `pstree -As $$`.chomp.split("---")
50
+ ptree = pstree
38
51
  terminals = commands.keys.map { |terminal| ptree.include?(terminal) ? terminal : nil }.select { |x| !x.nil? }
39
52
  if terminals.size > 0
40
53
  command = commands[terminals.first]
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Term
2
2
  module Slides
3
- VERSION = "0.13.0"
3
+ VERSION = "0.14.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: term-slides
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yazgoo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-11 00:00:00.000000000 Z
11
+ date: 2019-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize