class Sshster::Actions::Init

Public Instance Methods

run() click to toggle source
# File lib/sshster/actions/init.rb, line 4
def run
  create_root_dir
  backup_config
  create_sshster_yml
  create_projects_dir
end

Private Instance Methods

backup_config() click to toggle source
# File lib/sshster/actions/init.rb, line 31
def backup_config
  return if origin_config_path.exist?

  if config_path.exist?
    FileUtils.mv(config_path, origin_config_path)
  else
    FileUtils.touch(origin_config_path)
  end
end
create_projects_dir() click to toggle source
# File lib/sshster/actions/init.rb, line 19
def create_projects_dir
  return if projects_path.exist?

  FileUtils.mkdir(projects_path)
end
create_root_dir() click to toggle source
# File lib/sshster/actions/init.rb, line 13
def create_root_dir
  return if root_path.exist?

  FileUtils.mkdir_p(root_path)
end
create_sshster_yml() click to toggle source
# File lib/sshster/actions/init.rb, line 25
def create_sshster_yml
  return if sshster_config_path.exist?

  FileUtils.touch(sshster_config_path)
end