class DRbQS::Config

Constants

ACL_SAMPLE
BASHRC_SAMPLE
DRBQS_CONFIG_DIRECTORY
HOST_YAML_SAMPLE

Attributes

directory[R]
list[R]
ssh_host[R]

Public Class Methods

get_home_directory() click to toggle source
# File lib/drbqs/config/config.rb, line 26
def self.get_home_directory
  @@home_directory || ENV['HOME']
end
new() click to toggle source
# File lib/drbqs/config/config.rb, line 54
def initialize
  home = self.class.get_home_directory
  @directory = DRbQS::Config::Directory.new(DRBQS_CONFIG_DIRECTORY, :home => home)
  @list = DRbQS::ProcessList.new(File.join(home, DRBQS_CONFIG_DIRECTORY))
  @ssh_host = DRbQS::Config::SSHHost.new(@directory.file_path(HOST_FILE_DIRECTORY))
end
set_home_directory(path) click to toggle source
# File lib/drbqs/config/config.rb, line 22
def self.set_home_directory(path)
  @@home_directory = File.expand_path(path)
end

Public Instance Methods

directory_path() click to toggle source
# File lib/drbqs/config/config.rb, line 61
def directory_path
  @directory.directory
end
get_acl_file() click to toggle source

Return path of ACL file if ‘.drbqs/acl.txt’ exists.

# File lib/drbqs/config/config.rb, line 78
def get_acl_file
  @directory.exist?(ACL_DEFAULT_PATH)
end
get_shell_file_directory() click to toggle source
# File lib/drbqs/config/config.rb, line 82
def get_shell_file_directory
  @directory.file_path(SHELL_FILE_DIRECTORY)
end
save_sample() click to toggle source
# File lib/drbqs/config/config.rb, line 65
def save_sample
  @directory.open(ACL_SAMPLE_PATH, 'w') do |f|
    f.print ACL_SAMPLE
  end
  @directory.open(File.join(HOST_FILE_DIRECTORY, HOST_FILE_SAMPLE_PATH), 'w') do |f|
    f.print HOST_YAML_SAMPLE
  end
  @directory.open(File.join(SHELL_FILE_DIRECTORY, SHELL_BASHRC), 'w') do |f|
    f.print BASHRC_SAMPLE
  end
end