term-slides 0.11.0 → 0.12.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: 138b7b4ed7cfc89de8f0a18695dd9a3436f2ec1defd645f1d7f677fae06f5870
4
- data.tar.gz: 3732abab645f4e8f96802fafb051fd2c43e5b3855a0cdbd5c4fc029596d43cdf
3
+ metadata.gz: 291c6428c775da93ef7e019f155643b9906e2a73a68717dcac589a9b0232fdda
4
+ data.tar.gz: 1bfc84cf10873d70ceb2c3c501962748a0fe8514c57a9460a7f76a843bf257a8
5
5
  SHA512:
6
- metadata.gz: c314a3e436de1a74a87c25029c6271f3af3903eba3732ad809caa58a8d6f691abf701c5d3a1087ab2e0c1040d98f5a6c016e6d5ef035f08a524e60c0e3b04eed
7
- data.tar.gz: c008f47f52c08297f2250d108fefaf58147f69ca1c36a4fd22a17c6d09d63eb500af0023820838b5bdbdc815b3dd641ff10693d16fb1cdcf9463273c2d6b167f
6
+ metadata.gz: 1f48a8d1873ad8397086c3e4db96a950b221303a2547e7b7c0504dacdffc61b6029584997d99ce7390993cc5a1f0b416e1e815bf3347c16bb857291559eb3a6c
7
+ data.tar.gz: 3f5ea544c0c73c1b7a783d31d8a8e37d613ed53f7bbaa737780c3ebfc4128449bdaf8f0729bfb50728b050fabe30f0b6c5e9c01e92d43997e6448b9c542fea95
data/README.md CHANGED
@@ -6,6 +6,23 @@ Here is an example:
6
6
 
7
7
  ![Example](examples/basic_capture.gif)
8
8
 
9
+ Currently, image/diagram rendering is only available in [kitty](https://github.com/kovidgoyal/kitty).
10
+
11
+ ## Writing your presentation
12
+
13
+ see examples/basic.rb
14
+
15
+ ## Running it
16
+
17
+ just run your ruby script.
18
+
19
+ Controls:
20
+
21
+ - `n`: next slide
22
+ - `p`: previous slide
23
+ - `r`: refresh slide
24
+ - `q`: quit
25
+
9
26
  ## Installation
10
27
 
11
28
  Add this line to your application's Gemfile:
@@ -22,10 +39,6 @@ Or install it yourself as:
22
39
 
23
40
  $ gem install term-slides
24
41
 
25
- ## Usage
26
-
27
- see examples/basic.rb
28
-
29
42
  ## Development
30
43
 
31
44
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/examples/basic.rb CHANGED
@@ -8,7 +8,7 @@ TermSlides::Slides.new(ARGV) do
8
8
  t "t is an alias for text"
9
9
  end
10
10
  slide("code (requires vimcat)") do
11
- code :ruby, """
11
+ code :rb, """
12
12
  def example_code(a, b)
13
13
  p a
14
14
  end
data/lib/term-slides.rb CHANGED
@@ -36,10 +36,22 @@ module TermSlides
36
36
  def render_text text
37
37
  puts center(text.text)
38
38
  end
39
- def render_image_file src
40
- kitty = '/Applications/kitty.app/Contents/MacOS/kitty'
41
- kitty = 'kitty' unless File.exists? kitty
42
- `#{kitty} +kitten icat #{src}`
39
+ def render_image_file path
40
+ commands = {
41
+ "kitty" => %w(kitty +kitten icat),
42
+ "terminology" => %w(tycat)
43
+ }
44
+ ptree = `pstree -As $$`.chomp.split("---")
45
+ terminals = commands.keys.map { |terminal| ptree.include?(terminal) ? terminal : nil }.select { |x| !x.nil? }
46
+ if terminals.size > 0
47
+ command = commands[terminals.first]
48
+ else
49
+ command = ["icat"]
50
+ end
51
+ if find_executable(command.first)
52
+ co = (command << path)
53
+ system(*co)
54
+ end
43
55
  end
44
56
  def render_image image
45
57
  render_image_file image.src
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Term
2
2
  module Slides
3
- VERSION = "0.11.0"
3
+ VERSION = "0.12.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: term-slides
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yazgoo