Class: Shelr::Recorder
- Inherits:
-
Object
- Object
- Shelr::Recorder
- Defined in:
- lib/shelr/recorder.rb
Instance Attribute Summary collapse
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#user_columns ⇒ Object
Returns the value of attribute user_columns.
-
#user_rows ⇒ Object
Returns the value of attribute user_rows.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Recorder
constructor
A new instance of Recorder.
- #record! ⇒ Object
- #request_metadata ⇒ Object
Constructor Details
#initialize ⇒ Recorder
Returns a new instance of Recorder.
11 12 13 |
# File 'lib/shelr/recorder.rb', line 11 def initialize @meta = {} end |
Instance Attribute Details
#meta ⇒ Object
Returns the value of attribute meta.
5 6 7 |
# File 'lib/shelr/recorder.rb', line 5 def @meta end |
#user_columns ⇒ Object
Returns the value of attribute user_columns.
5 6 7 |
# File 'lib/shelr/recorder.rb', line 5 def user_columns @user_columns end |
#user_rows ⇒ Object
Returns the value of attribute user_rows.
5 6 7 |
# File 'lib/shelr/recorder.rb', line 5 def user_rows @user_rows end |
Class Method Details
.record! ⇒ Object
7 8 9 |
# File 'lib/shelr/recorder.rb', line 7 def self.record! new.record! end |
Instance Method Details
#record! ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/shelr/recorder.rb', line 15 def record! ensure_terminal_has_good_size check_record_dir with_lock_file do init_terminal Shelr.terminal.puts_line STDOUT.puts "=> Your session started" STDOUT.puts "=> Please, do not resize your terminal while recording" STDOUT.puts "=> Press Ctrl+D or 'exit' to finish recording" Shelr.terminal.puts_line system(recorder_cmd) save_as_typescript if Shelr.backend == 'ttyrec' Shelr.terminal.puts_line STDOUT.puts "=> Session finished" STDOUT.puts STDOUT.puts "Replay : #{Shelr::APP_NAME} play last" STDOUT.puts "Publish : #{Shelr::APP_NAME} push last" end end |
#request_metadata ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/shelr/recorder.rb', line 36 def STDOUT.print "Provide some title for your record: " @meta["title"] = STDIN.gets.strip @meta["recorded_at"] = record_id @meta["columns"] = @user_columns @meta["rows"] = @user_rows @meta["uname"] = `uname -a` @meta["shell"] = ENV['SHELL'] @meta["term"] = ENV['TERM'] @meta["xdg_current_desktop"] = ENV['XDG_CURRENT_DESKTOP'] STDOUT.puts record_file('meta') File.open(record_file('meta'), 'w+') do || .puts @meta.to_json end end |