Class: OnlyofficeFileHelper::LinuxHelper

Inherits:
Object
  • Object
show all
Extended by:
XdotoolHelper
Defined in:
lib/onlyoffice_file_helper/linux_helper.rb

Overview

class for using Linux stuff

Class Method Summary collapse

Methods included from XdotoolHelper

find_window_id, send_button_to_window

Class Method Details

.clipboard_contentString



52
53
54
# File 'lib/onlyoffice_file_helper/linux_helper.rb', line 52

def self.clipboard_content
  `xclip -o`
end

.computer_nameString



43
44
45
46
47
# File 'lib/onlyoffice_file_helper/linux_helper.rb', line 43

def self.computer_name
  computer_name = Socket.gethostname
  OnlyofficeLoggerHelper.log("`LinuxHelper.get_computer_name` # #{computer_name}")
  computer_name
end

.download_file(link, full_name_file) ⇒ Void

Download file by link using



15
16
17
# File 'lib/onlyoffice_file_helper/linux_helper.rb', line 15

def self.download_file(link, full_name_file)
  `wget -O #{full_name_file} #{link}`
end

.kill_all(process) ⇒ Void

Kill All process with specified pattern name



22
23
24
25
# File 'lib/onlyoffice_file_helper/linux_helper.rb', line 22

def self.kill_all(process)
  OnlyofficeLoggerHelper.log("killall -9 #{process} 2>&1")
  `killall -9 #{process} 2>&1`
end

.kill_all_browsersVoid

Just kill all known browsers



29
30
31
32
33
# File 'lib/onlyoffice_file_helper/linux_helper.rb', line 29

def self.kill_all_browsers
  kill_all('firefox')
  kill_all('chrome')
  kill_all('opera')
end

.my_external_ipString



66
67
68
# File 'lib/onlyoffice_file_helper/linux_helper.rb', line 66

def self.my_external_ip
  `curl "http://myexternalip.com/raw"`.chomp
end

.user_dir(name) ⇒ String

Get user dirs specified by ‘xdg-user-dir`



61
62
63
# File 'lib/onlyoffice_file_helper/linux_helper.rb', line 61

def self.user_dir(name)
  `xdg-user-dir #{name.to_s.upcase}`.strip
end

.user_nameString



36
37
38
# File 'lib/onlyoffice_file_helper/linux_helper.rb', line 36

def self.user_name
  `id -u -n`
end