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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a20566d57c7dadd951c609eb3531399662d2d0d
4
- data.tar.gz: 62a73bd92464a597af642df9d93977b82c8c99b3
3
+ metadata.gz: 5aa1754f4d3004136025fc17d0668aa48cf21d72
4
+ data.tar.gz: 8404df59ee0a4801668a9131f58a5fd42325c4ec
5
5
  SHA512:
6
- metadata.gz: 04b69bd7e3e64f4821140b6ccbbe95245db7269706e9631572724338fc2485997574d14b5ad76eb5679c5713846d916c335063095467d417c43088086df9f42d
7
- data.tar.gz: 77a198d0388fcc15c92ee4ea7c2f62305aa23741056fe127ab1b537154a58b52ccb1aa95f19fcab10da3ad8397e4df3795ef2bf6e7a3439da0b23f108c3b7cda
6
+ metadata.gz: be03abfb4c1a4ad522e2cfaa365bb1c55f101f78bd389d49e7848c40506e28262400582963e74e633823586d85f314c7162c097eaa8c7d201ca48bbe0d10ab1b
7
+ data.tar.gz: de3a81d7b2beee0e5404ec01349ab35184d59fd4e5898d285c881f1cc8e8eb06c4ec8123a010f2624767ed2dea583f97cb9fe19494e50c7bbaeb7d6e253fb4ba
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trecs (0.3.14)
4
+ trecs (0.3.15)
5
5
  minitar (~> 0.5.4)
6
6
  trollop (~> 2.0)
7
7
 
@@ -44,8 +44,7 @@ module TRecs
44
44
  end
45
45
 
46
46
  def time_to_play(time)
47
- time = time.to_i
48
- timestamps.reverse.detect { |t| t <= time }
47
+ timestamps.reverse.detect { |t| t <= time.to_i }
49
48
  end
50
49
 
51
50
  private
@@ -17,6 +17,10 @@ module TRecs
17
17
  @timestamps = @frames.keys
18
18
  end
19
19
 
20
+ def manifest
21
+ source.manifest
22
+ end
23
+
20
24
  def get_frames
21
25
  frames = {}
22
26
  source.read do
@@ -32,16 +32,14 @@ module TRecs
32
32
  end
33
33
 
34
34
  def current_frame(options={})
35
- time = options.fetch(:time) { next_timestamp }
36
- content = options.fetch(:content)
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 != content
38
+ if @previous_content != current_content
42
39
  new_current_time = current_time + offset
43
- writer.create_frame(time: new_current_time, content: current_content)
44
- @previous_content = content
40
+ options[:time] = new_current_time
41
+ writer.create_frame(options)
42
+ @previous_content = current_content
45
43
  end
46
44
  end
47
45
 
@@ -141,7 +141,6 @@ module TRecs
141
141
  end
142
142
  end
143
143
  end
144
- private
145
144
 
146
145
  # TODO: Este es el punto de interseccion entre read y create_recording
147
146
  def manifest
@@ -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
@@ -10,9 +10,10 @@ module TRecs
10
10
 
11
11
  def initialize(options={})
12
12
  @message = options.fetch(:message)
13
+
13
14
  @width = options.fetch(:width) { 10 }
14
-
15
15
  @width = @message.size if @width < @message.size
16
+
16
17
  @command = options.fetch(:command) { nil }
17
18
  end
18
19
 
@@ -47,7 +47,6 @@ module TRecs
47
47
  attr_reader :testing
48
48
 
49
49
 
50
-
51
50
  def timestamp(time)
52
51
  (time * 1000).to_i
53
52
  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
- recorder.current_frame(time: __time, content: __content)
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 = options.fetch(:step) { 100 }
14
+ @step = options.fetch(:step) { 100 }
15
15
  @command = options.fetch(:command) { nil }
16
- @swiper = options.fetch(:swiper) { "|" }
17
- @hider = options.fetch(: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
- (0..(curr_message.length-1)).each do |i|
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
- @frames.each do |t, c|
40
- @frames[t] = @frames[t].chomp
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
@@ -1,3 +1,3 @@
1
1
  module TRecs
2
- VERSION = "0.3.14"
2
+ VERSION = "0.3.15"
3
3
  end
@@ -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 = options.fetch(:time)
26
+ time = options.fetch(:time)
27
27
  content = options.fetch(:content)
28
- frames[time] = { content: content }
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.14
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-12 00:00:00.000000000 Z
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