showterm 0.5.0 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d992ca33efcee43c76b0e0c5e3fc883ddba89c4f
4
- data.tar.gz: 0f3efea05cea7538e05e7e267f079bb2f47aeca7
3
+ metadata.gz: 51ac2af8ec1bc2e5329f89820b48deb204925451
4
+ data.tar.gz: 96b842251c63b92f3095a86db2a7d07c17c50057
5
5
  SHA512:
6
- metadata.gz: 86e9ecea75443c6268da1a15ce8b08eb0d3a7f828c3a40b408972d769d63f2086f17bb86feeac3b46c9e426a81b6460d739a2537cee24322397e6ac2d61e457b
7
- data.tar.gz: f4b7f0ec1a9fa654487ba1f6d09e9018127e58570e4c8561d49363b6ea535c9d368c415573769ada296b1a120f4d7cc8544cacc732dbe93befe95390fcfc055a
6
+ metadata.gz: 73b01b3977a124c225ef810addf819c8c49fb4e53e4d3a3d2a00f80ab0951b27cfb146c2c4096457192c1a2e87f7efb144df0f5b9a152b48b241cf82aa427670
7
+ data.tar.gz: a83845e90eb7ba93ca1e3d2fb2317eac15ff04caf5d2acac48cb7e2c00ae08fdd7898160be8fb849dc68fd05dc64b2bc9618ef5f12cf32b0e7f74dc852a68019
@@ -47,7 +47,7 @@ module Showterm
47
47
  # @param [String] secret The shared secret that will allow deleting this showterm.
48
48
  def upload!(scriptfile, timingfile, cols=terminal_width, lines=terminal_height, secret=shared_secret)
49
49
  with_retry do
50
- request = Net::HTTP::Post.new("/scripts")
50
+ request = Net::HTTP::Post.new(actual_path "/scripts")
51
51
  request.set_form_data(:scriptfile => scriptfile,
52
52
  :timingfile => timingfile,
53
53
  :cols => cols,
@@ -140,24 +140,34 @@ module Showterm
140
140
  end
141
141
 
142
142
 
143
- # Record using the bundled version of 'ttyrec'
143
+ # Record using system ttyrec
144
144
  #
145
145
  # @param [*String] command to run
146
146
  # @return [scriptfile, timingfile]
147
147
  def record_with_ttyrec(*cmd)
148
148
  scriptfile = temp_file
149
149
 
150
- args = [File.join(File.dirname(File.dirname(__FILE__)), 'ext/ttyrec')]
150
+ args = ['ttyrec']
151
151
  if cmd.size > 0
152
152
  args << '-e' + cmd.join(" ")
153
153
  end
154
154
  args << scriptfile.path
155
155
 
156
- system(*args)
156
+ status = system(*args)
157
+ raise TTYREC_NOT_INSTALLED_ERROR if status.nil? && `which ttyrec`.empty?
157
158
 
158
159
  convert(scriptfile.open.read)
159
160
  end
160
161
 
162
+ TTYREC_NOT_INSTALLED_ERROR = <<~HEREDOC
163
+
164
+
165
+ Showterm requires ttyrec to availible in your path.
166
+ Try installing via: `brew install ttyrec` if you can.
167
+ Brew patches ttyrec on installation in order to address
168
+ a macOS openpty() issue (https://github.com/Homebrew/homebrew-core/pull/21922)
169
+ Also, definitely check out http://0xcc.net/ttyrec/
170
+ HEREDOC
161
171
 
162
172
  # The original version of showterm used the 'script' binary.
163
173
  #
@@ -208,6 +218,10 @@ module Showterm
208
218
  raise "Could not connect to #{@url.to_s}"
209
219
  end
210
220
 
221
+ def actual_path(path)
222
+ (url.path || '') + path
223
+ end
224
+
211
225
  def url
212
226
  @url ||= URI(ENV["SHOWTERM_SERVER"] || "https://showterm.herokuapp.com")
213
227
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "showterm"
3
- s.version = "0.5.0"
3
+ s.version = "0.6.0"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.author = "Conrad Irwin"
6
6
  s.email = "conrad.irwin@gmail.com"
@@ -9,6 +9,6 @@ Gem::Specification.new do |s|
9
9
  s.description = "Integrates with showterm.io for awesome sharability."
10
10
  s.files = `git ls-files`.split("\n")
11
11
  s.require_path = "lib"
12
- s.extensions = "ext/extconf.rb"
13
12
  s.executables << 'showterm'
13
+ s.requirements = 'ttyrec'
14
14
  end
metadata CHANGED
@@ -1,39 +1,26 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: showterm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conrad Irwin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-12 00:00:00.000000000 Z
11
+ date: 2019-03-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Integrates with showterm.io for awesome sharability.
14
14
  email: conrad.irwin@gmail.com
15
15
  executables:
16
16
  - showterm
17
- extensions:
18
- - ext/extconf.rb
17
+ extensions: []
19
18
  extra_rdoc_files: []
20
19
  files:
21
- - .gitignore
20
+ - ".gitignore"
22
21
  - LICENSE.MIT
23
22
  - README.md
24
23
  - bin/showterm
25
- - ext/Makefile
26
- - ext/README
27
- - ext/extconf.rb
28
- - ext/io.c
29
- - ext/io.h
30
- - ext/ttyplay.1
31
- - ext/ttyplay.c
32
- - ext/ttyrec.1
33
- - ext/ttyrec.c
34
- - ext/ttyrec.h
35
- - ext/ttytime.1
36
- - ext/ttytime.c
37
24
  - lib/showterm.rb
38
25
  - showterm.gemspec
39
26
  homepage: http://github.com/Conradirwin/showterm
@@ -45,19 +32,19 @@ require_paths:
45
32
  - lib
46
33
  required_ruby_version: !ruby/object:Gem::Requirement
47
34
  requirements:
48
- - - '>='
35
+ - - ">="
49
36
  - !ruby/object:Gem::Version
50
37
  version: '0'
51
38
  required_rubygems_version: !ruby/object:Gem::Requirement
52
39
  requirements:
53
- - - '>='
40
+ - - ">="
54
41
  - !ruby/object:Gem::Version
55
42
  version: '0'
56
- requirements: []
43
+ requirements:
44
+ - ttyrec
57
45
  rubyforge_project:
58
- rubygems_version: 2.0.3
46
+ rubygems_version: 2.5.2.3
59
47
  signing_key:
60
48
  specification_version: 4
61
49
  summary: Allows you to make screen casts of your terminal really easily
62
50
  test_files: []
63
- has_rdoc:
@@ -1,34 +0,0 @@
1
- CC = gcc
2
- CFLAGS = -O2
3
- VERSION = 1.0.8
4
-
5
- TARGET = ttyrec ttyplay ttytime
6
-
7
- DIST = ttyrec.c ttyplay.c ttyrec.h io.c io.h ttytime.c\
8
- README Makefile ttyrec.1 ttyplay.1 ttytime.1
9
-
10
- all: $(TARGET)
11
-
12
- ttyrec: ttyrec.o io.o
13
- $(CC) $(CFLAGS) -o ttyrec ttyrec.o io.o
14
-
15
- ttyplay: ttyplay.o io.o
16
- $(CC) $(CFLAGS) -o ttyplay ttyplay.o io.o
17
-
18
- ttytime: ttytime.o io.o
19
- $(CC) $(CFLAGS) -o ttytime ttytime.o io.o
20
-
21
- clean:
22
- rm -f *.o $(TARGET) ttyrecord *~
23
-
24
- dist:
25
- rm -rf ttyrec-$(VERSION)
26
- rm -f ttyrec-$(VERSION).tar.gz
27
-
28
- mkdir ttyrec-$(VERSION)
29
- cp $(DIST) ttyrec-$(VERSION)
30
- tar zcf ttyrec-$(VERSION).tar.gz ttyrec-$(VERSION)
31
- rm -rf ttyrec-$(VERSION)
32
-
33
- install:
34
- :
data/ext/README DELETED
@@ -1,27 +0,0 @@
1
- ttyrec is a tty recorder. ttyplay is a tty player.
2
-
3
- Installation:
4
-
5
- % make
6
-
7
- or if your system is SVR4 system (Solaris etc.),
8
-
9
- % make CFLAGS=-DSVR4
10
-
11
- or if your system supports getpt(3),
12
-
13
- % make CFLAGS=-DHAVE_getpt
14
-
15
- HAVE_getpt is required if your linux system uses devfs.
16
-
17
-
18
- Usage:
19
-
20
- % ttyrec
21
- (In the excuted shell, do whatever you want and exit)
22
-
23
- % ttyplay ttyrecord
24
-
25
- Have fun!
26
-
27
- -- Satoru Takabayashi <satoru@namazu.org>
File without changes
data/ext/io.c DELETED
@@ -1,161 +0,0 @@
1
- /*
2
- * Copyright (c) 2000 Satoru Takabayashi <satoru@namazu.org>
3
- * All rights reserved.
4
- *
5
- * Redistribution and use in source and binary forms, with or without
6
- * modification, are permitted provided that the following conditions
7
- * are met:
8
- * 1. Redistributions of source code must retain the above copyright
9
- * notice, this list of conditions and the following disclaimer.
10
- * 2. Redistributions in binary form must reproduce the above copyright
11
- * notice, this list of conditions and the following disclaimer in the
12
- * documentation and/or other materials provided with the distribution.
13
- * 3. All advertising materials mentioning features or use of this software
14
- * must display the following acknowledgement:
15
- * This product includes software developed by the University of
16
- * California, Berkeley and its contributors.
17
- * 4. Neither the name of the University nor the names of its contributors
18
- * may be used to endorse or promote products derived from this software
19
- * without specific prior written permission.
20
- *
21
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31
- * SUCH DAMAGE.
32
- */
33
-
34
- #include <assert.h>
35
- #include <errno.h>
36
- #include <stdio.h>
37
- #include <stdlib.h>
38
- #include <string.h>
39
- #include <unistd.h>
40
-
41
- #include "ttyrec.h"
42
-
43
- #define SWAP_ENDIAN(val) ((unsigned int) ( \
44
- (((unsigned int) (val) & (unsigned int) 0x000000ffU) << 24) | \
45
- (((unsigned int) (val) & (unsigned int) 0x0000ff00U) << 8) | \
46
- (((unsigned int) (val) & (unsigned int) 0x00ff0000U) >> 8) | \
47
- (((unsigned int) (val) & (unsigned int) 0xff000000U) >> 24)))
48
-
49
- static int
50
- is_little_endian ()
51
- {
52
- static int retval = -1;
53
-
54
- if (retval == -1) {
55
- int n = 1;
56
- char *p = (char *)&n;
57
- char x[] = {1, 0, 0, 0};
58
-
59
- assert(sizeof(int) == 4);
60
-
61
- if (memcmp(p, x, 4) == 0) {
62
- retval = 1;
63
- } else {
64
- retval = 0;
65
- }
66
- }
67
-
68
- return retval;
69
- }
70
-
71
- static int
72
- convert_to_little_endian (int x)
73
- {
74
- if (is_little_endian()) {
75
- return x;
76
- } else {
77
- return SWAP_ENDIAN(x);
78
- }
79
- }
80
-
81
- int
82
- read_header (FILE *fp, Header *h)
83
- {
84
- int buf[3];
85
-
86
- if (fread(buf, sizeof(int), 3, fp) == 0) {
87
- return 0;
88
- }
89
-
90
- h->tv.tv_sec = convert_to_little_endian(buf[0]);
91
- h->tv.tv_usec = convert_to_little_endian(buf[1]);
92
- h->len = convert_to_little_endian(buf[2]);
93
-
94
- return 1;
95
- }
96
-
97
- int
98
- write_header (FILE *fp, Header *h)
99
- {
100
- int buf[3];
101
-
102
- buf[0] = convert_to_little_endian(h->tv.tv_sec);
103
- buf[1] = convert_to_little_endian(h->tv.tv_usec);
104
- buf[2] = convert_to_little_endian(h->len);
105
-
106
- if (fwrite(buf, sizeof(int), 3, fp) == 0) {
107
- return 0;
108
- }
109
-
110
- return 1;
111
- }
112
-
113
- static char *progname = "";
114
- void
115
- set_progname (const char *name)
116
- {
117
- progname = strdup(name);
118
- }
119
-
120
- FILE *
121
- efopen (const char *path, const char *mode)
122
- {
123
- FILE *fp = fopen(path, mode);
124
- if (fp == NULL) {
125
- fprintf(stderr, "%s: %s: %s\n", progname, path, strerror(errno));
126
- exit(EXIT_FAILURE);
127
- }
128
- return fp;
129
- }
130
-
131
- int
132
- edup (int oldfd)
133
- {
134
- int fd = dup(oldfd);
135
- if (fd == -1) {
136
- fprintf(stderr, "%s: dup failed: %s\n", progname, strerror(errno));
137
- exit(EXIT_FAILURE);
138
- }
139
- return fd;
140
- }
141
-
142
- int
143
- edup2 (int oldfd, int newfd)
144
- {
145
- int fd = dup2(oldfd, newfd);
146
- if (fd == -1) {
147
- fprintf(stderr, "%s: dup2 failed: %s\n", progname, strerror(errno));
148
- exit(EXIT_FAILURE);
149
- }
150
- return fd;
151
- }
152
-
153
- FILE *
154
- efdopen (int fd, const char *mode)
155
- {
156
- FILE *fp = fdopen(fd, mode);
157
- if (fp == NULL) {
158
- fprintf(stderr, "%s: fdopen failed: %s\n", progname, strerror(errno));
159
- exit(EXIT_FAILURE);
160
- }
161
- }
data/ext/io.h DELETED
@@ -1,13 +0,0 @@
1
- #ifndef __TTYREC_IO_H__
2
- #define __TTYREC_IO_H__
3
-
4
- #include "ttyrec.h"
5
-
6
- int read_header (FILE *fp, Header *h);
7
- int write_header (FILE *fp, Header *h);
8
- FILE* efopen (const char *path, const char *mode);
9
- int edup (int oldfd);
10
- int edup2 (int oldfd, int newfd);
11
- FILE* efdopen (int fd, const char *mode);
12
-
13
- #endif
@@ -1,62 +0,0 @@
1
- .\"
2
- .\" This manual page is written by NAKANO Takeo <nakano@webmasters.gr.jp>
3
- .\"
4
- .TH TTYPLAY 1
5
- .SH NAME
6
- ttyplay \- player of the tty session recorded by ttyrec
7
- .SH SYNOPSIS
8
- .br
9
- .B ttyplay
10
- .I [\-s SPEED] [\-n] [\-p] file
11
- .br
12
- .SH DESCRIPTION
13
- .B Ttyplay
14
- plays the tty session in
15
- .IR file ,
16
- which was recorded previously by
17
- .BR ttyrec (1).
18
- .PP
19
- When
20
- .B \-p
21
- option is given,
22
- .B ttyplay
23
- output the
24
- .I file
25
- as it grows.
26
- It means that you can see the "live" shell session
27
- running by another user.
28
- .PP
29
- If you hit any key during playback, it will go right to the next
30
- character typed. This is handy when examining sessions where a user
31
- spends a lot of time at a prompt.
32
- .PP
33
- Additionally, there are some special keys defined:
34
- .TP
35
- .BI + " or " f
36
- double the speed of playback.
37
- .TP
38
- .BI \- " or " s
39
- halve the speed of playback.
40
- .TP
41
- .BI 1
42
- set playback to speed 1.0 again.
43
-
44
- .SH OPTIONS
45
- .TP
46
- .BI \-s " SPEED"
47
- multiple the playing speed by
48
- .I SPEED
49
- (default is 1).
50
- .TP
51
- .B \-n
52
- no wait mode.
53
- Ignore the timing information in
54
- .IR file .
55
- .TP
56
- .B \-p
57
- peek another person's tty session.
58
- .SH "SEE ALSO"
59
- .BR script (1),
60
- .BR ttyrec (1),
61
- .BR ttytime (1)
62
-