showterm 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/README.md +16 -0
- data/bin/showterm +22 -0
- data/lib/showterm.rb +42 -10
- data/showterm.gemspec +1 -1
- metadata +8 -9
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d992ca33efcee43c76b0e0c5e3fc883ddba89c4f
|
4
|
+
data.tar.gz: 0f3efea05cea7538e05e7e267f079bb2f47aeca7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 86e9ecea75443c6268da1a15ce8b08eb0d3a7f828c3a40b408972d769d63f2086f17bb86feeac3b46c9e426a81b6460d739a2537cee24322397e6ac2d61e457b
|
7
|
+
data.tar.gz: f4b7f0ec1a9fa654487ba1f6d09e9018127e58570e4c8561d49363b6ea535c9d368c415573769ada296b1a120f4d7cc8544cacc732dbe93befe95390fcfc055a
|
data/.gitignore
ADDED
data/README.md
CHANGED
@@ -23,6 +23,22 @@ TODO
|
|
23
23
|
|
24
24
|
* Allow embedders to chose colourschemes (at least light vs. dark background).
|
25
25
|
|
26
|
+
Bugs
|
27
|
+
====
|
28
|
+
|
29
|
+
Showterm doesn't preserve enough context for `rvm` to work correctly. This can cause some ruby programs (e.g. capistrano) to crash when used inside a showterm. To fix this run: `rvm use` before running any ruby programs:
|
30
|
+
|
31
|
+
```
|
32
|
+
[~/repo/www] > showterm
|
33
|
+
Showterm recording. (Exit shell when done.)
|
34
|
+
[~/repo/www] > rvm use
|
35
|
+
Using /Users/jasghar/.rvm/gems/ruby-1.9.3-p286
|
36
|
+
[~/repo/www] > cap deploy
|
37
|
+
...
|
38
|
+
```
|
39
|
+
|
40
|
+
|
41
|
+
|
26
42
|
Meta-fu
|
27
43
|
=======
|
28
44
|
|
data/bin/showterm
CHANGED
@@ -14,6 +14,11 @@ class Showterm::Main
|
|
14
14
|
ARGV.shift
|
15
15
|
reupload
|
16
16
|
|
17
|
+
elsif ARGV[0] == '--delete'
|
18
|
+
|
19
|
+
ARGV.shift
|
20
|
+
delete
|
21
|
+
|
17
22
|
else
|
18
23
|
|
19
24
|
if '-e' == ARGV[0] || '--edit' == ARGV[0]
|
@@ -37,6 +42,8 @@ class Showterm::Main
|
|
37
42
|
def help
|
38
43
|
puts <<-EOF
|
39
44
|
Usage: showterm [-e] <command to run>
|
45
|
+
showterm --retry <script> <times>
|
46
|
+
showterm --delete <url>
|
40
47
|
|
41
48
|
showterm will record the exact output of your session, and upload it to the
|
42
49
|
internet where it can be replayed by anyone to whom you give the URL.
|
@@ -47,6 +54,9 @@ class Showterm::Main
|
|
47
54
|
|
48
55
|
If you would like to attempt an upload again
|
49
56
|
showterm --retry <script> <times>
|
57
|
+
|
58
|
+
To delete a showterm you have uploaded from this computer
|
59
|
+
showterm --delete <url>
|
50
60
|
EOF
|
51
61
|
end
|
52
62
|
|
@@ -58,6 +68,18 @@ class Showterm::Main
|
|
58
68
|
end
|
59
69
|
end
|
60
70
|
|
71
|
+
def delete
|
72
|
+
if ARGV.size == 1
|
73
|
+
puts "Deleting..."
|
74
|
+
puts Showterm.delete! ARGV.first
|
75
|
+
else
|
76
|
+
puts "Usage: showterm --delete <url>"
|
77
|
+
end
|
78
|
+
rescue => e
|
79
|
+
puts [e] + e.backtrace
|
80
|
+
puts "-" * 80
|
81
|
+
end
|
82
|
+
|
61
83
|
def upload(sf, tf)
|
62
84
|
puts "Uploading..."
|
63
85
|
puts Showterm.upload! sf, tf
|
data/lib/showterm.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'tempfile'
|
2
2
|
require 'shellwords'
|
3
3
|
require 'net/https'
|
4
|
+
require 'securerandom'
|
4
5
|
|
5
6
|
module Showterm
|
6
7
|
extend self
|
@@ -43,24 +44,55 @@ module Showterm
|
|
43
44
|
# @param [String] scriptfile The ANSI dump of the terminal
|
44
45
|
# @param [String] timingfile The timings
|
45
46
|
# @param [Integer] cols The width of the terminal
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
# @param [String] secret The shared secret that will allow deleting this showterm.
|
48
|
+
def upload!(scriptfile, timingfile, cols=terminal_width, lines=terminal_height, secret=shared_secret)
|
49
|
+
with_retry do
|
50
|
+
request = Net::HTTP::Post.new("/scripts")
|
51
|
+
request.set_form_data(:scriptfile => scriptfile,
|
52
|
+
:timingfile => timingfile,
|
53
|
+
:cols => cols,
|
54
|
+
:lines => lines,
|
55
|
+
:secret => secret)
|
56
|
+
|
57
|
+
response = http(request)
|
58
|
+
raise response.body unless Net::HTTPSuccess === response
|
59
|
+
response.body
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Delete from showterm.io
|
64
|
+
#
|
65
|
+
# @param [String] url The URL of the showterm to delete
|
66
|
+
# @param [String] secret The secret with which it was uploaded.
|
67
|
+
def delete!(url, secret=shared_secret)
|
53
68
|
|
69
|
+
request = Net::HTTP::Delete.new(URI(url).path)
|
70
|
+
request.set_form_data(:secret => secret)
|
54
71
|
response = http(request)
|
72
|
+
|
55
73
|
raise response.body unless Net::HTTPSuccess === response
|
56
74
|
response.body
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
def with_retry(n=1, &block)
|
80
|
+
yield
|
57
81
|
rescue
|
58
|
-
raise if
|
59
|
-
|
82
|
+
raise if n == 0
|
83
|
+
n -= 1
|
60
84
|
retry
|
61
85
|
end
|
62
86
|
|
63
|
-
|
87
|
+
def shared_secret
|
88
|
+
path = File.expand_path("~/.showterm")
|
89
|
+
unless File.exist?(path)
|
90
|
+
File.open(path, 'w') do |f|
|
91
|
+
f.write SecureRandom.hex(16)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
File.read(path).strip
|
95
|
+
end
|
64
96
|
|
65
97
|
# Get a temporary file that will be deleted when the program exits.
|
66
98
|
def temp_file
|
data/showterm.gemspec
CHANGED
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: showterm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.4.0
|
4
|
+
version: 0.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Conrad Irwin
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: Integrates with showterm.io for awesome sharability.
|
15
14
|
email: conrad.irwin@gmail.com
|
@@ -19,6 +18,7 @@ extensions:
|
|
19
18
|
- ext/extconf.rb
|
20
19
|
extra_rdoc_files: []
|
21
20
|
files:
|
21
|
+
- .gitignore
|
22
22
|
- LICENSE.MIT
|
23
23
|
- README.md
|
24
24
|
- bin/showterm
|
@@ -38,27 +38,26 @@ files:
|
|
38
38
|
- showterm.gemspec
|
39
39
|
homepage: http://github.com/Conradirwin/showterm
|
40
40
|
licenses: []
|
41
|
+
metadata: {}
|
41
42
|
post_install_message:
|
42
43
|
rdoc_options: []
|
43
44
|
require_paths:
|
44
45
|
- lib
|
45
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
-
none: false
|
47
47
|
requirements:
|
48
|
-
- -
|
48
|
+
- - '>='
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0'
|
51
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
52
|
requirements:
|
54
|
-
- -
|
53
|
+
- - '>='
|
55
54
|
- !ruby/object:Gem::Version
|
56
55
|
version: '0'
|
57
56
|
requirements: []
|
58
57
|
rubyforge_project:
|
59
|
-
rubygems_version:
|
58
|
+
rubygems_version: 2.0.3
|
60
59
|
signing_key:
|
61
|
-
specification_version:
|
60
|
+
specification_version: 4
|
62
61
|
summary: Allows you to make screen casts of your terminal really easily
|
63
62
|
test_files: []
|
64
63
|
has_rdoc:
|