Class: OnlyofficeFileHelper::LinuxHelper
- Inherits:
-
Object
- Object
- OnlyofficeFileHelper::LinuxHelper
- Extended by:
- XdotoolHelper
- Defined in:
- lib/onlyoffice_file_helper/linux_helper.rb
Overview
class for using Linux stuff
Class Method Summary collapse
-
.clipboard_content ⇒ String
Content of clipboard.
-
.computer_name ⇒ String
Current computer name.
-
.download_file(link, full_name_file) ⇒ Void
Download file by link using.
-
.kill_all(process) ⇒ Void
Kill All process with specified pattern name.
-
.kill_all_browsers ⇒ Void
Just kill all known browsers.
-
.my_external_ip ⇒ String
External ip of system.
-
.user_dir(name) ⇒ String
Get user dirs specified by ‘xdg-user-dir`.
-
.user_name ⇒ String
Current user name.
Methods included from XdotoolHelper
find_window_id, send_button_to_window
Class Method Details
.clipboard_content ⇒ String
Returns content of clipboard.
52 53 54 |
# File 'lib/onlyoffice_file_helper/linux_helper.rb', line 52 def self.clipboard_content `xclip -o` end |
.computer_name ⇒ String
Returns current computer name.
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_browsers ⇒ Void
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_ip ⇒ String
Returns external ip of system.
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_name ⇒ String
Returns current user name.
36 37 38 |
# File 'lib/onlyoffice_file_helper/linux_helper.rb', line 36 def self.user_name `id -u -n` end |