trecs 0.3.13 → 0.3.14
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/readers/json_reader.rb +1 -1
- data/lib/trecs/strategies/{asterisk_swipe_strategy.rb → swipe_strategy.rb} +8 -26
- data/lib/trecs/version.rb +1 -1
- data/spec/trecs/strategies/{asterisk_swipe_strategy_spec.rb → swipe_strategy_spec.rb} +24 -7
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a20566d57c7dadd951c609eb3531399662d2d0d
|
4
|
+
data.tar.gz: 62a73bd92464a597af642df9d93977b82c8c99b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04b69bd7e3e64f4821140b6ccbbe95245db7269706e9631572724338fc2485997574d14b5ad76eb5679c5713846d916c335063095467d417c43088086df9f42d
|
7
|
+
data.tar.gz: 77a198d0388fcc15c92ee4ea7c2f62305aa23741056fe127ab1b537154a58b52ccb1aa95f19fcab10da3ad8397e4df3795ef2bf6e7a3439da0b23f108c3b7cda
|
data/Gemfile.lock
CHANGED
@@ -3,7 +3,7 @@ require "strategies/hash_strategy"
|
|
3
3
|
require "strategies/shell_command_strategy"
|
4
4
|
|
5
5
|
module TRecs
|
6
|
-
class
|
6
|
+
class SwipeStrategy < HashStrategy
|
7
7
|
include Strategy
|
8
8
|
include ShellCommandStrategy
|
9
9
|
attr_reader :message
|
@@ -13,6 +13,8 @@ module TRecs
|
|
13
13
|
@message = options.fetch(:message)
|
14
14
|
@step = options.fetch(:step) { 100 }
|
15
15
|
@command = options.fetch(:command) { nil }
|
16
|
+
@swiper = options.fetch(:swiper) { "|" }
|
17
|
+
@hider = options.fetch(:hider) { "*" }
|
16
18
|
@frames = {}
|
17
19
|
end
|
18
20
|
|
@@ -25,9 +27,9 @@ module TRecs
|
|
25
27
|
current_time = step.to_i * i
|
26
28
|
|
27
29
|
c = curr_message.dup
|
28
|
-
c[i] =
|
30
|
+
c[i] = swiper
|
29
31
|
(i+1..c.length-3).each do |j|
|
30
|
-
c[j] =
|
32
|
+
c[j] = hider
|
31
33
|
end
|
32
34
|
c = c[1..-2]
|
33
35
|
@frames[current_time] = "" unless @frames[current_time]
|
@@ -39,28 +41,8 @@ module TRecs
|
|
39
41
|
end
|
40
42
|
super
|
41
43
|
end
|
44
|
+
private
|
45
|
+
attr_reader :swiper
|
46
|
+
attr_reader :hider
|
42
47
|
end
|
43
48
|
end
|
44
|
-
|
45
|
-
|
46
|
-
# ****
|
47
|
-
# ****
|
48
|
-
#
|
49
|
-
# |***
|
50
|
-
# |***
|
51
|
-
#
|
52
|
-
#
|
53
|
-
# h|**
|
54
|
-
# c|**
|
55
|
-
#
|
56
|
-
# ho|*
|
57
|
-
# ch|*
|
58
|
-
#
|
59
|
-
# hol|
|
60
|
-
# cha|
|
61
|
-
#
|
62
|
-
# hola|
|
63
|
-
# chau|
|
64
|
-
#
|
65
|
-
# hola|
|
66
|
-
# chau|
|
data/lib/trecs/version.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "strategies/
|
2
|
+
require "strategies/swipe_strategy"
|
3
3
|
|
4
4
|
require "recorder"
|
5
5
|
require "strategies/hash_strategy"
|
6
6
|
require "writers/in_memory_writer"
|
7
7
|
|
8
8
|
module TRecs
|
9
|
-
describe
|
9
|
+
describe SwipeStrategy do
|
10
10
|
context "initialization" do
|
11
|
-
When(:strategy) {
|
11
|
+
When(:strategy) { SwipeStrategy.new }
|
12
12
|
Then { expect(strategy).to have_raised(/key not found.*message/) }
|
13
13
|
end
|
14
14
|
|
@@ -20,7 +20,7 @@ module TRecs
|
|
20
20
|
When { recorder.record }
|
21
21
|
|
22
22
|
context "one char" do
|
23
|
-
Given(:strategy) {
|
23
|
+
Given(:strategy) { SwipeStrategy.new(message: "a") }
|
24
24
|
Then { writer.frames[0] == "*" }
|
25
25
|
Then { writer.frames[100] == "|" }
|
26
26
|
Then { writer.frames[200] == "a|" }
|
@@ -28,7 +28,7 @@ module TRecs
|
|
28
28
|
end
|
29
29
|
|
30
30
|
context "two chars" do
|
31
|
-
Given(:strategy) {
|
31
|
+
Given(:strategy) { SwipeStrategy.new(message: "ab", step: 10) }
|
32
32
|
Then { writer.frames[0] == "**" }
|
33
33
|
Then { writer.frames[10] == "|*" }
|
34
34
|
Then { writer.frames[20] == "a|" }
|
@@ -37,7 +37,7 @@ module TRecs
|
|
37
37
|
end
|
38
38
|
|
39
39
|
context "multiple_lines" do
|
40
|
-
Given(:strategy) {
|
40
|
+
Given(:strategy) { SwipeStrategy.new(message: "FIRST\nSECOND") }
|
41
41
|
Then { writer.frames[0] == "******\n******" }
|
42
42
|
Then { writer.frames[100] == "|*****\n|*****" }
|
43
43
|
Then { writer.frames[200] == "F|****\nS|****" }
|
@@ -48,7 +48,24 @@ module TRecs
|
|
48
48
|
Then { writer.frames[700] == "FIRST |\nSECOND|" }
|
49
49
|
Then { writer.frames[800] == "FIRST\nSECOND" }
|
50
50
|
end
|
51
|
-
end
|
52
51
|
|
52
|
+
context "swiper and hider" do
|
53
|
+
context "swiper" do
|
54
|
+
Given(:strategy) { SwipeStrategy.new(message: "a", swiper: ">") }
|
55
|
+
Then { writer.frames[0] == "*" }
|
56
|
+
Then { writer.frames[100] == ">" }
|
57
|
+
Then { writer.frames[200] == "a>" }
|
58
|
+
Then { writer.frames[300] == "a" }
|
59
|
+
end
|
60
|
+
|
61
|
+
context "hider" do
|
62
|
+
Given(:strategy) { SwipeStrategy.new(message: "a", hider: "#") }
|
63
|
+
Then { writer.frames[0] == "#" }
|
64
|
+
Then { writer.frames[100] == "|" }
|
65
|
+
Then { writer.frames[200] == "a|" }
|
66
|
+
Then { writer.frames[300] == "a" }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
53
70
|
end
|
54
71
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Federico Iachetti
|
@@ -125,7 +125,6 @@ files:
|
|
125
125
|
- lib/trecs/screens/terminal_screen.rb
|
126
126
|
- lib/trecs/sources/in_memory_source.rb
|
127
127
|
- lib/trecs/sources/tgz_source.rb
|
128
|
-
- lib/trecs/strategies/asterisk_swipe_strategy.rb
|
129
128
|
- lib/trecs/strategies/config_strategy.rb
|
130
129
|
- lib/trecs/strategies/custom_strategy.rb
|
131
130
|
- lib/trecs/strategies/file_frames_strategy.rb
|
@@ -135,6 +134,7 @@ files:
|
|
135
134
|
- lib/trecs/strategies/raw_file_strategy.rb
|
136
135
|
- lib/trecs/strategies/shell_command_strategy.rb
|
137
136
|
- lib/trecs/strategies/strategy.rb
|
137
|
+
- lib/trecs/strategies/swipe_strategy.rb
|
138
138
|
- lib/trecs/strategies/tmux_session_strategy.rb
|
139
139
|
- lib/trecs/strategies/trecs_file_strategy.rb
|
140
140
|
- lib/trecs/strategies/ttyrec_strategy.rb
|
@@ -160,7 +160,6 @@ files:
|
|
160
160
|
- spec/trecs/recorder_spec.rb
|
161
161
|
- spec/trecs/sources/in_memory_source_spec.rb
|
162
162
|
- spec/trecs/sources/tgz_source_spec.rb
|
163
|
-
- spec/trecs/strategies/asterisk_swipe_strategy_spec.rb
|
164
163
|
- spec/trecs/strategies/config_strategy_spec.rb
|
165
164
|
- spec/trecs/strategies/file_frames_strategy_spec.rb
|
166
165
|
- spec/trecs/strategies/fly_from_right_strategy_spec.rb
|
@@ -168,6 +167,7 @@ files:
|
|
168
167
|
- spec/trecs/strategies/incremental_strategy_spec.rb
|
169
168
|
- spec/trecs/strategies/raw_file_strategy_spec.rb
|
170
169
|
- spec/trecs/strategies/shell_command_strategy_spec.rb
|
170
|
+
- spec/trecs/strategies/swipe_strategy_spec.rb
|
171
171
|
- spec/trecs/strategies/trecs_file_strategy_spec.rb
|
172
172
|
- spec/trecs/tickers/clock_ticker_spec.rb
|
173
173
|
- spec/trecs/writers/in_memory_writer_spec.rb
|
@@ -209,7 +209,6 @@ test_files:
|
|
209
209
|
- spec/trecs/recorder_spec.rb
|
210
210
|
- spec/trecs/sources/in_memory_source_spec.rb
|
211
211
|
- spec/trecs/sources/tgz_source_spec.rb
|
212
|
-
- spec/trecs/strategies/asterisk_swipe_strategy_spec.rb
|
213
212
|
- spec/trecs/strategies/config_strategy_spec.rb
|
214
213
|
- spec/trecs/strategies/file_frames_strategy_spec.rb
|
215
214
|
- spec/trecs/strategies/fly_from_right_strategy_spec.rb
|
@@ -217,6 +216,7 @@ test_files:
|
|
217
216
|
- spec/trecs/strategies/incremental_strategy_spec.rb
|
218
217
|
- spec/trecs/strategies/raw_file_strategy_spec.rb
|
219
218
|
- spec/trecs/strategies/shell_command_strategy_spec.rb
|
219
|
+
- spec/trecs/strategies/swipe_strategy_spec.rb
|
220
220
|
- spec/trecs/strategies/trecs_file_strategy_spec.rb
|
221
221
|
- spec/trecs/tickers/clock_ticker_spec.rb
|
222
222
|
- spec/trecs/writers/in_memory_writer_spec.rb
|