trecs 0.4.0 → 0.4.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/trecs/strategies/emacs_plugin_strategy.rb +5 -6
- data/lib/trecs/strategies/swipe_strategy.rb +2 -3
- data/lib/trecs/strategies/tmux_session_strategy.rb +17 -18
- data/lib/trecs/version.rb +1 -1
- data/spec/trecs/strategies/fly_from_right_strategy_spec.rb +0 -2
- data/spec/trecs/strategies/hash_strategy_spec.rb +0 -1
- data/spec/trecs/strategies/incremental_strategy_spec.rb +0 -1
- data/spec/trecs/strategies/swipe_strategy_spec.rb +61 -62
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ff49f07ddfe14f4149cc6633011195b0bcbfe93
|
4
|
+
data.tar.gz: a619e937967b0a856b470ed366f1704e073b43da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02bd8f5842139767983a1f2b9a9d7dc791f42345167e884dbc0a0620dd76b447d3f2caa95d0ffc6a07def1097e69a75c33e3e285fd4ac3c0431e4edbd5117f6b
|
7
|
+
data.tar.gz: 35330ad17b08a0322368ef750dba3fa2fa5c890262e0e81f4c256574fe398f2ddd15a226b64f5520fbfe68fb2adb608ba64dc310304d91e7817da15c890cb5c6
|
data/Gemfile.lock
CHANGED
@@ -7,11 +7,10 @@ module TRecs
|
|
7
7
|
file = "/tmp/emacs-session-recording.html"
|
8
8
|
@file = File.open(file)
|
9
9
|
|
10
|
-
@clock = options.fetch(:clock)
|
11
|
-
@testing = options.fetch(:testing) { false }
|
10
|
+
@clock = options.fetch(:clock) { Time }
|
12
11
|
|
13
|
-
@height =
|
14
|
-
@width =
|
12
|
+
@height = options.fetch(:height) { 0 }
|
13
|
+
@width = options.fetch(:width) { 0 }
|
15
14
|
end
|
16
15
|
|
17
16
|
def perform
|
@@ -48,9 +47,9 @@ module TRecs
|
|
48
47
|
.split("\n").join("<do not compute>")[/\s+<pre>(.+)<\/pre>/, 1]
|
49
48
|
.split("<do not compute>").join("\n")
|
50
49
|
.gsub(/\/\*.+\*\//, "")
|
51
|
-
|
50
|
+
# .gsub!(/^\s/, "").gsub!(/^(<[^\/]\w+ (\w+=['"][^>]+['"])*>)+ /) {|m| m[-1]=""; m } # clean extra space at the begining of each line
|
52
51
|
|
53
|
-
new_content = "<style>#{style}</style><pre style='border: 2px solid #898989;width: #{@width
|
52
|
+
new_content = "<style>#{style}</style><pre style='border: 2px solid #898989;width: #{@width/1.5}em;height: #{@height/1.55}em' class='emacs-code'>#{code}</pre>"
|
54
53
|
|
55
54
|
super(new_content)
|
56
55
|
end
|
@@ -28,13 +28,12 @@ module TRecs
|
|
28
28
|
c[j] = hider
|
29
29
|
end
|
30
30
|
c = c[1..-2]
|
31
|
-
@frames[current_time]
|
32
|
-
@frames[current_time]
|
31
|
+
@frames[current_time] ||= ""
|
32
|
+
@frames[current_time] << c.strip + "\n"
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
cleanup_frames
|
37
|
-
#super
|
38
37
|
end
|
39
38
|
|
40
39
|
private
|
@@ -6,25 +6,26 @@ module TRecs
|
|
6
6
|
|
7
7
|
def initialize(options={})
|
8
8
|
super(options)
|
9
|
-
@frames = []
|
10
|
-
@step =
|
9
|
+
# @frames = []
|
10
|
+
@step = options.fetch(:step) { 100 }
|
11
11
|
@color = options.fetch(:color) { true }
|
12
12
|
set_color_or_bw
|
13
13
|
end
|
14
14
|
|
15
15
|
def perform
|
16
16
|
start_recording
|
17
|
+
t = -step
|
17
18
|
while(recording)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
t += step
|
20
|
+
current_time(t)
|
21
|
+
current_content(get_current_frame)
|
22
|
+
save_frame
|
23
|
+
sleep(step/1000.0)
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
def
|
26
|
-
@
|
27
|
-
set_command
|
27
|
+
def capture_command
|
28
|
+
@capture_command ||= set_capture_command
|
28
29
|
end
|
29
30
|
|
30
31
|
def stop
|
@@ -40,17 +41,15 @@ module TRecs
|
|
40
41
|
@color = @color ? "-e" : "-C"
|
41
42
|
end
|
42
43
|
|
43
|
-
def
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
def set_capture_command
|
45
|
+
capture_command = %W[tmux capture-pane]
|
46
|
+
capture_command << @color if @color
|
47
|
+
capture_command
|
47
48
|
end
|
48
49
|
|
49
|
-
def
|
50
|
-
system *
|
51
|
-
IO.popen(%W[tmux show-buffer])
|
52
|
-
yield out.read
|
53
|
-
end
|
50
|
+
def get_current_frame
|
51
|
+
system *capture_command
|
52
|
+
IO.popen(%W[tmux show-buffer]).read
|
54
53
|
end
|
55
54
|
end
|
56
55
|
end
|
data/lib/trecs/version.rb
CHANGED
@@ -42,11 +42,9 @@ module TRecs
|
|
42
42
|
|
43
43
|
When { strategy.recorder = recorder }
|
44
44
|
When { recorder.record }
|
45
|
-
When { strategy.perform }
|
46
45
|
|
47
46
|
When { recorder.stub(:step) { 100 } }
|
48
47
|
When { strategy.recorder = recorder }
|
49
|
-
When { strategy.perform }
|
50
48
|
|
51
49
|
Then { writer.frames[0] == "" }
|
52
50
|
Then { writer.frames[100] == " a" }
|
@@ -7,67 +7,66 @@ require "writers/in_memory_writer"
|
|
7
7
|
|
8
8
|
module TRecs
|
9
9
|
describe SwipeStrategy do
|
10
|
-
skip("Modify Swipe")
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
#end
|
10
|
+
#skip("Modify Swipe")
|
11
|
+
context "initialization" do
|
12
|
+
When(:strategy) { SwipeStrategy.new }
|
13
|
+
Then { expect(strategy).to have_raised(/key not found.*message/) }
|
14
|
+
end
|
15
|
+
|
16
|
+
context "performing" do
|
17
|
+
Given(:writer) { InMemoryWriter.new }
|
18
|
+
Given(:recorder) { Recorder.new(strategy: strategy, writer: writer) }
|
19
|
+
|
20
|
+
When { strategy.recorder = recorder }
|
21
|
+
When { recorder.record }
|
22
|
+
|
23
|
+
context "one char" do
|
24
|
+
Given(:strategy) { SwipeStrategy.new(message: "a") }
|
25
|
+
Then { writer.frames[0] == "*" }
|
26
|
+
Then { writer.frames[100] == "|" }
|
27
|
+
Then { writer.frames[200] == "a|" }
|
28
|
+
Then { writer.frames[300] == "a" }
|
29
|
+
end
|
30
|
+
|
31
|
+
context "two chars" do
|
32
|
+
Given(:strategy) { SwipeStrategy.new(message: "ab", step: 10) }
|
33
|
+
Then { writer.frames[0] == "**" }
|
34
|
+
Then { writer.frames[10] == "|*" }
|
35
|
+
Then { writer.frames[20] == "a|" }
|
36
|
+
Then { writer.frames[30] == "ab|" }
|
37
|
+
Then { writer.frames[40] == "ab" }
|
38
|
+
end
|
39
|
+
|
40
|
+
context "multiple_lines" do
|
41
|
+
Given(:strategy) { SwipeStrategy.new(message: "FIRST\nSECOND") }
|
42
|
+
Then { writer.frames[0] == "******\n******" }
|
43
|
+
Then { writer.frames[100] == "|*****\n|*****" }
|
44
|
+
Then { writer.frames[200] == "F|****\nS|****" }
|
45
|
+
Then { writer.frames[300] == "FI|***\nSE|***" }
|
46
|
+
Then { writer.frames[400] == "FIR|**\nSEC|**" }
|
47
|
+
Then { writer.frames[500] == "FIRS|*\nSECO|*" }
|
48
|
+
Then { writer.frames[600] == "FIRST|\nSECON|" }
|
49
|
+
Then { writer.frames[700] == "FIRST |\nSECOND|" }
|
50
|
+
Then { writer.frames[800] == "FIRST\nSECOND" }
|
51
|
+
end
|
52
|
+
|
53
|
+
context "swiper and hider" do
|
54
|
+
context "swiper" do
|
55
|
+
Given(:strategy) { SwipeStrategy.new(message: "a", swiper: ">") }
|
56
|
+
Then { writer.frames[0] == "*" }
|
57
|
+
Then { writer.frames[100] == ">" }
|
58
|
+
Then { writer.frames[200] == "a>" }
|
59
|
+
Then { writer.frames[300] == "a" }
|
60
|
+
end
|
61
|
+
|
62
|
+
context "hider" do
|
63
|
+
Given(:strategy) { SwipeStrategy.new(message: "a", hider: "#") }
|
64
|
+
Then { writer.frames[0] == "#" }
|
65
|
+
Then { writer.frames[100] == "|" }
|
66
|
+
Then { writer.frames[200] == "a|" }
|
67
|
+
Then { writer.frames[300] == "a" }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
72
71
|
end
|
73
72
|
end
|
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.4.
|
4
|
+
version: 0.4.1
|
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-
|
11
|
+
date: 2014-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
198
|
version: '0'
|
199
199
|
requirements: []
|
200
200
|
rubyforge_project:
|
201
|
-
rubygems_version: 2.
|
201
|
+
rubygems_version: 2.4.2
|
202
202
|
signing_key:
|
203
203
|
specification_version: 4
|
204
204
|
summary: 'TRecs: Text Recordings.'
|