spielbash 0.1.1 → 0.1.2

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: '09da61edc3e1a9325354e616ad9d9dd031828469'
4
- data.tar.gz: 106b73657f6a99e63b584981f0bc9a77f73c5447
3
+ metadata.gz: f2ed0eaabd98f95be89e69d8da0bfa557090f3b1
4
+ data.tar.gz: cee9b6dd3231c2a2dac196558c0c259511259f91
5
5
  SHA512:
6
- metadata.gz: 959d24a54faaebe57e0f9ddd75c81baf61e07eed707a075d48f6f3ca532e754fe73e7dbd195c067771c7afd9347b14e9aa9e3d7777f26680572374f125b873d5
7
- data.tar.gz: f9baca5a0481b7f322aca9490497916d63aa929531ea5d87039804eea777b880c16a9a680f80d15a88d1fe69221bfb39a78d4e354395cb73c3f99a901aa5398f
6
+ metadata.gz: 01ae477361331c97b80b691f2ad9278cdb3863b70eeb8b1c902ce8672f3a10fccd2331ac844082e6f80d16669a4a6645dbfc88741fb2e86641f7a9e582243437
7
+ data.tar.gz: 79a2c47f82b5b706c3776ced33e74a3d2005b5af12640ee4136a8e05e7780981512afb33614fd6941005bd81322951c87ad622023ad77527385e329acfdccd9c
@@ -15,6 +15,7 @@ module Spielbash
15
15
  sleep(action_context.reading_delay_s)
16
16
 
17
17
  session.send_key('C-h', message.length) if (action_context.delete)
18
+ sleep(action_context.typing_delay_s)
18
19
  end
19
20
  end
20
21
  end
@@ -31,7 +31,6 @@ module Spielbash
31
31
  action.execute(session)
32
32
  end
33
33
 
34
- session.stop_recording
35
34
  session.close_session
36
35
  end
37
36
 
@@ -26,10 +26,7 @@ module Spielbash
26
26
  end
27
27
 
28
28
  def close_session
29
- send_key("exit")
30
- send_key('C-m')
31
-
32
- wait
29
+ send_key("exit C-m")
33
30
  end
34
31
 
35
32
  # This will wait for tmux session pid to not have any child processes
@@ -47,7 +44,7 @@ module Spielbash
47
44
 
48
45
  def send_key(key, count=1)
49
46
  key = 'Space' if key == ' '
50
- execute_tmux_with("send-keys -t #{name} -N #{count} #{key}")
47
+ execute_tmux_with("send-keys -t #{name} -N #{count} #{key}", true)
51
48
  end
52
49
 
53
50
  def start_recording
@@ -60,7 +57,7 @@ module Spielbash
60
57
  private
61
58
 
62
59
  def exec_wait_check_cmd(pid)
63
- if context.wait_check_cmd.nil?
60
+ if is_real_environment
64
61
  execute_with('pgrep', "-P #{pid}", true)
65
62
  else
66
63
  cmd = context.wait_check_cmd.split
@@ -78,7 +75,7 @@ module Spielbash
78
75
  end
79
76
 
80
77
  def execute_with_exactly(cmd, wait, io_inherit, leader, *arguments)
81
- raise "Please install #{cmd}" if which(cmd).nil?
78
+ raise "Please install #{cmd}" if is_real_environment && which(cmd).nil?
82
79
 
83
80
  process = ChildProcess.build(cmd, *arguments)
84
81
  process.leader = leader
@@ -98,6 +95,10 @@ module Spielbash
98
95
  process
99
96
  end
100
97
 
98
+ def is_real_environment
99
+ context.wait_check_cmd.nil?
100
+ end
101
+
101
102
  def output(file)
102
103
  file.rewind
103
104
  out = file.read
@@ -1,3 +1,3 @@
1
1
  module Spielbash
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -10,8 +10,27 @@ module Spielbash
10
10
  desc 'Be verbose'
11
11
  switch [:v, :verbose]
12
12
 
13
- # pre do |global_options, command, options, args|
14
- # end
13
+ # Cross-platform way of finding an executable in the $PATH.
14
+ #
15
+ # which('ruby') #=> /usr/bin/ruby
16
+ def which(cmd)
17
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
18
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
19
+ exts.each {|ext|
20
+ exe = File.join(path, "#{cmd}#{ext}")
21
+ return true if File.executable?(exe) && !File.directory?(exe)
22
+ }
23
+ end
24
+ false
25
+ end
26
+
27
+ pre do |global_options, command, options, args|
28
+ help_now!('pgrep is not installed!') unless which('pgrep')
29
+ help_now!('docker is not installed!') unless which('docker')
30
+ help_now!('tmux is not installed!') unless which('tmux')
31
+ help_now!('resize is not installed!') unless which('resize')
32
+ help_now!('asciinema is not installed!') unless which('asciinema')
33
+ end
15
34
 
16
35
  desc 'Create a recording'
17
36
  command :record do |c|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spielbash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Malinskiy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-07 00:00:00.000000000 Z
11
+ date: 2018-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli