shelr 0.12.3 → 0.12.4
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/shelr +4 -3
- data/lib/shelr/player.rb +24 -19
- data/lib/shelr/recorder.rb +2 -2
- data/lib/shelr/terminal.rb +4 -0
- data/lib/shelr/version.rb +1 -1
- data/shelr.1 +4 -3
- data/shelr.1.ronn +3 -2
- metadata +3 -3
data/bin/shelr
CHANGED
@@ -30,6 +30,7 @@ HELP = <<-HELP
|
|
30
30
|
play last - play last local record
|
31
31
|
play RECORD_ID - play local record
|
32
32
|
play RECORD_URL - play remote record
|
33
|
+
play dump.json - play local file dumped with `shelr dump`
|
33
34
|
|
34
35
|
Setup:
|
35
36
|
|
@@ -49,10 +50,10 @@ when 'list'
|
|
49
50
|
Shelr::Player.list
|
50
51
|
when 'play'
|
51
52
|
if ARGV[1]
|
52
|
-
if ARGV[1] =~ /^http:.*/
|
53
|
+
if ARGV[1] =~ /^http:.*/ # remote file
|
53
54
|
Shelr::Player.play_remote(ARGV[1])
|
54
|
-
|
55
|
-
Shelr::Player.
|
55
|
+
elsif ARGV[1] =~ /.*\.json$/ # local file
|
56
|
+
Shelr::Player.play_dump(ARGV[1])
|
56
57
|
end
|
57
58
|
else
|
58
59
|
puts "Missing id for shellcast"
|
data/lib/shelr/player.rb
CHANGED
@@ -14,26 +14,13 @@ module Shelr
|
|
14
14
|
def self.play_remote(url)
|
15
15
|
puts ".==> Fetching #{url}"
|
16
16
|
resp = Net::HTTP.get(URI.parse(url))
|
17
|
-
|
18
|
-
|
19
|
-
print "Title:\t"
|
20
|
-
puts parts['title']
|
21
|
-
print "Description:\t"
|
22
|
-
puts parts['description']
|
17
|
+
play_parts_hash(JSON.parse(resp))
|
18
|
+
end
|
23
19
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
puts "+==> Playing... "
|
29
|
-
system "scriptreplay #{File.join(dir, 'timing')} #{File.join(dir, 'typescript')}"
|
30
|
-
puts "+\n+"
|
31
|
-
print "| Title:\t"
|
32
|
-
puts parts['title']
|
33
|
-
print "| Description:\t"
|
34
|
-
puts parts['description']
|
35
|
-
puts "`==> The end... "
|
36
|
-
end
|
20
|
+
def self.play_dump(file)
|
21
|
+
json = File.read(File.open(file))
|
22
|
+
parts = JSON.parse(json)
|
23
|
+
play_parts_hash(parts)
|
37
24
|
end
|
38
25
|
|
39
26
|
def self.list
|
@@ -43,6 +30,24 @@ module Shelr
|
|
43
30
|
end
|
44
31
|
end
|
45
32
|
|
33
|
+
# TODO: refactore me!
|
34
|
+
def self.play_parts_hash(parts)
|
35
|
+
Dir.mktmpdir do |dir|
|
36
|
+
%w(typescript timing).each do |type|
|
37
|
+
File.open(File.join(dir, type), 'w') { |f| f.puts(parts[type]) }
|
38
|
+
end
|
39
|
+
Shelr.terminal.puts_line
|
40
|
+
puts "=> Title: #{parts['title']}"
|
41
|
+
puts "=> Description: #{parts['description']}t"
|
42
|
+
Shelr.terminal.puts_line
|
43
|
+
system "scriptreplay #{File.join(dir, 'timing')} #{File.join(dir, 'typescript')}"
|
44
|
+
Shelr.terminal.puts_line
|
45
|
+
puts "=> Title: #{parts['title']}"
|
46
|
+
puts "=> Description: #{parts['description']}t"
|
47
|
+
Shelr.terminal.puts_line
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
46
51
|
def initialize(id)
|
47
52
|
@record_id = id
|
48
53
|
end
|
data/lib/shelr/recorder.rb
CHANGED
@@ -17,13 +17,13 @@ module Shelr
|
|
17
17
|
with_lock_file do
|
18
18
|
init_terminal
|
19
19
|
request_metadata
|
20
|
-
|
20
|
+
Shelr.terminal.puts_line
|
21
21
|
STDOUT.puts "=> Your session started"
|
22
22
|
STDOUT.puts "=> Please, do not resize your terminal while recording"
|
23
23
|
STDOUT.puts "=> Press Ctrl+D or 'exit' to finish recording"
|
24
24
|
system(recorder_cmd)
|
25
25
|
save_as_typescript if Shelr.backend == 'ttyrec'
|
26
|
-
|
26
|
+
Shelr.terminal.puts_line
|
27
27
|
STDOUT.puts "=> Session finished"
|
28
28
|
STDOUT.puts
|
29
29
|
STDOUT.puts "Replay : #{Shelr::APP_NAME} play last"
|
data/lib/shelr/terminal.rb
CHANGED
data/lib/shelr/version.rb
CHANGED
data/shelr.1
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "SHELR" "1" "
|
4
|
+
.TH "SHELR" "1" "April 2012" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBshelr\fR \- screencasting for shell ninjas
|
@@ -72,8 +72,9 @@ Play local shellcast:
|
|
72
72
|
.
|
73
73
|
.nf
|
74
74
|
|
75
|
-
$ shelr play 1293702847
|
76
|
-
$ shelr play
|
75
|
+
$ shelr play 1293702847 # play your own local record
|
76
|
+
$ shelr play record\.json # created with shelr dump
|
77
|
+
$ shelr play last # will play most recent local record
|
77
78
|
.
|
78
79
|
.fi
|
79
80
|
.
|
data/shelr.1.ronn
CHANGED
@@ -44,8 +44,9 @@ List recorded shellcasts:
|
|
44
44
|
|
45
45
|
Play local shellcast:
|
46
46
|
|
47
|
-
$ shelr play 1293702847
|
48
|
-
$ shelr play
|
47
|
+
$ shelr play 1293702847 # play your own local record
|
48
|
+
$ shelr play record.json # created with shelr dump
|
49
|
+
$ shelr play last # will play most recent local record
|
49
50
|
|
50
51
|
Play remote shellcast:
|
51
52
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shelr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -86,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
86
|
version: '0'
|
87
87
|
segments:
|
88
88
|
- 0
|
89
|
-
hash:
|
89
|
+
hash: 2904017191069490073
|
90
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
91
|
none: false
|
92
92
|
requirements:
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
segments:
|
97
97
|
- 0
|
98
|
-
hash:
|
98
|
+
hash: 2904017191069490073
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
101
|
rubygems_version: 1.8.21
|