Class: Expect4r::RShell

Inherits:
BaseLoginObject show all
Defined in:
lib/misc/shell.rb

Instance Attribute Summary

Attributes inherited from BaseLoginObject

#host, #method, #port, #proxy, #ssh_options, #user

Instance Method Summary collapse

Methods inherited from BaseLoginObject

add, #cmp, #connect_retry, #connect_retry=, #dup, #enable_password, new_ssh, new_telnet, #password, #spawnee, #spawnee_prompt, #spawnee_username

Methods inherited from Base

add, all

Methods included from Expect4r

#_login, #child_exit, #connected?, #exp_print, #exp_puts, #exp_send, #expect, #get_prompt, #getc, #interact, #login_by_proxy, #putc, #putcr, #read_until, #readline, #spawn

Constructor Details

#initialize(*args) ⇒ RShell

Returns a new instance of RShell.



16
17
18
19
# File 'lib/misc/shell.rb', line 16

def initialize(*args)
  super
  default_ps1
end

Instance Method Details

#cmd(*args) ⇒ Object



39
40
41
# File 'lib/misc/shell.rb', line 39

def cmd(*args)
  exp_send *args
end

#login(arg = {}) ⇒ Object Also known as: _login_



24
25
26
27
# File 'lib/misc/shell.rb', line 24

def (arg={}) 
  super(spawnee, arg)
  cmd %{export COLUMNS=1024}
end

#logoutObject



20
21
22
23
# File 'lib/misc/shell.rb', line 20

def logout
  default_ps1
  super
end

#ps1=(val) ⇒ Object



33
34
35
36
37
38
# File 'lib/misc/shell.rb', line 33

def ps1=(val)
  # Assumes bash
  @ps1_bis = /#{val}$/
  cmd %? export PS1='#{val}' ?
  @ps1 = @ps1_bis
end