onlyoffice_file_helper 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebad99290f1b01ca78c2c2ff8d1d387d39aa6680d9c1f79e34e5c8a5fd88c92a
4
- data.tar.gz: 9a6030f9416d7d8e195c5de56102550b297fdcb7d971ad5053fc2a8029b2b4de
3
+ metadata.gz: 1912f88662a16d0b908b258a3f95843eb24f20e3c83585905d39a79bcda9d043
4
+ data.tar.gz: 9bea4bca48018dcfd22bfdab65f14b5eb5ee54158bd0b6bd63dfa601e6f3687a
5
5
  SHA512:
6
- metadata.gz: a76a442f4083aa6e26ae4513249bb100954a03923474116b145dec81b07268c2310875b16935f2e166967426fa25919186e6856cbf2d7f9ae5298c28ee6aec68
7
- data.tar.gz: 5810ca797300bbf5ec5aa99092cc0f53b8046db7e0000e176fb989834275c7b302d68a75afd5710687b52ecd938c02ec46c3832a04c200f4fd3715b9f7e26659
6
+ metadata.gz: e81341cdd686eac779125def4dfdd94c889d8e6e91268977b41a25039f29a33bdf9974a48536d040cb30db387f21297f8aa04dcb00b5ce2ee1da4b26ee61de3b
7
+ data.tar.gz: 50a806204f8edd4fc0d17eaac89b52fcec3d9f2ab1c0e7392d18c8ee4336d26695e0b6bdbb7b6832bb46664fec9dcb419f36bc1cdc435d1848925bb3bcbb418a
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OnlyofficeFileHelper
4
+ # Methods used to work with files
5
+ module FileMethods
6
+ # Copies a file
7
+ # @param [String] file_path path to file to be copied
8
+ # @param [String] destination path to where to copy file
9
+ def copy_file(file_path, destination)
10
+ FileUtils.mkdir_p(destination) unless File.directory?(destination)
11
+ FileUtils.copy(file_path, destination)
12
+ end
13
+
14
+ # Moves a file
15
+ # @param [String] file_path path to file to be moved
16
+ # @param [String] destination path to where to move file
17
+ def move_file(file_path, destination)
18
+ FileUtils.mkdir_p(destination) unless File.directory?(destination)
19
+ FileUtils.move(file_path, destination)
20
+ end
21
+
22
+ # Get file size in bytes
23
+ # @param [String] file_path path to file
24
+ # @return [Integer] size of file in bytes
25
+ def file_size(file_path)
26
+ size = File.size?(file_path)
27
+ size = 0 if size.nil?
28
+ size
29
+ end
30
+ end
31
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module OnlyofficeFileHelper
4
4
  # @return [String] version of gem
5
- VERSION = '1.0.0'
5
+ VERSION = '1.1.0'
6
6
  end
@@ -7,6 +7,7 @@ require 'onlyoffice_logger_helper'
7
7
  require 'find'
8
8
  require 'onlyoffice_file_helper/create_methods'
9
9
  require 'onlyoffice_file_helper/directory_methods'
10
+ require 'onlyoffice_file_helper/file_methods'
10
11
  require 'onlyoffice_file_helper/read_methods'
11
12
  require 'onlyoffice_file_helper/version'
12
13
  require 'onlyoffice_file_helper/linux_helper'
@@ -20,6 +21,7 @@ module OnlyofficeFileHelper
20
21
  extend CreateMethods
21
22
  extend DirectoryMethods
22
23
  extend ReadMethods
24
+ extend FileMethods
23
25
 
24
26
  class << self
25
27
  # Return name of file from full path
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: 1.0.0
4
+ version: 1.1.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: 2022-08-05 00:00:00.000000000 Z
12
+ date: 2022-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: onlyoffice_logger_helper
@@ -181,6 +181,7 @@ files:
181
181
  - lib/onlyoffice_file_helper.rb
182
182
  - lib/onlyoffice_file_helper/create_methods.rb
183
183
  - lib/onlyoffice_file_helper/directory_methods.rb
184
+ - lib/onlyoffice_file_helper/file_methods.rb
184
185
  - lib/onlyoffice_file_helper/linux_helper.rb
185
186
  - lib/onlyoffice_file_helper/linux_helper/xdotool_helper.rb
186
187
  - lib/onlyoffice_file_helper/name.rb
@@ -213,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
214
  - !ruby/object:Gem::Version
214
215
  version: '0'
215
216
  requirements: []
216
- rubygems_version: 3.3.19
217
+ rubygems_version: 3.3.20
217
218
  signing_key:
218
219
  specification_version: 4
219
220
  summary: ONLYOFFICE Helper Gem for File operation