Delete from showterm.io
@param [String] url The URL of the showterm to delete @param [String] secret The secret with which it was uploaded.
# File lib/showterm.rb, line 67 def delete!(url, secret=shared_secret) request = Net::HTTP::Delete.new(URI(url).path) request.set_form_data(:secret => secret) response = http(request) raise response.body unless Net::HTTPSuccess === response response.body end
Record a terminal session.
If a command is given, use that command; otherwise the current user's login shell will be used.
@param [*String] cmd @return [scriptfile, timingfile] the two halves of a termshow
# File lib/showterm.rb, line 16 def record!(*cmd) ret = if use_script? record_with_script(*cmd) else record_with_ttyrec(*cmd) end ret end
Get the current height of the terminal
@return [Integer] number of lines
# File lib/showterm.rb, line 37 def terminal_height guess = `tput lines`.to_i guess == 0 ? 25 : guess end
Get the current width of the terminal
@return [Integer] number of columns
# File lib/showterm.rb, line 28 def terminal_width guess = `tput cols`.to_i guess == 0 ? 80 : guess end
Upload the termshow to showterm.io
@param [String] scriptfile The ANSI dump of the terminal @param [String] timingfile The timings @param [Integer] cols The width of the terminal @param [String] secret The shared secret that will allow deleting this showterm.
# File lib/showterm.rb, line 48 def upload!(scriptfile, timingfile, cols=terminal_width, lines=terminal_height, secret=shared_secret) with_retry do request = Net::HTTP::Post.new("/scripts") request.set_form_data(:scriptfile => scriptfile, :timingfile => timingfile, :cols => cols, :lines => lines, :secret => secret) response = http(request) raise response.body unless Net::HTTPSuccess === response response.body end end
Generated with the Darkfish Rdoc Generator 2.