trecs 0.3.14 → 0.3.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/trecs/player.rb +1 -2
- data/lib/trecs/readers/json_reader.rb +4 -0
- data/lib/trecs/recorder.rb +6 -8
- data/lib/trecs/sources/tgz_source.rb +0 -1
- data/lib/trecs/strategies/emacs_plugin_strategy.rb +21 -0
- data/lib/trecs/strategies/fly_from_right_strategy.rb +2 -1
- data/lib/trecs/strategies/raw_file_strategy.rb +0 -1
- data/lib/trecs/strategies/strategy.rb +13 -2
- data/lib/trecs/strategies/swipe_strategy.rb +18 -10
- data/lib/trecs/version.rb +1 -1
- data/lib/trecs/writers/json_writer.rb +10 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5aa1754f4d3004136025fc17d0668aa48cf21d72
|
4
|
+
data.tar.gz: 8404df59ee0a4801668a9131f58a5fd42325c4ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be03abfb4c1a4ad522e2cfaa365bb1c55f101f78bd389d49e7848c40506e28262400582963e74e633823586d85f314c7162c097eaa8c7d201ca48bbe0d10ab1b
|
7
|
+
data.tar.gz: de3a81d7b2beee0e5404ec01349ab35184d59fd4e5898d285c881f1cc8e8eb06c4ec8123a010f2624767ed2dea583f97cb9fe19494e50c7bbaeb7d6e253fb4ba
|
data/Gemfile.lock
CHANGED
data/lib/trecs/player.rb
CHANGED
data/lib/trecs/recorder.rb
CHANGED
@@ -32,16 +32,14 @@ module TRecs
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def current_frame(options={})
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
@current_time = time
|
39
|
-
@current_content = content
|
35
|
+
@current_time = options.fetch(:time) { next_timestamp }
|
36
|
+
@current_content = options.fetch(:content)
|
40
37
|
|
41
|
-
if @previous_content !=
|
38
|
+
if @previous_content != current_content
|
42
39
|
new_current_time = current_time + offset
|
43
|
-
|
44
|
-
|
40
|
+
options[:time] = new_current_time
|
41
|
+
writer.create_frame(options)
|
42
|
+
@previous_content = current_content
|
45
43
|
end
|
46
44
|
end
|
47
45
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "strategies/raw_file_strategy"
|
2
|
+
|
3
|
+
module TRecs
|
4
|
+
class EmacsPluginStrategy < RawFileStrategy
|
5
|
+
def initialize(options={})
|
6
|
+
file = "/tmp/emacs-session-recording.html"
|
7
|
+
@file = File.open(file)
|
8
|
+
|
9
|
+
@clock = options.fetch(:clock) { Time }
|
10
|
+
@testing = options.fetch(:testing) { false }
|
11
|
+
|
12
|
+
current_format(:html)
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def current_content(content=nil)
|
17
|
+
content.gsub!(/body {\n/, "pre.trecs-code {\n")
|
18
|
+
super(content)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -9,6 +9,7 @@ module TRecs
|
|
9
9
|
|
10
10
|
attr_accessor :__time
|
11
11
|
attr_accessor :__content
|
12
|
+
attr_accessor :__format
|
12
13
|
|
13
14
|
def current_time(time=nil)
|
14
15
|
if time
|
@@ -23,9 +24,19 @@ module TRecs
|
|
23
24
|
end
|
24
25
|
@__content
|
25
26
|
end
|
26
|
-
|
27
|
+
|
28
|
+
def current_format(format=nil)
|
29
|
+
if format
|
30
|
+
@__format = format
|
31
|
+
end
|
32
|
+
@__format
|
33
|
+
end
|
34
|
+
|
27
35
|
def save_frame
|
28
|
-
|
36
|
+
options = {time: __time, content: __content, format: __format}
|
37
|
+
options.reject! {|k,v| v.nil?}
|
38
|
+
|
39
|
+
recorder.current_frame(options)
|
29
40
|
end
|
30
41
|
end
|
31
42
|
end
|
@@ -11,19 +11,17 @@ module TRecs
|
|
11
11
|
|
12
12
|
def initialize(options={})
|
13
13
|
@message = options.fetch(:message)
|
14
|
-
@step
|
14
|
+
@step = options.fetch(:step) { 100 }
|
15
15
|
@command = options.fetch(:command) { nil }
|
16
|
-
@swiper
|
17
|
-
@hider
|
18
|
-
@frames
|
16
|
+
@swiper = options.fetch(:swiper) { "|" }
|
17
|
+
@hider = options.fetch(:hider) { "*" }
|
18
|
+
@frames = {}
|
19
19
|
end
|
20
20
|
|
21
21
|
def perform
|
22
|
-
max_line_size = message.each_line.inject(0) { |max, l| l.size > max ? l.size : max }
|
23
|
-
|
24
22
|
message.each_line do |line|
|
25
23
|
curr_message = " %-#{max_line_size}s " % line.chomp
|
26
|
-
|
24
|
+
curr_message.length.times do |i|
|
27
25
|
current_time = step.to_i * i
|
28
26
|
|
29
27
|
c = curr_message.dup
|
@@ -36,13 +34,23 @@ module TRecs
|
|
36
34
|
@frames[current_time] = @frames[current_time] << c.strip + "\n"
|
37
35
|
end
|
38
36
|
end
|
39
|
-
|
40
|
-
|
41
|
-
end
|
37
|
+
|
38
|
+
cleanup_frames
|
42
39
|
super
|
43
40
|
end
|
41
|
+
|
44
42
|
private
|
45
43
|
attr_reader :swiper
|
46
44
|
attr_reader :hider
|
45
|
+
|
46
|
+
def cleanup_frames
|
47
|
+
@frames.each do |t, c|
|
48
|
+
@frames[t] = @frames[t].chomp
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def max_line_size
|
53
|
+
message.each_line.inject(0) { |max, l| l.size > max ? l.size : max }
|
54
|
+
end
|
47
55
|
end
|
48
56
|
end
|
data/lib/trecs/version.rb
CHANGED
@@ -21,11 +21,18 @@ module TRecs
|
|
21
21
|
def setup
|
22
22
|
@frames = {}
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
def create_frame(options={})
|
26
|
-
time
|
26
|
+
time = options.fetch(:time)
|
27
27
|
content = options.fetch(:content)
|
28
|
-
|
28
|
+
format = options.fetch(:format) { nil }
|
29
|
+
|
30
|
+
frame = {
|
31
|
+
format: format,
|
32
|
+
content: content,
|
33
|
+
}
|
34
|
+
|
35
|
+
frames[time] = frame
|
29
36
|
end
|
30
37
|
|
31
38
|
def render
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trecs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Federico Iachetti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/trecs/sources/tgz_source.rb
|
128
128
|
- lib/trecs/strategies/config_strategy.rb
|
129
129
|
- lib/trecs/strategies/custom_strategy.rb
|
130
|
+
- lib/trecs/strategies/emacs_plugin_strategy.rb
|
130
131
|
- lib/trecs/strategies/file_frames_strategy.rb
|
131
132
|
- lib/trecs/strategies/fly_from_right_strategy.rb
|
132
133
|
- lib/trecs/strategies/hash_strategy.rb
|