Hello community, here is the log from the commit of package asciinema for openSUSE:Factory checked in at 2017-05-09 18:10:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/asciinema (Old) and /work/SRC/openSUSE:Factory/.asciinema.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "asciinema" Tue May 9 18:10:06 2017 rev:3 rq:493629 version:1.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/asciinema/asciinema.changes 2016-07-14 09:50:48.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.asciinema.new/asciinema.changes 2017-05-09 18:10:08.185656446 +0200 @@ -1,0 +2,6 @@ +Tue May 9 05:47:55 UTC 2017 - avvissu@yandex.by + +- Update to 1.4.0: + * see: /usr/share/doc/packages/asciinema/CHANGELOG + +------------------------------------------------------------------- Old: ---- asciinema-1.3.0.tar.gz New: ---- asciinema-1.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ asciinema.spec ++++++ --- /var/tmp/diff_new_pack.ykh4TE/_old 2017-05-09 18:10:09.313497069 +0200 +++ /var/tmp/diff_new_pack.ykh4TE/_new 2017-05-09 18:10:09.313497069 +0200 @@ -1,7 +1,7 @@ # # spec file for package asciinema # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: asciinema -Version: 1.3.0 +Version: 1.4.0 Release: 0 Summary: Terminal session recorder License: GPL-3.0+ ++++++ asciinema-1.3.0.tar.gz -> asciinema-1.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/.travis.yml new/asciinema-1.4.0/.travis.yml --- old/asciinema-1.3.0/.travis.yml 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/.travis.yml 2017-04-11 18:05:08.000000000 +0200 @@ -2,12 +2,17 @@ language: python python: - - "3.2" - "3.3" - "3.4" - "3.5" + - "3.6" -script: make test +before_install: + - pip install pep8 + +script: + - find . -name \*.py -exec pep8 --ignore=E501 {} + + - make test notifications: irc: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/CHANGELOG.md new/asciinema-1.4.0/CHANGELOG.md --- old/asciinema-1.3.0/CHANGELOG.md 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/CHANGELOG.md 2017-04-11 18:05:08.000000000 +0200 @@ -1,5 +1,14 @@ # asciinema changelog +## 1.4.0 (2017-04-11) + +* Dropped distutils fallback in setup.py - setuptools required now (thanks Jakub "@jakubjedelsky" Jedelsky!) +* Dropped official support for Python 3.2 (although it still works on 3.2) +* New `--speed` option for `asciinema play` (thanks Bastiaan "@bastiaanb" Bakker!) +* Ability to set API token via `ASCIINEMA_API_TOKEN` env variable (thanks Samantha "@samdmarshall" Marshall!) +* Improved shutdown on more signals: CHLD, HUP, TERM, QUIT (thanks Richard "@typerlc"!) +* Fixed stdin handling during playback via `asciinema play` + ## 1.3.0 (2016-07-13) This release brings back the original Python implementation of asciinema. It's diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/README.md new/asciinema-1.4.0/README.md --- old/asciinema-1.3.0/README.md 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/README.md 2017-04-11 18:05:08.000000000 +0200 @@ -109,6 +109,7 @@ Available options: * `-w, --max-wait=<sec>` - Reduce replayed terminal inactivity to max <sec> seconds +* `-s, --speed=<factor>` - Playback speedup (can be fractional) NOTE: it is recommended to run `asciinema play` in a terminal of dimensions not smaller than the one used for recording as there's no "transcoding" of control @@ -141,13 +142,26 @@ machines so all of them use the same token, but that's not necessary. You can assign new tokens to your account from as many machines as you want. +## Hosting the recordings on the web + +As mentioned in the `Usage / rec` section above, if the `filename` argument to +`asciinema rec` is omitted then the resulting asciicast is uploaded +to [asciinema.org](https://asciinema.org) where it's hosted for further playback +in a web browser. + +If you prefer to host the recordings yourself, you can do so by recording to a +file (`asciinema rec demo.json`) and using +[asciinema's standalone web player](https://github.com/asciinema/asciinema-player#self-hosting-quick-start) +in your HTML page. + ## Configuration file asciinema uses a config file to keep API token and user settings. In most cases the location of this file is `$HOME/.config/asciinema/config`. *NOTE: When you first run asciinema, local API token is generated (UUID) and -saved in the file (unless the file already exists).* +saved in the file (unless the file already exists or you have set +`ASCIINEMA_API_TOKEN` environment variable).* The auto-generated, minimal config file looks like this: @@ -173,13 +187,18 @@ The options in `[api]` section are related to API location and authentication. To tell asciinema recorder to use your own asciinema site instance rather than the default one (asciinema.org), you can set `url` option. API URL can also be -passed via `ASCIINEMA_API_URL` environment variable. +passed via `ASCIINEMA_API_URL` environment variable, as well as API token, via +`ASCIINEMA_API_TOKEN` environment variable. The options in `[record]` and `[play]` sections have the same meaning as the options you pass to `asciinema rec`/`asciinema play` command. If you happen to often use either `-c`, `-w` or `-y` with these commands then consider saving it as a default in the config file. +*NOTE: If you want to publish your asciinema config file (in public dotfiles +repository) you __should__ remove `token = ...` line from the file and use +`ASCIINEMA_API_TOKEN` environment variable instead.* + ### Configuration file locations In fact, the following locations are checked for the presence of the config @@ -204,6 +223,6 @@ ## License -Copyright © 2011-2016 Marcin Kulik. +Copyright © 2011-2017 Marcin Kulik. All code is licensed under the GPL, v3 or later. See LICENSE file for details. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/asciinema/__init__.py new/asciinema-1.4.0/asciinema/__init__.py --- old/asciinema-1.3.0/asciinema/__init__.py 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/asciinema/__init__.py 2017-04-11 18:05:08.000000000 +0200 @@ -1,7 +1,7 @@ -__author__ = 'Marcin Kulik' -__version__ = '1.3.0' - import sys +__author__ = 'Marcin Kulik' +__version__ = '1.4.0' + if sys.version_info[0] < 3: raise ImportError('Python < 3 is unsupported.') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/asciinema/__main__.py new/asciinema-1.4.0/asciinema/__main__.py --- old/asciinema-1.3.0/asciinema/__main__.py 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/asciinema/__main__.py 2017-04-11 18:05:08.000000000 +0200 @@ -26,7 +26,7 @@ def play_command(args, config): - return PlayCommand(args.filename, args.max_wait) + return PlayCommand(args.filename, args.max_wait, args.speed) def upload_command(args, config): @@ -88,6 +88,7 @@ # create the parser for the "play" command parser_play = subparsers.add_parser('play', help='Replay terminal session') parser_play.add_argument('-w', '--max-wait', help='limit terminal inactivity to max <sec> seconds (can be fractional)', type=positive_float, default=maybe_str(cfg.play_max_wait)) + parser_play.add_argument('-s', '--speed', help='playback speedup (can be fractional)', type=positive_float, default=cfg.play_speed) parser_play.add_argument('filename', help='local path, http/ipfs URL or "-" (read from stdin)') parser_play.set_defaults(func=play_command) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/asciinema/api.py new/asciinema-1.4.0/asciinema/api.py --- old/asciinema-1.3.0/asciinema/api.py 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/asciinema/api.py 2017-04-11 18:05:08.000000000 +0200 @@ -9,6 +9,7 @@ class APIError(Exception): pass + class Api: def __init__(self, url, user, token, http_adapter=None): @@ -28,7 +29,7 @@ try: status, headers, body = self.http_adapter.post( self.upload_url(), - files={ "asciicast": ("asciicast.json", f) }, + files={"asciicast": ("asciicast.json", f)}, headers=self._headers(), username=self.user, password=self.token @@ -42,13 +43,16 @@ return body, headers.get('Warning') def _headers(self): - return { 'User-Agent': self._user_agent() } + return {'User-Agent': self._user_agent()} def _user_agent(self): os = re.sub('([^-]+)-(.*)', '\\1/\\2', platform.platform()) return 'asciinema/%s %s/%s %s' % (__version__, - platform.python_implementation(), platform.python_version(), os) + platform.python_implementation(), + platform.python_version(), + os + ) def _handle_error(self, status, body): errors = { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/asciinema/commands/auth.py new/asciinema-1.4.0/asciinema/commands/auth.py --- old/asciinema-1.3.0/asciinema/commands/auth.py 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/asciinema/commands/auth.py 2017-04-11 18:05:08.000000000 +0200 @@ -10,6 +10,6 @@ def execute(self): url = '%s/connect/%s' % (self.api_url, self.api_token) - self.print('Open the following URL in a browser to register your API ' \ - 'token and assign any recorded asciicasts to your profile:\n' \ + self.print('Open the following URL in a browser to register your API ' + 'token and assign any recorded asciicasts to your profile:\n' '%s' % url) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/asciinema/commands/play.py new/asciinema-1.4.0/asciinema/commands/play.py --- old/asciinema-1.3.0/asciinema/commands/play.py 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/asciinema/commands/play.py 2017-04-11 18:05:08.000000000 +0200 @@ -5,15 +5,16 @@ class PlayCommand(Command): - def __init__(self, filename, max_wait, player=None): + def __init__(self, filename, max_wait, speed, player=None): Command.__init__(self) self.filename = filename self.max_wait = max_wait + self.speed = speed self.player = player if player is not None else Player() def execute(self): try: - self.player.play(asciicast.load(self.filename), self.max_wait) + self.player.play(asciicast.load(self.filename), self.max_wait, self.speed) except asciicast.LoadError as e: self.print_warning("Playback failed: %s" % str(e)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/asciinema/config.py new/asciinema-1.4.0/asciinema/config.py --- old/asciinema-1.3.0/asciinema/config.py 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/asciinema/config.py 2017-04-11 18:05:08.000000000 +0200 @@ -28,12 +28,12 @@ @property def api_token(self): try: - return self.config.get('api', 'token') + return self.env.get('ASCIINEMA_API_TOKEN') or self.config.get('api', 'token') except (configparser.NoOptionError, configparser.NoSectionError): try: return self.config.get('user', 'token') except (configparser.NoOptionError, configparser.NoSectionError): - raise ConfigError('no API token found in config file') + raise ConfigError('no API token found in config file, and ASCIINEMA_API_TOKEN is unset') @property def record_command(self): @@ -55,6 +55,10 @@ def play_max_wait(self): return self.config.getfloat('play', 'maxwait', fallback=None) + @property + def play_speed(self): + return self.config.getfloat('play', 'speed', fallback=1.0) + def load_file(paths): config = configparser.ConfigParser() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/asciinema/player.py new/asciinema-1.4.0/asciinema/player.py --- old/asciinema-1.3.0/asciinema/player.py 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/asciinema/player.py 2017-04-11 18:05:08.000000000 +0200 @@ -1,12 +1,28 @@ +import os import sys import time +from asciinema.term import raw, read_non_blocking + + class Player: - def play(self, asciicast, max_wait=None): + def play(self, asciicast, max_wait=None, speed=1.0): + if os.isatty(sys.stdin.fileno()): + with raw(sys.stdin.fileno()): + self._play(asciicast, max_wait, speed, True) + else: + self._play(asciicast, max_wait, speed, False) + + def _play(self, asciicast, max_wait, speed, raw): for delay, text in asciicast.stdout: if max_wait and delay > max_wait: delay = max_wait - time.sleep(delay) + time.sleep(delay / speed) sys.stdout.write(text) sys.stdout.flush() + + if raw: + data = read_non_blocking(sys.stdin.fileno()) + if 0x03 in data: # ctrl-c + break diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/asciinema/pty_recorder.py new/asciinema-1.4.0/asciinema/pty_recorder.py --- old/asciinema-1.3.0/asciinema/pty_recorder.py 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/asciinema/pty_recorder.py 2017-04-11 18:05:08.000000000 +0200 @@ -12,6 +12,8 @@ import sys import struct +from asciinema.term import raw + class PtyRecorder: @@ -56,6 +58,12 @@ _write_master(data) + def _signals(signal_list): + old_handlers = [] + for sig, handler in signal_list: + old_handlers.append((sig, signal.signal(sig, handler))) + return old_handlers + def _copy(signal_fd): '''Main select loop. @@ -68,10 +76,10 @@ while True: try: rfds, wfds, xfds = select.select(fds, [], []) - except OSError as e: # Python >= 3.3 + except OSError as e: # Python >= 3.3 if e.errno == errno.EINTR: continue - except select.error as e: # Python < 3.3 + except select.error as e: # Python < 3.3 if e.args[0] == 4: continue @@ -94,7 +102,7 @@ if data: signals = struct.unpack('%uB' % len(data), data) for sig in signals: - if sig == signal.SIGCHLD: + if sig in [signal.SIGCHLD, signal.SIGHUP, signal.SIGTERM, signal.SIGQUIT]: os.close(master_fd) return elif sig == signal.SIGWINCH: @@ -112,28 +120,22 @@ signal.set_wakeup_fd(pipe_w) - old_sigwinch_handler = signal.signal(signal.SIGWINCH, lambda signal, frame: None) - old_sigchld_handler = signal.signal(signal.SIGCHLD, lambda signal, frame: None) - - try: - mode = tty.tcgetattr(pty.STDIN_FILENO) - tty.setraw(pty.STDIN_FILENO) - restore = 1 - except tty.error: # This is the same as termios.error - restore = 0 + old_handlers = _signals(map(lambda s: (s, lambda signal, frame: None), + [signal.SIGWINCH, + signal.SIGCHLD, + signal.SIGHUP, + signal.SIGTERM, + signal.SIGQUIT])) _set_pty_size() - try: - _copy(pipe_r) - except (IOError, OSError): - pass - finally: - if restore: - tty.tcsetattr(pty.STDIN_FILENO, tty.TCSAFLUSH, mode) + with raw(pty.STDIN_FILENO): + try: + _copy(pipe_r) + except (IOError, OSError): + pass - signal.signal(signal.SIGWINCH, old_sigwinch_handler) - signal.signal(signal.SIGCHLD, old_sigchld_handler) + _signals(old_handlers) os.waitpid(pid, 0) output.close() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/asciinema/requests_http_adapter.py new/asciinema-1.4.0/asciinema/requests_http_adapter.py --- old/asciinema-1.3.0/asciinema/requests_http_adapter.py 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/asciinema/requests_http_adapter.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,13 +0,0 @@ -import requests - - -class RequestsHttpAdapter: - - def post(self, url, fields={}, files={}, headers={}): - response = requests.post(url, data=fields, files=files, headers=headers) - - status = response.status_code - headers = response.headers - body = response.text - - return (status, headers, body) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/asciinema/term.py new/asciinema-1.4.0/asciinema/term.py --- old/asciinema-1.3.0/asciinema/term.py 1970-01-01 01:00:00.000000000 +0100 +++ new/asciinema-1.4.0/asciinema/term.py 2017-04-11 18:05:08.000000000 +0200 @@ -0,0 +1,30 @@ +import tty +import select +import os + + +class raw(): + def __init__(self, fd): + self.fd = fd + self.restore = False + + def __enter__(self): + try: + self.mode = tty.tcgetattr(self.fd) + tty.setraw(self.fd) + self.restore = True + except tty.error: # This is the same as termios.error + pass + + def __exit__(self, type, value, traceback): + if self.restore: + tty.tcsetattr(self.fd, tty.TCSAFLUSH, self.mode) + + +def read_non_blocking(fd): + data = b'' + + while fd in select.select([fd], [], [], 0)[0]: + data += os.read(fd, 1024) + + return data diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/install new/asciinema-1.4.0/install --- old/asciinema-1.3.0/install 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/install 1970-01-01 01:00:00.000000000 +0100 @@ -1,62 +0,0 @@ -#!/bin/sh - -# This script installs asciinema cli on your system by downloading a binary -# compatible with your platform and putting it in your $PATH. - -{ # Prevent execution if this script was only partially downloaded - -set -e - -case "$(uname -s).$(uname -m)" in - Linux.x86_64) platform=linux-amd64;; - Linux.i?86) platform=linux-386;; - Linux.armv6l) platform=linux-arm;; - Linux.armv7l) platform=linux-arm;; - FreeBSD.amd64) platform=freebsd-amd64;; - FreeBSD.i386) platform=freebsd-386;; - Darwin.x86_64) platform=darwin-amd64;; - Darwin.i?86) platform=darwin-386;; - *) echo "Sorry, there is no asciinema binary available for your platform. Try building from source." >&2; exit 1;; -esac - -version=1.2.0 -url="https://github.com/asciinema/asciinema/releases/download/v${version}/asciinema-${version}-${platform}.tar.gz" -bin_name="asciinema" -sudo="" - -tmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'asciinema-tmp') -trap 'rm -rf $tmpdir' EXIT - -echo "Downloading asciinema v${version} for $platform..." -curl -L --progress-bar "$url" | tar xz -C $tmpdir - -if [ -d "$HOME/bin" ]; then - if echo ":$PATH:" | grep -q ":~/bin:" || echo ":$PATH:" | grep -q ":$HOME/bin:"; then - target="$HOME/bin/$bin_name" - fi -elif [ -d "/usr/local/bin" ]; then - if echo ":$PATH:" | grep -q ":/usr/local/bin:"; then - target="/usr/local/bin/$bin_name" - if [ ! -w /usr/local/bin ]; then - sudo=sudo - echo "Warning: you may be asked for administrator password to save the file in /usr/local/bin directory" - fi - fi -fi - -if [ -z "$target" ]; then - target="$PWD/$bin_name" - echo "Warning: couldn't find ~/bin or /usr/local/bin in your \$PATH" -fi - -echo "Installing to $target..." -if $sudo cp $tmpdir/asciinema*/asciinema $target; then - $sudo chmod a+x $target - echo "Success." - echo - echo "Start recording your terminal by running: asciinema rec" -else - echo "Error: couldn't copy $bin_name to $target" -fi - -} # End of wrapping diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/man/asciinema.1 new/asciinema-1.4.0/man/asciinema.1 --- old/asciinema-1.3.0/man/asciinema.1 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/man/asciinema.1 2017-04-11 18:05:08.000000000 +0200 @@ -1,4 +1,4 @@ -.TH "asciinema" "1" "July 13, 2016" "asciinema 1.3.0" +.TH "asciinema" "1" "April 11, 2017" "asciinema 1.4.0" .SH "NAME" asciinema \- terminal session recorder .SH "SYNOPSIS" @@ -67,6 +67,9 @@ .TP \-w, \-\-max\-wait reduce replayed terminal inactivity to max \fIsec\fP seconds +.TP +\-s, \-\-speed +speed up playback by factor \fIfactor\fP (can be fractional) .RE .RE .PP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/setup.py new/asciinema-1.4.0/setup.py --- old/asciinema-1.3.0/setup.py 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/setup.py 2017-04-11 18:05:08.000000000 +0200 @@ -1,16 +1,10 @@ +import asciinema import sys +from setuptools import setup if sys.version_info[0] < 3: sys.exit('Python < 3 is unsupported.') -try: - from setuptools import setup -except ImportError: - from distutils.core import setup - -import asciinema - - url_template = 'https://github.com/asciinema/asciinema/archive/v%s.tar.gz' requirements = [] @@ -39,10 +33,10 @@ 'Natural Language :: English', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'Topic :: System :: Shells', 'Topic :: Terminals', 'Topic :: Utilities' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/tests/config_test.py new/asciinema-1.4.0/tests/config_test.py --- old/asciinema-1.3.0/tests/config_test.py 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/tests/config_test.py 2017-04-11 18:05:08.000000000 +0200 @@ -16,6 +16,7 @@ return cfg.Config(cfg.load_file([path]), env) + def test_load_config(): with tempfile.TemporaryDirectory() as dir: config = cfg.load({'ASCIINEMA_CONFIG_HOME': dir + '/foo/bar'}) @@ -28,80 +29,97 @@ config = cfg.load({'ASCIINEMA_CONFIG_HOME': dir}) assert_equal(token, config.api_token) + def test_default_api_url(): config = create_config('') assert_equal('https://asciinema.org', config.api_url) + def test_default_record_command(): config = create_config('') assert_equal(None, config.record_command) + def test_default_record_max_wait(): config = create_config('') assert_equal(None, config.record_max_wait) + def test_default_record_yes(): config = create_config('') assert_equal(False, config.record_yes) + def test_default_record_quiet(): config = create_config('') assert_equal(False, config.record_quiet) + def test_default_play_max_wait(): config = create_config('') assert_equal(None, config.play_max_wait) + def test_api_url(): config = create_config("[api]\nurl = http://the/url") assert_equal('http://the/url', config.api_url) + def test_api_url_when_override_set(): config = create_config("[api]\nurl = http://the/url", { - 'ASCIINEMA_API_URL': 'http://the/url2' }) + 'ASCIINEMA_API_URL': 'http://the/url2'}) assert_equal('http://the/url2', config.api_url) + def test_api_token(): token = 'foo-bar-baz' config = create_config("[api]\ntoken = %s" % token) assert re.match(token, config.api_token) + def test_api_token_when_no_api_token_set(): config = create_config('') with assert_raises(Exception): config.api_token + def test_api_token_when_user_token_set(): token = 'foo-bar-baz' config = create_config("[user]\ntoken = %s" % token) assert re.match(token, config.api_token) + def test_api_token_when_api_token_set_and_user_token_set(): user_token = 'foo' api_token = 'bar' config = create_config("[user]\ntoken = %s\n[api]\ntoken = %s" % (user_token, api_token)) assert re.match(api_token, config.api_token) + def test_record_command(): command = 'bash -l' config = create_config("[record]\ncommand = %s" % command) assert_equal(command, config.record_command) + def test_record_max_wait(): max_wait = '2.35' config = create_config("[record]\nmaxwait = %s" % max_wait) assert_equal(2.35, config.record_max_wait) + def test_record_yes(): yes = 'yes' config = create_config("[record]\nyes = %s" % yes) assert_equal(True, config.record_yes) + def test_record_quiet(): quiet = 'yes' config = create_config("[record]\nquiet = %s" % quiet) assert_equal(True, config.record_quiet) + def test_play_max_wait(): max_wait = '2.35' config = create_config("[play]\nmaxwait = %s" % max_wait) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/tests/integration.sh new/asciinema-1.4.0/tests/integration.sh --- old/asciinema-1.3.0/tests/integration.sh 2016-07-13 10:54:24.000000000 +0200 +++ new/asciinema-1.4.0/tests/integration.sh 2017-04-11 18:05:08.000000000 +0200 @@ -17,6 +17,10 @@ asciinema auth +asciinema play -s 5 tests/vim.json + +asciinema play -s 5 -w 0.2 tests/vim.json + asciinema rec -c who "$TMP_DATA_DIR/1.json" bash -c "sleep 1; pkill -28 -n -f 'm asciinema'" & diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/asciinema-1.3.0/tests/vim.json new/asciinema-1.4.0/tests/vim.json --- old/asciinema-1.3.0/tests/vim.json 1970-01-01 01:00:00.000000000 +0100 +++ new/asciinema-1.4.0/tests/vim.json 2017-04-11 18:05:08.000000000 +0200 @@ -0,0 +1,114 @@ +{ + "version": 1, + "width": 80, + "height": 40, + "duration": 6.46111, + "command": "/bin/bash", + "title": null, + "env": { + "TERM": "xterm-256color", + "SHELL": "/bin/bash" + }, + "stdout": [ + [ + 0.013659, + "\u001b[?1034hbash-3.2$ " + ], + [ + 1.923187, + "v" + ], + [ + 0.064049, + "i" + ], + [ + 0.032034, + "m" + ], + [ + 0.19157, + "\r\n" + ], + [ + 0.032342, + "\u001b[?1049h\u001b[?1h\u001b=\u001b[2;1H▽\u001b[6n\u001b[2;1H \u001b[1;1H" + ], + [ + 0.001436, + "\u001b[1;40r\u001b[?12;25h\u001b[?12l\u001b[?25h\u001b[27m\u001b[m\u001b[H\u001b[2J\u001b[>c" + ], + [ + 0.000311, + "\u001b[?25l\u001b[1;1H\u001b[33m 1 \u001b[m\r\n\u001b[1m\u001b[34m~ \u001b[3;1H~ \u001b[4;1H~ \u001b[5;1H~ \u001b[6;1H~ \u001b[7;1H~ \u001b[8;1H~ \u001b[9;1H~ \u001b[10;1H~ \u001b[11;1H~ \u001b[12;1H~ \u001b[13;1H~ " + ], + [ + 3.9e-05, + " \u001b[14;1H~ \u001b[15;1H~ \u001b[16;1H~ \u001b[17;1H~ \u001b[18;1H~ \u001b[19;1H~ \u001b[20;1H~ \u001b[21;1H~ \u001b[22;1H~ \u001b[23;1H~ \u001b[24;1H~ \u001b[25;1H~ " + ], + [ + 9.2e-05, + " \u001b[26;1H~ \u001b[27;1H~ \u001b[28;1H~ \u001b[29;1H~ \u001b[30;1H~ \u001b[31;1H~ \u001b[32;1H~ \u001b[33;1H~ \u001b[34;1H~ \u001b[35;1H~ \u001b[36;1H~ \u001b[37;" + ], + [ + 2.4e-05, + "1H~ \u001b[38;1H~ \u001b[m\u001b[39;1H\u001b[1m\u001b[7m[No Name] \u001b[m\u001b[14;32HVIM - Vi IMproved\u001b[16;33Hversion 7.4.8056\u001b[17;29Hby Bram Moolenaar et al.\u001b[18;19HVim is open source and freely distributable\u001b[20;26HBecome a registered Vim user!\u001b[21;18Htype :help register\u001b[32m<Enter>\u001b[m for information \u001b[23;18Htype :q\u001b[32m<Enter>\u001b[m to exit \u001b[24;18Htype :help\u001b[32m<Enter>\u001b[m or \u001b[32m<F1>\u001b[m for on-line help\u001b[25;18Htype :help version7\u001b[32m<Enter>\u001b[m for version info\u001b[1;5H\u001b[?12l\u001b[?25h" + ], + [ + 1.070242, + "\u001b[?25l\u001b[40;1H:" + ], + [ + 2.3e-05, + "\u001b[?12l\u001b[?25h" + ], + [ + 0.503964, + "q" + ], + [ + 0.151903, + "u" + ], + [ + 0.04002, + "i" + ], + [ + 0.088084, + "t" + ], + [ + 0.287636, + "\r" + ], + [ + 0.002178, + "\u001b[?25l\u001b[40;1H\u001b[K\u001b[40;1H\u001b[?1l\u001b>\u001b[?12l\u001b[?25h\u001b[?1049l" + ], + [ + 0.000999, + "bash-3.2$ " + ], + [ + 1.58912, + "e" + ], + [ + 0.184114, + "x" + ], + [ + 0.087915, + "i" + ], + [ + 0.103987, + "t" + ], + [ + 0.087613, + "\r\n" + ] + ] +} \ No newline at end of file