Class: ShellCast::Recorder

Inherits:
Object
  • Object
show all
Defined in:
lib/shellcast/recorder.rb

Constant Summary collapse

HEADER =
"                                        \u2588    \u2588                               \n \u2588\u2588\u2588\u2588\u2588                                  \u2588                                    \n \u2588   \u2593\u2588                                 \u2588                                    \n \u2588    \u2588  \u2588\u2588\u2588    \u2593\u2588\u2588\u2592   \u2588\u2588\u2588    \u2588\u2592\u2588\u2588\u2592  \u2588\u2588\u2593\u2588  \u2588\u2588\u2588    \u2588\u2592\u2588\u2588\u2592   \u2588\u2588\u2593\u2588               \n \u2588   \u2592\u2588 \u2593\u2593 \u2592\u2588  \u2593\u2588  \u2593  \u2588\u2593 \u2593\u2588   \u2588\u2588  \u2588 \u2588\u2593 \u2593\u2588    \u2588    \u2588\u2593 \u2592\u2588  \u2588\u2593 \u2593\u2588               \n \u2588\u2588\u2588\u2588\u2588  \u2588   \u2588  \u2588\u2591     \u2588   \u2588   \u2588     \u2588   \u2588    \u2588    \u2588   \u2588  \u2588   \u2588               \n \u2588  \u2591\u2588\u2592 \u2588\u2588\u2588\u2588\u2588  \u2588      \u2588   \u2588   \u2588     \u2588   \u2588    \u2588    \u2588   \u2588  \u2588   \u2588               \n \u2588   \u2591\u2588 \u2588      \u2588\u2591     \u2588   \u2588   \u2588     \u2588   \u2588    \u2588    \u2588   \u2588  \u2588   \u2588               \n \u2588    \u2588 \u2593\u2593  \u2588  \u2593\u2588  \u2593  \u2588\u2593 \u2593\u2588   \u2588     \u2588\u2593 \u2593\u2588    \u2588    \u2588   \u2588  \u2588\u2593 \u2593\u2588    \u2588      \u2588   \n \u2588    \u2592  \u2588\u2588\u2588\u2592   \u2593\u2588\u2588\u2592   \u2588\u2588\u2588    \u2588      \u2588\u2588\u2593\u2588  \u2588\u2588\u2588\u2588\u2588  \u2588   \u2588   \u2588\u2588\u2592\u2588    \u2588      \u2588   \n                                                             \u2588               \n                                                          \u2593 \u2592\u2588               \n                                                          \u2592\u2588\u2588\u2591              \n"
"          \u2588             \u2588           \u2588                 \u2588        \n \u2588\u2588\u2588\u2588\u2588\u2588                             \u2588                 \u2588    \u2588   \n \u2588                                  \u2588                 \u2588    \u2588   \n \u2588      \u2588\u2588\u2588    \u2588\u2592\u2588\u2588\u2592  \u2588\u2588\u2588    \u2592\u2588\u2588\u2588\u2592  \u2588\u2592\u2588\u2588\u2592   \u2588\u2588\u2588    \u2588\u2588\u2593\u2588    \u2588   \n \u2588        \u2588    \u2588\u2593 \u2592\u2588    \u2588    \u2588\u2592 \u2591\u2588  \u2588\u2593 \u2592\u2588  \u2593\u2593 \u2592\u2588  \u2588\u2593 \u2593\u2588    \u2588   \n \u2588\u2588\u2588\u2588\u2588\u2588   \u2588    \u2588   \u2588    \u2588    \u2588\u2592\u2591    \u2588   \u2588  \u2588   \u2588  \u2588   \u2588    \u2588   \n \u2588        \u2588    \u2588   \u2588    \u2588    \u2591\u2588\u2588\u2588\u2592  \u2588   \u2588  \u2588\u2588\u2588\u2588\u2588  \u2588   \u2588    \u2588   \n \u2588        \u2588    \u2588   \u2588    \u2588       \u2592\u2588  \u2588   \u2588  \u2588      \u2588   \u2588        \n \u2588        \u2588    \u2588   \u2588    \u2588    \u2588\u2591 \u2592\u2588  \u2588   \u2588  \u2593\u2593  \u2588  \u2588\u2593 \u2593\u2588    \u2588   \n \u2588      \u2588\u2588\u2588\u2588\u2588  \u2588   \u2588  \u2588\u2588\u2588\u2588\u2588  \u2592\u2588\u2588\u2588\u2592  \u2588   \u2588   \u2588\u2588\u2588\u2592   \u2588\u2588\u2593\u2588    \u2588   \n\n"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRecorder

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_metadataObject



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 |meta|
    meta.puts @meta.to_json
  end
end