ace-support-items 0.15.14 → 0.15.15
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/CHANGELOG.md +8 -0
- data/lib/ace/support/items/molecules/folder_mover.rb +26 -14
- data/lib/ace/support/items/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee3fcee97215b4d7243d870366200e78369a85fc74fbe6c7ea8107efa23f8053
|
|
4
|
+
data.tar.gz: 8c9914130df26e74948b15d84b3311beb326855ff657ab6ce41d8b13bb039ccd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 90551754056d747f9f8a341f8f50601095b4c29e43725550652929b95479edac2e2b92e7e922c2ab552efb09decbf0340cd24765f255c47c1babb7ef0d4c7d9e
|
|
7
|
+
data.tar.gz: d315633aeb2cce808bdeb0a4eb1bf626a50079fba04d74f35849ca06dd649b639d65d71cc69930ab5611aaf7ee9b5248b0457319dcaa3dcfc1d173b1e6fc3368
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.15.15] - 2026-10-18
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `FolderMover#destination_path` computes the destination a move would create
|
|
15
|
+
without touching the filesystem, so callers can run pre-flight checks (for
|
|
16
|
+
example a Git-ignored destination guard).
|
|
17
|
+
|
|
10
18
|
## [0.15.14] - 2026-10-06
|
|
11
19
|
|
|
12
20
|
### Fixed
|
|
@@ -17,35 +17,38 @@ module Ace
|
|
|
17
17
|
@root_dir = root_dir
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
#
|
|
20
|
+
# Compute the destination path for an item without moving it.
|
|
21
|
+
# Used by pre-flight checks (e.g. Git-ignored task guards).
|
|
21
22
|
#
|
|
22
23
|
# @param item [#path] Item with a path attribute (directory to move)
|
|
23
24
|
# @param to [String] Target folder name (short or full, e.g., "maybe", "_archive")
|
|
24
25
|
# @param date [Time, nil] Date used to compute archive partition (default: Time.now)
|
|
25
|
-
# @return [String]
|
|
26
|
-
def
|
|
26
|
+
# @return [String] Destination directory path
|
|
27
|
+
def destination_path(item, to:, date: nil)
|
|
27
28
|
if Atoms::SpecialFolderDetector.virtual_filter?(to)
|
|
28
29
|
raise ArgumentError, "Cannot move to virtual filter '#{to}' — it is not a physical folder"
|
|
29
30
|
end
|
|
30
31
|
|
|
31
32
|
normalized = Atoms::SpecialFolderDetector.normalize(to)
|
|
32
|
-
|
|
33
|
-
target_parent = if normalized == "_archive"
|
|
34
|
-
partition = Atoms::DatePartitionPath.compute(date || Time.now)
|
|
35
|
-
File.expand_path(File.join(@root_dir, normalized, partition))
|
|
36
|
-
else
|
|
37
|
-
File.expand_path(File.join(@root_dir, normalized))
|
|
38
|
-
end
|
|
39
|
-
|
|
33
|
+
target_parent = destination_parent(normalized, date)
|
|
40
34
|
validate_path_traversal!(target_parent)
|
|
41
|
-
FileUtils.mkdir_p(target_parent)
|
|
42
35
|
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
File.join(target_parent, File.basename(item.path))
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Move an item folder to a target location.
|
|
40
|
+
#
|
|
41
|
+
# @param item [#path] Item with a path attribute (directory to move)
|
|
42
|
+
# @param to [String] Target folder name (short or full, e.g., "maybe", "_archive")
|
|
43
|
+
# @param date [Time, nil] Date used to compute archive partition (default: Time.now)
|
|
44
|
+
# @return [String] New path of the item directory
|
|
45
|
+
def move(item, to:, date: nil)
|
|
46
|
+
new_path = destination_path(item, to: to, date: date)
|
|
45
47
|
|
|
46
48
|
# Same-location no-op check
|
|
47
49
|
return item.path if File.expand_path(item.path) == File.expand_path(new_path)
|
|
48
50
|
|
|
51
|
+
FileUtils.mkdir_p(File.dirname(new_path))
|
|
49
52
|
atomic_move(item.path, new_path)
|
|
50
53
|
end
|
|
51
54
|
|
|
@@ -65,6 +68,15 @@ module Ace
|
|
|
65
68
|
|
|
66
69
|
private
|
|
67
70
|
|
|
71
|
+
def destination_parent(normalized, date)
|
|
72
|
+
if normalized == "_archive"
|
|
73
|
+
partition = Atoms::DatePartitionPath.compute(date || Time.now)
|
|
74
|
+
File.expand_path(File.join(@root_dir, normalized, partition))
|
|
75
|
+
else
|
|
76
|
+
File.expand_path(File.join(@root_dir, normalized))
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
68
80
|
def validate_path_traversal!(target_parent)
|
|
69
81
|
root_real = File.expand_path(@root_dir)
|
|
70
82
|
unless target_parent.start_with?(root_real + File::SEPARATOR)
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ace-support-items
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.15.
|
|
4
|
+
version: 0.15.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michal Czyz
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-10-
|
|
10
|
+
date: 2026-10-20 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: ace-support-core
|