onlyoffice_file_helper 0.4.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 +4 -4
- data/lib/onlyoffice_file_helper/version.rb +1 -1
- data/lib/onlyoffice_file_helper.rb +20 -9
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
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
|
@@ -23,18 +23,31 @@ module OnlyofficeFileHelper
|
|
23
23
|
|
24
24
|
class << self
|
25
25
|
# Return name of file from full path
|
26
|
-
# @param [
|
26
|
+
# @param [String] file_path to get name
|
27
|
+
# @param [Boolean] keep_extension keep extension in result?
|
27
28
|
# @return [Sting] name of file, with extension or not
|
28
|
-
def
|
29
|
+
def filename_from_path(file_path, keep_extension: true)
|
29
30
|
name = Pathname.new(file_path).basename
|
30
31
|
name = File.basename(name, File.extname(name)) unless keep_extension
|
31
32
|
name.to_s
|
32
33
|
end
|
33
34
|
|
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)
|
41
|
+
end
|
42
|
+
|
43
|
+
extend Gem::Deprecate
|
44
|
+
deprecate :get_filename, :filename_from_path, 2025, 1
|
45
|
+
|
34
46
|
# Wait for downloading file
|
35
47
|
# @param path [String] path to waiting download
|
36
48
|
# @param timeout [Integer] timeout to wait
|
37
|
-
# @
|
49
|
+
# @raise [StandardError] exception if file not downloaded during timeout
|
50
|
+
# @return [True] always successful, if not - raising Exception
|
38
51
|
def wait_file_to_download(path, timeout = 300)
|
39
52
|
timer = 0
|
40
53
|
OnlyofficeLoggerHelper.log("Start waiting to download file: #{path}")
|
@@ -45,18 +58,16 @@ module OnlyofficeFileHelper
|
|
45
58
|
raise "Timeout #{timeout} for downloading file #{path} is exceed" if timer > timeout
|
46
59
|
end
|
47
60
|
sleep 1
|
48
|
-
|
61
|
+
true
|
49
62
|
end
|
50
63
|
|
51
64
|
# Extract archive to folder
|
52
65
|
# @param path_to_archive [String] path of file
|
53
|
-
# @param path_to_extract [String] result path
|
54
66
|
# @return [Void]
|
55
|
-
def extract_to_folder(path_to_archive
|
56
|
-
|
57
|
-
raise "File not found: #{path_to_archive}" unless wait_file_to_download(path_to_archive)
|
67
|
+
def extract_to_folder(path_to_archive)
|
68
|
+
wait_file_to_download(path_to_archive)
|
58
69
|
|
59
|
-
path_to_extract
|
70
|
+
path_to_extract = path_to_archive.chomp(File.basename(path_to_archive))
|
60
71
|
path_to_file = path_to_extract + File.basename(path_to_archive)
|
61
72
|
Zip::File.open(path_to_file) do |zip_file|
|
62
73
|
zip_file.each do |file|
|
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
|
@@ -39,20 +39,6 @@ dependencies:
|
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '2'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: codecov
|
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
42
|
- !ruby/object:Gem::Dependency
|
57
43
|
name: overcommit
|
58
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,6 +137,20 @@ dependencies:
|
|
151
137
|
- - "~>"
|
152
138
|
- !ruby/object:Gem::Version
|
153
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
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: yard
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
212
|
- !ruby/object:Gem::Version
|
213
213
|
version: '0'
|
214
214
|
requirements: []
|
215
|
-
rubygems_version: 3.
|
215
|
+
rubygems_version: 3.2.27
|
216
216
|
signing_key:
|
217
217
|
specification_version: 4
|
218
218
|
summary: ONLYOFFICE Helper Gem for File operation
|