trecs 0.0.1.alpha → 0.0.1.alpha2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6e8706df641c011fc594a3589b732af9903e583
4
- data.tar.gz: 55584a0ad79f7860e323e92717158cecd52b495d
3
+ metadata.gz: e0b32ef95a9219398a69256bc96e3d3423e2ef29
4
+ data.tar.gz: c8e721483e6f8f8fd85487c95bce9c8a4310b3d6
5
5
  SHA512:
6
- metadata.gz: 87c2377954222bf2af45037321ff28fe74a9ab8a302d0b78e8f3391f08fc2d6a3d07b1e31e38e32c68d64869f73558ee58131470cce8142d704148221623b622
7
- data.tar.gz: c4118a76ee41f5c279d0b911a19772fdb8953319c7f7d4b310fbd51e15855f793daab5486c44610b85d1bbd14d439a1b4287d4a08e66598488e1696aa544ccf7
6
+ metadata.gz: dd6c7ca7f2b396b7ff45618dde8770dcc89c725db4434ac1e08c38ca68711c5b30d004716e81498fae91ad173f08b907181f5de07e3b2ce485e5b9c9b12db1e8
7
+ data.tar.gz: 7053a8ad09c2bb97f31e95e3942956e8b3eda22ed08abc338cf835282e6fafb70f25c1e0adcf0991a7e5bfd46b44d14c86fbac351135bc96909d25320d41acfb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trecs (0.0.1.alpha)
4
+ trecs (0.0.1.alpha2)
5
5
  rubyzip (~> 1.0.0)
6
6
  trollop (~> 2.0)
7
7
 
data/README.org CHANGED
@@ -1,12 +1,6 @@
1
- #+TITLE: README.org
2
- #+AUTHOR: Federico Martín Iachetti
3
- #+EMAIL: iachetti.federico@gmail.com
4
- #+LANGUAGE: en
5
- #+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:nil -:t f:t *:t <:t
6
- #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
7
- #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
8
- #+EXPORT_SELECT_TAGS: export
9
- #+EXPORT_EXCLUDE_TAGS: noexport
1
+ * T-Recs
2
+
3
+ [[https://travis-ci.org/iachettifederico/trecs][Build State]] [[https://travis-ci.org/iachettifederico/trecs.svg]]
10
4
 
11
5
  #+BEGIN_EXAMPLE
12
6
  __________
@@ -26,7 +20,7 @@
26
20
  |_| |_| \_\___|\___|___/
27
21
 
28
22
  #+END_EXAMPLE
29
- * T-Recs
23
+
30
24
  Text Recordings.
31
25
 
32
26
  Record screencasts in plain text.
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift(File.expand_path("../../lib", __FILE__))
4
+
5
+ require "trollop"
6
+
7
+ require "recorders/raw_file_recorder"
8
+
9
+ options = Trollop::options do
10
+ opt :input_file, "File to process", short: 'i', type: String
11
+ opt :output_file, "Output file", short: 'o', type: String, default: "/tmp/output.txt"
12
+ opt :step, "Step", short: 's', type: Integer, default: 100
13
+ end
14
+
15
+ unless options[:output_file]
16
+ puts "Please give an input and an output file file name"
17
+ exit(1)
18
+ end
19
+
20
+ RECORDER = TRecs::RawFileRecorder.new(options)
21
+
22
+ trap "SIGINT" do
23
+ RECORDER.stop
24
+ end
25
+
26
+ puts "Recording ..."
27
+ RECORDER.record
28
+ puts "Finish Recording ..."
data/lib/recorder.rb CHANGED
@@ -42,6 +42,10 @@ module TRecs
42
42
  finish
43
43
  end
44
44
 
45
+ def stop
46
+ recording_strategy.stop
47
+ end
48
+
45
49
  private
46
50
  attr_accessor :recording
47
51
  attr_accessor :previous_content
@@ -0,0 +1,13 @@
1
+ require "timestamps"
2
+
3
+ require "recorders/zip_file_recorder"
4
+ require "recording_strategies/raw_file_recording_strategy"
5
+
6
+ module TRecs
7
+ class RawFileRecorder < ZipFileRecorder
8
+ def initialize(input_file:, output_file:, **options)
9
+ @recording_strategy = RawFileRecordingStrategy.new(recorder: self, file: input_file, **options)
10
+ super(file_name: output_file, **options)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,37 @@
1
+ require "recording_strategy"
2
+ module TRecs
3
+ class RawFileRecordingStrategy < RecordingStrategy
4
+ def initialize(file:, height: 24, width: 80, step: 100, **options)
5
+ raise "File does not exist: #{file}" unless File.exist?(file)
6
+ @file = File.new(file)
7
+ @step = step
8
+ super
9
+ end
10
+
11
+ def perform
12
+ @recording = true
13
+ start_time = Time.now
14
+
15
+ while @recording
16
+ time = timestamp(Time.now - start_time)
17
+ content = File.read(@file)
18
+ recorder.current_frame(time: time, content: content)
19
+ sleep(sleep_time)
20
+ end
21
+ end
22
+
23
+ def stop
24
+ @recording = false
25
+ end
26
+
27
+ private
28
+ def sleep_time
29
+ # TODO: Fix this to use the current time
30
+ @sleep_time ||= (@step/1000.0)
31
+ end
32
+
33
+ def timestamp(time)
34
+ (time * 1000).to_i
35
+ end
36
+ end
37
+ end
data/lib/trecs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module TRecs
2
- VERSION = "0.0.1.alpha"
2
+ VERSION = "0.0.1.alpha2"
3
3
  end
Binary file
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.0.1.alpha
4
+ version: 0.0.1.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Federico Iachetti
@@ -100,6 +100,7 @@ email:
100
100
  executables:
101
101
  - trecs
102
102
  - trecs_message
103
+ - trecs_raw_file
103
104
  - trecs_terminal
104
105
  extensions: []
105
106
  extra_rdoc_files: []
@@ -116,20 +117,24 @@ files:
116
117
  - Rakefile
117
118
  - bin/trecs
118
119
  - bin/trecs_message
120
+ - bin/trecs_raw_file
119
121
  - bin/trecs_terminal
120
122
  - doc/steps.org
121
123
  - lib/player.rb
122
124
  - lib/players/zip_file_player.rb
123
125
  - lib/recorder.rb
124
126
  - lib/recorders/message_recorder.rb
127
+ - lib/recorders/raw_file_recorder.rb
125
128
  - lib/recorders/ttyrec_recorder.rb
126
129
  - lib/recorders/zip_file_recorder.rb
127
130
  - lib/recording_strategies/incremental_recording_strategy.rb
131
+ - lib/recording_strategies/raw_file_recording_strategy.rb
128
132
  - lib/recording_strategies/ttyrec_recording_strategy.rb
129
133
  - lib/recording_strategy.rb
130
134
  - lib/screens/terminal_screen.rb
131
135
  - lib/timestamps.rb
132
136
  - lib/trecs/version.rb
137
+ - pkg/trecs-0.0.1.alpha.gem
133
138
  - sandbox/create_recording.rb
134
139
  - sandbox/lipsum_end
135
140
  - sandbox/lipsum_start