onlyoffice_file_helper 0.1.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/onlyoffice_file_helper/create_methods.rb +34 -0
- data/lib/onlyoffice_file_helper/directory_methods.rb +58 -0
- data/lib/onlyoffice_file_helper/linux_helper/xdotool_helper.rb +2 -8
- data/lib/onlyoffice_file_helper/linux_helper.rb +26 -12
- data/lib/onlyoffice_file_helper/name.rb +6 -0
- data/lib/onlyoffice_file_helper/read_methods.rb +47 -0
- data/lib/onlyoffice_file_helper/ruby_helper.rb +11 -0
- data/lib/onlyoffice_file_helper/string_helper.rb +18 -13
- data/lib/onlyoffice_file_helper/version.rb +4 -1
- data/lib/onlyoffice_file_helper.rb +41 -111
- metadata +150 -10
- data/README.md +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b18003c971b29ad3a526be4c6a1c5a9715a679852e9f1f669b5df5556af68d84
|
4
|
+
data.tar.gz: 830540033c0e29f1c6407102cb635a3988889533bb3bc8fd047c2972aaa24e50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f02f38cced0b75b7d4c203d9b8c7c92d463a67a1948cf512ffecc3b5a07e46adea14ebd9d5f0e2347d00cd144b2eecba1337648bc3a854d1a181df87171967ec
|
7
|
+
data.tar.gz: 4ce796b78aebc6478b4d88ef9ad304b13e43710ff7ba69cab1a8290b6437ee2182d990a21cd64869b4d088b32c85dcd8be95c389c25274b3418cb3a1d89d50f7
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OnlyofficeFileHelper
|
4
|
+
# Methods used to create something
|
5
|
+
module CreateMethods
|
6
|
+
# Gracefully create folder. Do not fail if already exists
|
7
|
+
# @param path [String] path to folder
|
8
|
+
# @return [Void]
|
9
|
+
def create_folder(path)
|
10
|
+
FileUtils.mkdir_p(path) unless File.directory?(path)
|
11
|
+
rescue Errno::EEXIST
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
# Create file with content
|
16
|
+
# @param file_path [String] path to created file
|
17
|
+
# @param [String] content content of file
|
18
|
+
# @return [String] path to created file
|
19
|
+
def create_file_with_content(file_path: '/tmp/temp_file.ext', content: '')
|
20
|
+
File.open(file_path, 'w') { |f| f.write(content) }
|
21
|
+
OnlyofficeLoggerHelper.log("Created file: #{file_path} with content: #{content}")
|
22
|
+
file_path
|
23
|
+
end
|
24
|
+
|
25
|
+
# Create empty file with size
|
26
|
+
# @param file_path [String] path to created file
|
27
|
+
# @param size [String] file size, may use binary indexes lik '256M', '15G'
|
28
|
+
# @return [String] path to created file
|
29
|
+
def create_file_with_size(file_path: '/tmp/temp_file.ext', size: '1G')
|
30
|
+
`fallocate -l #{size} #{file_path}`
|
31
|
+
file_path
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OnlyofficeFileHelper
|
4
|
+
# Methods used to work with directories
|
5
|
+
module DirectoryMethods
|
6
|
+
# @return [Array<String>] list of linux special dirs
|
7
|
+
LINUX_SPECIAL_DIRS = %w[.. .].freeze
|
8
|
+
|
9
|
+
# Delete directory only if it exists
|
10
|
+
# @param path [String] directory to delete
|
11
|
+
# @return [Void]
|
12
|
+
def delete_directory(path)
|
13
|
+
FileUtils.rm_rf(path) if Dir.exist?(path)
|
14
|
+
end
|
15
|
+
|
16
|
+
# List of files in directory as array
|
17
|
+
# @param path [String] path to directory
|
18
|
+
# @return [Array<String>] list of all files
|
19
|
+
def directory_hash(path)
|
20
|
+
files = []
|
21
|
+
Dir.foreach(path).sort.each do |entry|
|
22
|
+
next if LINUX_SPECIAL_DIRS.include?(entry)
|
23
|
+
|
24
|
+
full_path = File.join(path, entry)
|
25
|
+
files = root_dir_hash(files, full_path)
|
26
|
+
end
|
27
|
+
files.keep_if { |current| current.end_with?('_spec.rb') }
|
28
|
+
files
|
29
|
+
end
|
30
|
+
|
31
|
+
# List all files in directory
|
32
|
+
# @param directory [String] path to directory
|
33
|
+
# @param extension [String] filter extension
|
34
|
+
# @return [Array<String>] list of all files
|
35
|
+
def list_file_in_directory(directory, extension = nil)
|
36
|
+
paths = []
|
37
|
+
Find.find(directory) do |path|
|
38
|
+
next if FileTest.directory?(path)
|
39
|
+
|
40
|
+
paths << path if extension.nil? || File.extname(path) == ".#{extension}"
|
41
|
+
end
|
42
|
+
paths
|
43
|
+
rescue Errno::ENOENT
|
44
|
+
[]
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def root_dir_hash(files, path)
|
50
|
+
if File.directory?(path)
|
51
|
+
files += directory_hash(path)
|
52
|
+
else
|
53
|
+
files << path
|
54
|
+
end
|
55
|
+
files
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OnlyofficeFileHelper
|
2
4
|
# Class for working with Xdotool
|
3
5
|
# Performs actions with x-system
|
@@ -8,14 +10,6 @@ module OnlyofficeFileHelper
|
|
8
10
|
`xdotool search '#{window_title}'`.to_i
|
9
11
|
end
|
10
12
|
|
11
|
-
# Close any window by it's title
|
12
|
-
# @param window_title [String] title of window to close
|
13
|
-
# @return [Nothing]
|
14
|
-
def close_x_window(window_title)
|
15
|
-
window_id = find_window_id(window_title)
|
16
|
-
`xdotool windowkill #{window_id}`
|
17
|
-
end
|
18
|
-
|
19
13
|
# Send button to specific window
|
20
14
|
# @param window_title [String] title of window to close
|
21
15
|
# @param button [String] button to send
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'socket'
|
2
4
|
require_relative 'linux_helper/xdotool_helper'
|
3
5
|
|
@@ -6,42 +8,53 @@ module OnlyofficeFileHelper
|
|
6
8
|
class LinuxHelper
|
7
9
|
extend XdotoolHelper
|
8
10
|
|
11
|
+
# Download file by link using
|
12
|
+
# @param link [String] url to download
|
13
|
+
# @param full_name_file [String] path to save file
|
14
|
+
# @return [Void]
|
9
15
|
def self.download_file(link, full_name_file)
|
10
16
|
`wget -O #{full_name_file} #{link}`
|
11
17
|
end
|
12
18
|
|
19
|
+
# Kill All process with specified pattern name
|
20
|
+
# @param process [String] names of process
|
21
|
+
# @return [Void]
|
13
22
|
def self.kill_all(process)
|
14
|
-
|
23
|
+
OnlyofficeLoggerHelper.log("killall -9 #{process} 2>&1")
|
15
24
|
`killall -9 #{process} 2>&1`
|
16
25
|
end
|
17
26
|
|
27
|
+
# Just kill all known browsers
|
28
|
+
# @return [Void]
|
18
29
|
def self.kill_all_browsers
|
19
30
|
kill_all('firefox')
|
20
31
|
kill_all('chrome')
|
21
32
|
kill_all('opera')
|
22
33
|
end
|
23
34
|
|
24
|
-
|
35
|
+
# @return [String] current user name
|
36
|
+
def self.user_name
|
25
37
|
`id -u -n`
|
26
38
|
end
|
27
39
|
|
28
|
-
|
29
|
-
'/mnt/data_share/'
|
30
|
-
end
|
40
|
+
singleton_class.send(:alias_method, :get_user_name, :user_name)
|
31
41
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
ip_to_run
|
37
|
-
end
|
42
|
+
# @return [String] current computer name
|
43
|
+
def self.computer_name
|
44
|
+
computer_name = Socket.gethostname
|
45
|
+
OnlyofficeLoggerHelper.log("`LinuxHelper.get_computer_name` # #{computer_name}")
|
38
46
|
computer_name
|
39
47
|
end
|
40
48
|
|
41
|
-
|
49
|
+
singleton_class.send(:alias_method, :get_computer_name, :computer_name)
|
50
|
+
|
51
|
+
# @return [String] content of clipboard
|
52
|
+
def self.clipboard_content
|
42
53
|
`xclip -o`
|
43
54
|
end
|
44
55
|
|
56
|
+
singleton_class.send(:alias_method, :get_clipboard, :clipboard_content)
|
57
|
+
|
45
58
|
# Get user dirs specified by `xdg-user-dir`
|
46
59
|
# @param name [Symbol, String] name of user dir
|
47
60
|
# @return [String] path to dir
|
@@ -49,6 +62,7 @@ module OnlyofficeFileHelper
|
|
49
62
|
`xdg-user-dir #{name.to_s.upcase}`.strip
|
50
63
|
end
|
51
64
|
|
65
|
+
# @return [String] external ip of system
|
52
66
|
def self.my_external_ip
|
53
67
|
`curl "http://myexternalip.com/raw"`.chomp
|
54
68
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OnlyofficeFileHelper
|
4
|
+
# Methods used to read something
|
5
|
+
module ReadMethods
|
6
|
+
# Read file content to string
|
7
|
+
# @param file_name [String] file to read
|
8
|
+
# @return [String] result of read
|
9
|
+
def read_file_to_string(file_name)
|
10
|
+
result_string = ''
|
11
|
+
raise "File not found: #{file_name}" unless File.exist?(file_name)
|
12
|
+
|
13
|
+
File.open(file_name, 'r') do |infile|
|
14
|
+
while (line = infile.gets)
|
15
|
+
result_string += line
|
16
|
+
end
|
17
|
+
end
|
18
|
+
result_string
|
19
|
+
end
|
20
|
+
|
21
|
+
# Read file content to array, split by newline
|
22
|
+
# @param file_name [String] path to file
|
23
|
+
# @return [Array<String>] result of read
|
24
|
+
def read_array_from_file(file_name)
|
25
|
+
result_array = []
|
26
|
+
return [] unless File.exist?(file_name)
|
27
|
+
|
28
|
+
File.open(file_name, 'r') do |infile|
|
29
|
+
while (line = infile.gets)
|
30
|
+
result_array << line.sub("\n", '')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
result_array
|
34
|
+
end
|
35
|
+
|
36
|
+
# Get line count in file
|
37
|
+
# @param file_name [String] name of file
|
38
|
+
# @param line_number [Fixnum] line of file to get
|
39
|
+
# @return [String] line of file by number
|
40
|
+
def read_specific_line(file_name, line_number)
|
41
|
+
line = `sed '#{line_number + 1}!d' #{file_name}`
|
42
|
+
line.chop! if line[-1] == "\n"
|
43
|
+
OnlyofficeLoggerHelper.log("Lines in '#{file_name}' by number is '#{line}'")
|
44
|
+
line
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -1,15 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module OnlyofficeFileHelper
|
2
4
|
# Helper for Strings
|
3
5
|
class StringHelper
|
4
6
|
class << self
|
7
|
+
# Random string with specific length
|
8
|
+
# @param length_string [Integer] length of string
|
9
|
+
# @return [String] string with length
|
5
10
|
def generate_random_string(length_string = 32)
|
6
11
|
(0...length_string).map { (('a'..'z').to_a + ('A'..'Z').to_a)[rand(52)] }.join
|
7
12
|
end
|
8
13
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
14
|
+
# Generate random number with prefix
|
15
|
+
# @param value [String, Integer] prefix to generate
|
16
|
+
# @return [String] result of random number
|
13
17
|
def generate_random_number(value = nil)
|
14
18
|
"#{value}: #{Time.now.nsec}"
|
15
19
|
end
|
@@ -19,22 +23,23 @@ module OnlyofficeFileHelper
|
|
19
23
|
# @param [String] first_element 1'st element to compare
|
20
24
|
# @param [String] second_element 2'st element to compare
|
21
25
|
# @return [String] String with result of comparison
|
22
|
-
def get_result_string_of_comparison(compare_parameter,
|
26
|
+
def get_result_string_of_comparison(compare_parameter,
|
27
|
+
first_element,
|
28
|
+
second_element,
|
29
|
+
accuracy = 0.01)
|
23
30
|
if first_element.is_a?(Float) && second_element.is_a?(Float)
|
24
31
|
difference = (first_element - second_element).abs
|
25
32
|
difference >= accuracy ? "Difference between parameters in #{compare_parameter} is #{difference}" : ''
|
33
|
+
elsif first_element.to_s == second_element.to_s
|
34
|
+
''
|
26
35
|
else
|
27
|
-
first_element
|
28
|
-
second_element ||= 0
|
29
|
-
|
30
|
-
if first_element.to_s == second_element.to_s
|
31
|
-
''
|
32
|
-
else
|
33
|
-
"Difference in #{compare_parameter}. From case: #{first_element}. From result: #{second_element}"
|
34
|
-
end
|
36
|
+
"Difference in #{compare_parameter}. From case: #{first_element}. From result: #{second_element}"
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
40
|
+
# Convert string to boolean value
|
41
|
+
# @param string [String] to convert
|
42
|
+
# @return [True, False]
|
38
43
|
def to_bool(string)
|
39
44
|
str = string.to_s
|
40
45
|
if str.casecmp('false').zero?
|
@@ -1,152 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'csv'
|
2
4
|
require 'zip'
|
3
5
|
require 'open-uri'
|
4
6
|
require 'onlyoffice_logger_helper'
|
5
7
|
require 'find'
|
8
|
+
require 'onlyoffice_file_helper/create_methods'
|
9
|
+
require 'onlyoffice_file_helper/directory_methods'
|
10
|
+
require 'onlyoffice_file_helper/read_methods'
|
6
11
|
require 'onlyoffice_file_helper/version'
|
7
12
|
require 'onlyoffice_file_helper/linux_helper'
|
13
|
+
require 'onlyoffice_file_helper/ruby_helper'
|
8
14
|
require 'onlyoffice_file_helper/string_helper'
|
9
15
|
|
16
|
+
# Namespace of project
|
10
17
|
module OnlyofficeFileHelper
|
11
18
|
# Stuff for working with Files
|
12
19
|
class FileHelper
|
20
|
+
extend CreateMethods
|
21
|
+
extend DirectoryMethods
|
22
|
+
extend ReadMethods
|
23
|
+
|
13
24
|
class << self
|
14
25
|
# Return name of file from full path
|
15
|
-
# @param [
|
26
|
+
# @param [String] file_path to get name
|
27
|
+
# @param [Boolean] keep_extension keep extension in result?
|
16
28
|
# @return [Sting] name of file, with extension or not
|
17
|
-
def
|
29
|
+
def filename_from_path(file_path, keep_extension: true)
|
18
30
|
name = Pathname.new(file_path).basename
|
19
31
|
name = File.basename(name, File.extname(name)) unless keep_extension
|
20
32
|
name.to_s
|
21
33
|
end
|
22
34
|
|
23
|
-
|
24
|
-
|
35
|
+
# Return name of file from full path
|
36
|
+
# @param [String] file_path full file path
|
37
|
+
# @param [true, false] keep_extension keep extension in result?
|
38
|
+
# @return [Sting] name of file, with extension or not
|
39
|
+
def get_filename(file_path, keep_extension = true)
|
40
|
+
filename_from_path(file_path, keep_extension: keep_extension)
|
25
41
|
end
|
26
42
|
|
27
|
-
|
28
|
-
|
29
|
-
rescue Errno::EEXIST
|
30
|
-
true
|
31
|
-
end
|
43
|
+
extend Gem::Deprecate
|
44
|
+
deprecate :get_filename, :filename_from_path, 2025, 1
|
32
45
|
|
46
|
+
# Wait for downloading file
|
47
|
+
# @param path [String] path to waiting download
|
48
|
+
# @param timeout [Integer] timeout to wait
|
49
|
+
# @raise [StandardError] exception if file not downloaded during timeout
|
50
|
+
# @return [True] always successful, if not - raising Exception
|
33
51
|
def wait_file_to_download(path, timeout = 300)
|
34
52
|
timer = 0
|
35
53
|
OnlyofficeLoggerHelper.log("Start waiting to download file: #{path}")
|
36
|
-
until File.exist?(path) && !File.exist?(path
|
54
|
+
until File.exist?(path) && !File.exist?("#{path}.part")
|
37
55
|
OnlyofficeLoggerHelper.log("Waiting for #{timer} seconds from #{timeout}")
|
38
56
|
sleep 1
|
39
57
|
timer += 1
|
40
|
-
if timer > timeout
|
41
|
-
raise "Timeout #{timeout} for downloading file #{path} is exceed"
|
42
|
-
end
|
58
|
+
raise "Timeout #{timeout} for downloading file #{path} is exceed" if timer > timeout
|
43
59
|
end
|
44
60
|
sleep 1
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
def read_file_to_string(file_name)
|
49
|
-
result_string = ''
|
50
|
-
raise 'File not found: ' + file_name.to_s unless File.exist?(file_name)
|
51
|
-
File.open(file_name, 'r') do |infile|
|
52
|
-
while (line = infile.gets)
|
53
|
-
result_string += line
|
54
|
-
end
|
55
|
-
end
|
56
|
-
result_string
|
61
|
+
true
|
57
62
|
end
|
58
63
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
result_array << line.sub("\n", '')
|
65
|
-
end
|
66
|
-
end
|
67
|
-
result_array
|
68
|
-
end
|
64
|
+
# Extract archive to folder
|
65
|
+
# @param path_to_archive [String] path of file
|
66
|
+
# @return [Void]
|
67
|
+
def extract_to_folder(path_to_archive)
|
68
|
+
wait_file_to_download(path_to_archive)
|
69
69
|
|
70
|
-
|
71
|
-
path_to_extract = path_to_archive.chomp(File.basename(path_to_archive)))
|
72
|
-
raise 'File not found: ' + path_to_archive.to_s unless wait_file_to_download(path_to_archive)
|
73
|
-
path_to_extract += '/' unless path_to_extract[-1] == '/'
|
70
|
+
path_to_extract = path_to_archive.chomp(File.basename(path_to_archive))
|
74
71
|
path_to_file = path_to_extract + File.basename(path_to_archive)
|
75
|
-
# unless File.exist?(path_to_file)
|
76
|
-
# FileUtils.cp path_to_archive, path_to_extract
|
77
|
-
# end
|
78
72
|
Zip::File.open(path_to_file) do |zip_file|
|
79
73
|
zip_file.each do |file|
|
80
74
|
file_path = File.join(path_to_extract, file.name)
|
81
|
-
|
82
|
-
create_folder(a)
|
75
|
+
create_folder(File.dirname(file_path))
|
83
76
|
zip_file.extract(file, file_path)
|
84
77
|
end
|
85
78
|
end
|
86
79
|
end
|
87
80
|
|
81
|
+
# Save string to file
|
82
|
+
# @param string [String] string to save
|
83
|
+
# @param file_name [String] file to save
|
84
|
+
# @return [Void]
|
88
85
|
def output_string_to_file(string, file_name)
|
89
86
|
File.open(file_name, 'a+') do |f1|
|
90
87
|
f1.write(string)
|
91
88
|
end
|
92
89
|
end
|
93
90
|
|
94
|
-
def copy_file(file_path, destination)
|
95
|
-
FileUtils.mkdir_p(destination) unless File.directory?(destination)
|
96
|
-
FileUtils.copy(file_path, destination)
|
97
|
-
end
|
98
|
-
|
99
|
-
def directory_hash(path)
|
100
|
-
files = []
|
101
|
-
Dir.foreach(path).sort.each do |entry|
|
102
|
-
next if %w[.. .].include?(entry)
|
103
|
-
full_path = File.join(path, entry)
|
104
|
-
if File.directory?(full_path)
|
105
|
-
files += directory_hash(full_path)
|
106
|
-
else
|
107
|
-
files << File.join(path, entry)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
files.keep_if do |current|
|
111
|
-
current.end_with?('_spec.rb')
|
112
|
-
end
|
113
|
-
files
|
114
|
-
end
|
115
|
-
|
116
|
-
def list_file_in_directory(directory, extension = nil)
|
117
|
-
paths = []
|
118
|
-
Find.find(directory) do |path|
|
119
|
-
next if FileTest.directory?(path)
|
120
|
-
if extension.nil?
|
121
|
-
paths << path
|
122
|
-
elsif File.extname(path) == ".#{extension}"
|
123
|
-
paths << path
|
124
|
-
end
|
125
|
-
end
|
126
|
-
paths
|
127
|
-
rescue Errno::ENOENT
|
128
|
-
[]
|
129
|
-
end
|
130
|
-
|
131
|
-
# Create file with content
|
132
|
-
# @param file_path [String] path to created file
|
133
|
-
# @param [String] content content of file
|
134
|
-
# @return [String] path to created file
|
135
|
-
def create_file_with_content(file_path: '/tmp/temp_file.ext', content: '')
|
136
|
-
File.open(file_path, 'w') { |f| f.write(content) }
|
137
|
-
OnlyofficeLoggerHelper.log("Created file: #{file_path} with content: #{content}")
|
138
|
-
file_path
|
139
|
-
end
|
140
|
-
|
141
|
-
# Create empty file with size
|
142
|
-
# @param file_path [String] path to created file
|
143
|
-
# @param size [String] file size, may use binary indexes lik '256M', '15G'
|
144
|
-
# @return [String] path to created file
|
145
|
-
def create_file_with_size(file_path: '/tmp/temp_file.ext', size: '1G')
|
146
|
-
`fallocate -l #{size} #{file_path}`
|
147
|
-
file_path
|
148
|
-
end
|
149
|
-
|
150
91
|
# Get line count in file
|
151
92
|
# @param file_name [String] name of file
|
152
93
|
# @return [Fixnum] count of lines in file
|
@@ -155,17 +96,6 @@ module OnlyofficeFileHelper
|
|
155
96
|
OnlyofficeLoggerHelper.log("Count of lines in '#{file_name}' is #{line_count}")
|
156
97
|
line_count
|
157
98
|
end
|
158
|
-
|
159
|
-
# Get line count in file
|
160
|
-
# @param file_name [String] name of file
|
161
|
-
# @param line_number [Fixnum] line of file to get
|
162
|
-
# @return [String] line of file by number
|
163
|
-
def read_specific_line(file_name, line_number)
|
164
|
-
line = `sed '#{line_number + 1}!d' #{file_name}`
|
165
|
-
line.chop! if line[-1] == "\n"
|
166
|
-
OnlyofficeLoggerHelper.log("Lines in '#{file_name}' by number is '#{line}'")
|
167
|
-
line
|
168
|
-
end
|
169
99
|
end
|
170
100
|
end
|
171
101
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onlyoffice_file_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ONLYOFFICE
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-09-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: onlyoffice_logger_helper
|
@@ -31,14 +31,146 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '2'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '2'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: overcommit
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '13'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '13'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rspec
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '3'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rubocop
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '1'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '1'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rubocop-performance
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '1'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '1'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: rubocop-rake
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rubocop-rspec
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '2'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '2'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: simplecov
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: yard
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - "~>"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: 0.9.20
|
164
|
+
type: :development
|
165
|
+
prerelease: false
|
166
|
+
version_requirements: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - "~>"
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.9.20
|
42
174
|
description: ONLYOFFICE Helper Gem for File operation. Used in QA
|
43
175
|
email:
|
44
176
|
- shockwavenn@gmail.com
|
@@ -46,16 +178,25 @@ executables: []
|
|
46
178
|
extensions: []
|
47
179
|
extra_rdoc_files: []
|
48
180
|
files:
|
49
|
-
- README.md
|
50
181
|
- lib/onlyoffice_file_helper.rb
|
182
|
+
- lib/onlyoffice_file_helper/create_methods.rb
|
183
|
+
- lib/onlyoffice_file_helper/directory_methods.rb
|
51
184
|
- lib/onlyoffice_file_helper/linux_helper.rb
|
52
185
|
- lib/onlyoffice_file_helper/linux_helper/xdotool_helper.rb
|
186
|
+
- lib/onlyoffice_file_helper/name.rb
|
187
|
+
- lib/onlyoffice_file_helper/read_methods.rb
|
188
|
+
- lib/onlyoffice_file_helper/ruby_helper.rb
|
53
189
|
- lib/onlyoffice_file_helper/string_helper.rb
|
54
190
|
- lib/onlyoffice_file_helper/version.rb
|
55
|
-
homepage: https://github.com/
|
191
|
+
homepage: https://github.com/ONLYOFFICE-QA/onlyoffice_file_helper
|
56
192
|
licenses:
|
57
193
|
- AGPL-3.0
|
58
|
-
metadata:
|
194
|
+
metadata:
|
195
|
+
bug_tracker_uri: https://github.com/ONLYOFFICE-QA/onlyoffice_file_helper/issues
|
196
|
+
changelog_uri: https://github.com/ONLYOFFICE-QA/onlyoffice_file_helper/blob/master/CHANGELOG.md
|
197
|
+
documentation_uri: https://www.rubydoc.info/gems/onlyoffice_file_helper
|
198
|
+
homepage_uri: https://github.com/ONLYOFFICE-QA/onlyoffice_file_helper
|
199
|
+
source_code_uri: https://github.com/ONLYOFFICE-QA/onlyoffice_file_helper
|
59
200
|
post_install_message:
|
60
201
|
rdoc_options: []
|
61
202
|
require_paths:
|
@@ -64,15 +205,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
205
|
requirements:
|
65
206
|
- - ">="
|
66
207
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
208
|
+
version: '2.5'
|
68
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
210
|
requirements:
|
70
211
|
- - ">="
|
71
212
|
- !ruby/object:Gem::Version
|
72
213
|
version: '0'
|
73
214
|
requirements: []
|
74
|
-
|
75
|
-
rubygems_version: 2.6.13
|
215
|
+
rubygems_version: 3.2.27
|
76
216
|
signing_key:
|
77
217
|
specification_version: 4
|
78
218
|
summary: ONLYOFFICE Helper Gem for File operation
|
data/README.md
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# OnlyofficeFileHelper
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/onlyoffice_file_helper`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'onlyoffice_file_helper'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install onlyoffice_file_helper
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/onlyoffice_file_helper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
-
|
37
|
-
## Code of Conduct
|
38
|
-
|
39
|
-
Everyone interacting in the OnlyofficeFileHelper project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/onlyoffice_file_helper/blob/master/CODE_OF_CONDUCT.md).
|