Class: NERA::CUI_Hosts_Editor

Inherits:
Object
  • Object
show all
Defined in:
lib/nera_addhost/add_hosts.rb

Constant Summary collapse

HOST_INFO =
[ [:host_url,String,"host_url"], [:user,String,ENV['USER']], [:job_path,String,"~/"],
[:port,Integer,22], [:keys,String,"~/.ssh/id_rsa"],
[:submission_command,String,"qsub"], [:show_status_command,String,"qstat"]]

Instance Method Summary collapse

Constructor Details

#initialize(db_folder_path) ⇒ CUI_Hosts_Editor

—– the unique module funciton —–



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/nera_addhost/add_hosts.rb', line 15

def initialize( db_folder_path)
  unless valid_nera_db?( db_folder_path)
    raise "\n\n#{db_folder_path} is not a valid nera_db folder."
  end

  dbf = NERA::DbFolders.new( db_folder_path)
  @@hosts = []
  h_yml = dbf.path_to_hosts_yaml
  @@hosts = YAML.load( File.open( h_yml,'r') ) if File.exists?( h_yml)

  edit_hosts_yaml
  YAML.dump( @@hosts, File.open(h_yml,'w') )
end