shelr 0.14.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -11
- data/bin/shelr +4 -1
- data/lib/shelr/player.rb +16 -9
- data/lib/shelr/publisher.rb +1 -1
- data/lib/shelr/version.rb +1 -1
- data/lib/shelr.rb +11 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[![Build Status](https://secure.travis-ci.org/antono/shelr.png?branch=master)](http://travis-ci.org/antono/shelr)
|
4
4
|
|
5
5
|
`shelr` allows you to record/replay and publish your terminal on [http://shelr.tv](http://shelr.tv).
|
6
|
-
[Code for Shelr.tv](https://github.com/
|
6
|
+
[Code for Shelr.tv](https://github.com/shelr/shelr.tv) service is also available on github.
|
7
7
|
|
8
8
|
|
9
9
|
## Installation
|
@@ -14,7 +14,7 @@ You'll need ruby and rubygems installed.
|
|
14
14
|
|
15
15
|
[sudo] gem install shelr
|
16
16
|
|
17
|
-
On ubuntu older than precise you should also add following to your `.bashrc` or `.zshrc`
|
17
|
+
On ubuntu older than precise or debian older than wheezy you should also add following to your `.bashrc` or `.zshrc`
|
18
18
|
|
19
19
|
export PATH=/var/lib/gems/1.8/bin:$PATH
|
20
20
|
|
@@ -22,9 +22,10 @@ See [shellcast](http://shelr.tv/records/4f49ea4ae557800001000004) for details :)
|
|
22
22
|
|
23
23
|
### From packages
|
24
24
|
|
25
|
-
- [PPA](https://launchpad.net/~antono/+archive/shelr) for
|
25
|
+
- [PPA](https://launchpad.net/~antono/+archive/shelr) for Ubuntu
|
26
26
|
- [PKGBUILD](https://aur.archlinux.org/packages.php?ID=56945) for Arch Linux
|
27
27
|
- [EBUILD](http://overlays.gentoo.org/proj/sunrise/browser/app-misc/shelr) for Gentoo Linux
|
28
|
+
- [deb](http://mentors.debian.net/package/shelr) for Debian (Mentor Wanted)
|
28
29
|
|
29
30
|
## Watching other's records
|
30
31
|
|
@@ -60,18 +61,11 @@ If You use OS X - install `ttyrec` via homebrew and setup it as recording backen
|
|
60
61
|
brew install ttyrec
|
61
62
|
shelr backend ttyrec
|
62
63
|
|
63
|
-
Also put the scriptreplay script somewhere in your PATH, e.g. /usr/local/bin
|
64
|
-
|
65
|
-
curl https://raw.github.com/gist/2343833/0287752171cb045205e88664a32f63bf3a45565f/scriptreplay > /usr/local/bin/scriptreplay
|
66
|
-
chmod +x /usr/local/bin/scriptreplay
|
67
|
-
|
68
64
|
## Copyright
|
69
65
|
|
70
66
|
(Э) 2010, 2011, 2012 Antono Vasiljev and
|
71
|
-
[contributors](https://github.com/
|
67
|
+
[contributors](https://github.com/shelr/shelr/contributors).
|
72
68
|
|
73
69
|
See LICENSE.txt for details.
|
74
70
|
|
75
|
-
[![endorse](http://api.coderwall.com/antono/endorsecount.png)](http://coderwall.com/antono)
|
76
|
-
|
77
71
|
[TV]: http://shelr.tv/ "Shellcasts from shell ninjas"
|
data/bin/shelr
CHANGED
@@ -37,7 +37,7 @@ HELP = <<-HELP
|
|
37
37
|
|
38
38
|
Setup:
|
39
39
|
|
40
|
-
setup API_KEY
|
40
|
+
setup API_KEY [API_URL] - set your API key and API site
|
41
41
|
backend [ttyrec|script] - setup recorder backend
|
42
42
|
|
43
43
|
Visit: http://shelr.tv/ for more info.
|
@@ -85,6 +85,9 @@ when 'push'
|
|
85
85
|
puts "Select one..."
|
86
86
|
end
|
87
87
|
when 'setup'
|
88
|
+
if ARGV[2]
|
89
|
+
Shelr.api_url = ARGV[2]
|
90
|
+
end
|
88
91
|
if ARGV[1]
|
89
92
|
Shelr.api_key = ARGV[1]
|
90
93
|
else
|
data/lib/shelr/player.rb
CHANGED
@@ -44,7 +44,7 @@ module Shelr
|
|
44
44
|
puts "=> Title: #{parts['title']}"
|
45
45
|
puts "=> Description: #{parts['description']}t"
|
46
46
|
Shelr.terminal.puts_line
|
47
|
-
|
47
|
+
scriptreplay File.join(dir, 'typescript'), File.join(dir, 'timing')
|
48
48
|
Shelr.terminal.puts_line
|
49
49
|
puts "=> Title: #{parts['title']}"
|
50
50
|
puts "=> Description: #{parts['description']}t"
|
@@ -57,24 +57,31 @@ module Shelr
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def play
|
60
|
-
|
61
|
-
puts
|
60
|
+
Shelr.terminal.puts_line
|
62
61
|
system(scriptreplay_cmd)
|
63
|
-
|
64
|
-
STDOUT.puts "-=" * (Shelr.terminal.size[:width] / 2)
|
65
|
-
end
|
66
|
-
|
67
|
-
def scriptreplay(typescript, timing)
|
62
|
+
Shelr.terminal.puts_line
|
68
63
|
end
|
69
64
|
|
70
65
|
private
|
71
66
|
|
67
|
+
def scriptreplay(typescript_file, timing_file)
|
68
|
+
typescript = File.open(typescript_file)
|
69
|
+
timing = File.open(timing_file)
|
70
|
+
frames = timing.read.split("\n").map { |line| line.split(" ") }
|
71
|
+
typescript.gets # skip first line
|
72
|
+
|
73
|
+
frames.each do |usec,length|
|
74
|
+
sleep(usec.to_f)
|
75
|
+
print typescript.read(length.to_i)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
72
79
|
def record_file(name)
|
73
80
|
File.join(Shelr.data_dir(@record_id), name)
|
74
81
|
end
|
75
82
|
|
76
83
|
def scriptreplay_cmd
|
77
|
-
|
84
|
+
scriptreplay record_file('typescript'), record_file('timing')
|
78
85
|
end
|
79
86
|
end
|
80
87
|
end
|
data/lib/shelr/publisher.rb
CHANGED
@@ -8,7 +8,7 @@ module Shelr
|
|
8
8
|
@private = priv
|
9
9
|
ensure_unlocked(id)
|
10
10
|
with_exception_handler do
|
11
|
-
uri = URI.parse(Shelr
|
11
|
+
uri = URI.parse(Shelr.api_url + '/records')
|
12
12
|
params = { 'record' => prepare(id) }
|
13
13
|
params.merge!({'api_key' => Shelr.api_key}) if api_key
|
14
14
|
handle_response Net::HTTP.post_form(uri, params)
|
data/lib/shelr/version.rb
CHANGED
data/lib/shelr.rb
CHANGED
@@ -4,12 +4,12 @@ require 'json'
|
|
4
4
|
module Shelr
|
5
5
|
|
6
6
|
APP_NAME = 'shelr'
|
7
|
-
API_URL = ENV['SHELR_LOCAL'] ? 'http://localhost:3000' : 'http://shelr.tv'
|
8
7
|
XDG_DATA_DIR = ENV['XDG_DATA_HOME'] || File.join(ENV['HOME'], '.local', 'share')
|
9
8
|
XDG_CONFIG_DIR = ENV['XDG_CONFIG_HOME'] || File.join(ENV['HOME'], '.config')
|
10
9
|
DATA_DIR = File.join(XDG_DATA_DIR, APP_NAME)
|
11
10
|
CONFIG_DIR = File.join(XDG_CONFIG_DIR, APP_NAME)
|
12
11
|
API_KEY_CFG = File.join(CONFIG_DIR, 'api_key')
|
12
|
+
API_URL_CFG = File.join(CONFIG_DIR, 'api_url')
|
13
13
|
BACKEND_CFG = File.join(CONFIG_DIR, 'backend')
|
14
14
|
|
15
15
|
autoload :Recorder, 'shelr/recorder.rb'
|
@@ -30,6 +30,16 @@ module Shelr
|
|
30
30
|
File.open(API_KEY_CFG, 'w+') { |f| f.puts(key.strip) }
|
31
31
|
end
|
32
32
|
|
33
|
+
def api_url
|
34
|
+
return ENV['SHELR_LOCAL'] ? 'http://localhost:3000' : 'http://shelr.tv' unless File.exist?(API_URL_CFG)
|
35
|
+
@api_url ||= File.read(API_URL_CFG).strip
|
36
|
+
end
|
37
|
+
|
38
|
+
def api_url=(url)
|
39
|
+
ensure_config_dir_exist
|
40
|
+
File.open(API_URL_CFG, 'w+') { |f| f.puts(url.strip) }
|
41
|
+
end
|
42
|
+
|
33
43
|
def backend
|
34
44
|
@backend ||= File.exist?(BACKEND_CFG) ? File.read(BACKEND_CFG).strip : 'script'
|
35
45
|
end
|
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.
|
4
|
+
version: 0.15.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-04-
|
15
|
+
date: 2012-04-23 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: json
|
@@ -87,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
segments:
|
89
89
|
- 0
|
90
|
-
hash:
|
90
|
+
hash: 2426833572865576322
|
91
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
92
|
none: false
|
93
93
|
requirements:
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
segments:
|
98
98
|
- 0
|
99
|
-
hash:
|
99
|
+
hash: 2426833572865576322
|
100
100
|
requirements: []
|
101
101
|
rubyforge_project:
|
102
102
|
rubygems_version: 1.8.21
|