shellplay 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/bin/shellplay +8 -5
- data/bin/shellrecord +15 -3
- data/lib/shellplay/screen.rb +5 -2
- data/lib/shellplay/session.rb +5 -0
- data/shellplay.gemspec +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7657c1610c246bcbe72ae189489046b76a8b1d9f
|
4
|
+
data.tar.gz: 6edd875cdec45dd5149037dc2f457ea72792f637
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc028631ed8f02d854a85dd08c9d533986cd949960e48293d6791feca35e15049361e992a15740cd91dd98223363dbbea706652f9e7bfd60bac7874ea340179e
|
7
|
+
data.tar.gz: 1cd22695718111aa4a4d30da5e06dbe1f89cf5f05f84587cf23fb37d56d82a1a5121de50d8b1a3caa598a8f948628c4b5919c4e4f779caf9292a79abb01891e9
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Shellplay Changelog
|
2
2
|
=========================
|
3
3
|
|
4
|
+
v0.0.4 - 2014-08-12
|
5
|
+
------------------
|
6
|
+
- add changelog link in the gemspec
|
7
|
+
- add a `##` record option for inhibiting display of the play prompt
|
8
|
+
- add a `d` record command to drop last screen
|
9
|
+
|
4
10
|
v0.0.3 - 2014-08-11
|
5
11
|
-------------------
|
6
12
|
- fix shellrecord that was broken after incomplete file renaming
|
data/bin/shellplay
CHANGED
@@ -16,6 +16,7 @@ require 'shellplay/session'
|
|
16
16
|
continue = true
|
17
17
|
@sleeptime = 1.0/48.0
|
18
18
|
@lastelapsed = 0
|
19
|
+
@noplayprompt = false
|
19
20
|
|
20
21
|
counter = 1
|
21
22
|
def usage
|
@@ -40,8 +41,10 @@ def display(screen)
|
|
40
41
|
else
|
41
42
|
@lastelapsed = 0
|
42
43
|
end
|
43
|
-
|
44
|
-
|
44
|
+
printf screen.stdout
|
45
|
+
if screen.stderr != ""
|
46
|
+
printf "\n#{Paint[screen.stderr, :red]}"
|
47
|
+
end
|
45
48
|
end
|
46
49
|
|
47
50
|
def shownext
|
@@ -65,7 +68,7 @@ def show(index)
|
|
65
68
|
end
|
66
69
|
|
67
70
|
while continue do
|
68
|
-
printf "\e[36m>\e[0m "
|
71
|
+
printf "\n\e[36m>\e[0m " if @playprompt
|
69
72
|
printf "\e[35melapsed: #{@lastelapsed}s\e[0m " unless @lastelapsed == 0
|
70
73
|
command = STDIN.gets.strip
|
71
74
|
case command
|
@@ -85,11 +88,11 @@ while continue do
|
|
85
88
|
else
|
86
89
|
Open3.popen3("bash","-l","-c",command.strip) do |i, o, e, t|
|
87
90
|
o.read.split("\n").each do |line|
|
88
|
-
|
91
|
+
printf line
|
89
92
|
sleep sleeptime
|
90
93
|
end
|
91
94
|
e.read.split("\n").each do |line|
|
92
|
-
|
95
|
+
printf Paint[line, :red]
|
93
96
|
end
|
94
97
|
end
|
95
98
|
end
|
data/bin/shellrecord
CHANGED
@@ -17,16 +17,27 @@ prompt = "\e[36mrecord >\e[0m"
|
|
17
17
|
while continue do
|
18
18
|
printf("\e[36mrecord >\e[33m %d > \e[0m", session.pointer)
|
19
19
|
command = STDIN.gets.strip
|
20
|
-
|
20
|
+
case command
|
21
|
+
when "q"
|
21
22
|
session.save
|
22
23
|
puts "\nRecord ended.\n"
|
23
24
|
continue = false
|
25
|
+
when "d"
|
26
|
+
if session.pointer == 0
|
27
|
+
puts "There is no screen to delete."
|
28
|
+
else
|
29
|
+
session.drop_last_screen
|
30
|
+
end
|
24
31
|
else
|
32
|
+
displaycommand = true
|
33
|
+
playprompt = true
|
25
34
|
if command[0] == '#'
|
26
35
|
command = command[1..-1].strip
|
27
36
|
displaycommand = false
|
28
|
-
|
29
|
-
|
37
|
+
if command[0] == '#'
|
38
|
+
command = command[1..-1].strip
|
39
|
+
playprompt = false
|
40
|
+
end
|
30
41
|
end
|
31
42
|
start_time = Time.now
|
32
43
|
Open3.popen3("bash","-l","-c",command) do |i, o, e, t|
|
@@ -37,6 +48,7 @@ while continue do
|
|
37
48
|
elapsed = end_time - start_time
|
38
49
|
session.add_screen({
|
39
50
|
'displaycommand' => displaycommand,
|
51
|
+
'playprompt' => playprompt,
|
40
52
|
'stdin' => command,
|
41
53
|
'stdout' => out,
|
42
54
|
'stderr' => err,
|
data/lib/shellplay/screen.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
module Shellplay
|
2
2
|
class Screen
|
3
3
|
|
4
|
-
attr_reader :stdin, :stdout, :stderr, :display, :timespent, :displaycommand
|
4
|
+
attr_reader :stdin, :stdout, :stderr, :display, :timespent, :displaycommand, :playprompt
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
@displaycommand = true
|
8
|
+
@playprompt = true
|
8
9
|
@stdin = nil
|
9
10
|
@stdout = nil
|
10
11
|
@stderr = nil
|
@@ -12,7 +13,8 @@ module Shellplay
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def import(hash)
|
15
|
-
@displaycommand = hash['displaycommand']
|
16
|
+
@displaycommand = !!hash['displaycommand']
|
17
|
+
@playprompt = !!hash['playprompt']
|
16
18
|
@stdin = hash['stdin']
|
17
19
|
@stdout = hash['stdout']
|
18
20
|
@stderr = hash['stderr']
|
@@ -22,6 +24,7 @@ module Shellplay
|
|
22
24
|
def export
|
23
25
|
{
|
24
26
|
displaycommand: @displaycommand,
|
27
|
+
playprompt: @playprompt,
|
25
28
|
stdin: @stdin,
|
26
29
|
stdout: @stdout,
|
27
30
|
stderr: @stderr,
|
data/lib/shellplay/session.rb
CHANGED
data/shellplay.gemspec
CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.summary = %q{CLI tool for shell-based presentations.}
|
11
11
|
spec.description = %q{CLI tool for shell-based presentation. Think powerpoint in the console for commandline demos.}
|
12
12
|
spec.homepage = "https://github.com/mose/shellplay"
|
13
|
+
spec.metadata = { "changelog" => "https://github.com/mose/shellplay/blob/master/CHANGELOG.md" }
|
13
14
|
spec.license = "MIT"
|
14
15
|
|
15
16
|
spec.files = `git ls-files -z`.split("\x0")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shellplay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mose
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paint
|
@@ -141,7 +141,8 @@ files:
|
|
141
141
|
homepage: https://github.com/mose/shellplay
|
142
142
|
licenses:
|
143
143
|
- MIT
|
144
|
-
metadata:
|
144
|
+
metadata:
|
145
|
+
changelog: https://github.com/mose/shellplay/blob/master/CHANGELOG.md
|
145
146
|
post_install_message:
|
146
147
|
rdoc_options: []
|
147
148
|
require_paths:
|