ehbrs_ruby_utils 0.7.0 → 0.8.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61330d9b4828f3813d1430120407527b77f13c1525446441bac3e818b93134a0
|
4
|
+
data.tar.gz: ce61e87673cf8e01fa96df9aea63b45829004b9305d0e141f9a764252665edb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83fee97906fc1ed7dd110f4c59e4dea81a11efd1697b275691b31b0d34b8326c534f29b069b1647a5eda03d1ef5eebf8fe51ab130dbe97c3a8a83f2e73f7927f
|
7
|
+
data.tar.gz: fd6dc95bb3e4ed3b6c536d1f46b3b2e7d605d72e706890140a5cf7034599677d038bb08818889b7020df7899787949c2e3f0a88029b4d4677697775de3d924ab
|
@@ -1,11 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'ostruct'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
4
5
|
|
5
6
|
module EhbrsRubyUtils
|
6
7
|
module WebUtils
|
7
8
|
module Videos
|
8
9
|
class File < ::SimpleDelegator
|
10
|
+
require_sub __FILE__
|
11
|
+
|
9
12
|
def initialize(data)
|
10
13
|
super(::OpenStruct.new(data))
|
11
14
|
end
|
@@ -14,12 +17,15 @@ module EhbrsRubyUtils
|
|
14
17
|
::File.exist?(original_path)
|
15
18
|
end
|
16
19
|
|
17
|
-
def
|
18
|
-
|
20
|
+
def move(target_dir)
|
21
|
+
::EhbrsRubyUtils::WebUtils::Videos::File::Rename.new(
|
22
|
+
self,
|
23
|
+
target_dir.to_pathname.join(original_path.to_pathname.relative_path_from(root_path))
|
24
|
+
).perform
|
19
25
|
end
|
20
26
|
|
21
|
-
def
|
22
|
-
|
27
|
+
def path_changed?
|
28
|
+
original_path != new_path
|
23
29
|
end
|
24
30
|
|
25
31
|
def remove
|
@@ -29,10 +35,7 @@ module EhbrsRubyUtils
|
|
29
35
|
end
|
30
36
|
|
31
37
|
def rename
|
32
|
-
|
33
|
-
|
34
|
-
::FileUtils.mkdir_p(::File.dirname(new_path))
|
35
|
-
::FileUtils.mv(original_path, new_path)
|
38
|
+
::EhbrsRubyUtils::WebUtils::Videos::File::Rename.new(self, new_path).perform
|
36
39
|
end
|
37
40
|
end
|
38
41
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module WebUtils
|
7
|
+
module Videos
|
8
|
+
class File < ::SimpleDelegator
|
9
|
+
class Rename
|
10
|
+
common_constructor :file, :target_path
|
11
|
+
|
12
|
+
delegate :original_path, to: :file
|
13
|
+
|
14
|
+
def can_rename?
|
15
|
+
::File.exist?(original_path) && !::File.exist?(target_path)
|
16
|
+
end
|
17
|
+
|
18
|
+
def perform
|
19
|
+
return unless can_rename?
|
20
|
+
|
21
|
+
::FileUtils.mkdir_p(::File.dirname(target_path))
|
22
|
+
::FileUtils.mv(original_path, target_path)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ehbrs_ruby_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo H. Bogoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_ruby_utils
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/ehbrs_ruby_utils/web_utils/instance.rb
|
94
94
|
- lib/ehbrs_ruby_utils/web_utils/videos.rb
|
95
95
|
- lib/ehbrs_ruby_utils/web_utils/videos/file.rb
|
96
|
+
- lib/ehbrs_ruby_utils/web_utils/videos/file/rename.rb
|
96
97
|
- lib/ehbrs_ruby_utils/web_utils/videos/files_list.rb
|
97
98
|
homepage:
|
98
99
|
licenses: []
|