Class: ShellCast::Recorder
- Inherits:
-
Object
- Object
- ShellCast::Recorder
- Defined in:
- lib/shellcast/recorder.rb
Constant Summary collapse
- HEADER =
<<-EOH █ █ █████ █ █ ▓█ █ █ █ ███ ▓██▒ ███ █▒██▒ ██▓█ ███ █▒██▒ ██▓█ █ ▒█ ▓▓ ▒█ ▓█ ▓ █▓ ▓█ ██ █ █▓ ▓█ █ █▓ ▒█ █▓ ▓█ █████ █ █ █░ █ █ █ █ █ █ █ █ █ █ █ ░█▒ █████ █ █ █ █ █ █ █ █ █ █ █ █ ░█ █ █░ █ █ █ █ █ █ █ █ █ █ █ █ ▓▓ █ ▓█ ▓ █▓ ▓█ █ █▓ ▓█ █ █ █ █▓ ▓█ █ █ █ ▒ ███▒ ▓██▒ ███ █ ██▓█ █████ █ █ ██▒█ █ █ █ ▓ ▒█ ▒██░ EOH
- FOOTER =
<<-EOF █ █ █ █ ██████ █ █ █ █ █ █ █ █ ███ █▒██▒ ███ ▒███▒ █▒██▒ ███ ██▓█ █ █ █ █▓ ▒█ █ █▒ ░█ █▓ ▒█ ▓▓ ▒█ █▓ ▓█ █ ██████ █ █ █ █ █▒░ █ █ █ █ █ █ █ █ █ █ █ █ ░███▒ █ █ █████ █ █ █ █ █ █ █ █ ▒█ █ █ █ █ █ █ █ █ █ █ █░ ▒█ █ █ ▓▓ █ █▓ ▓█ █ █ █████ █ █ █████ ▒███▒ █ █ ███▒ ██▓█ █ EOF
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.
39 40 41 |
# File 'lib/shellcast/recorder.rb', line 39 def initialize @meta = {} end |
Class Method Details
.record! ⇒ Object
35 36 37 |
# File 'lib/shellcast/recorder.rb', line 35 def self.record! new.record! end |
Instance Method Details
#record! ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/shellcast/recorder.rb', line 43 def record! test_shellcast_data_dir puts HEADER.black_on_white puts "Your session started" puts "Type Ctrl+D or exit to finish recording" init_terminal system(script_cmd) restore_terminal puts FOOTER.black_on_white puts "hint $ shellcast play #{shellcast_id}".green end |
#request_metadata ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/shellcast/recorder.rb', line 56 def print "Provide name for Your shellcast: " @meta["title"] = STDIN.gets.strip @meta["created_at"] = shellcast_id puts shellcast_file('meta') File.open(shellcast_file('meta'), 'w+') do || .puts @meta.to_json end end |