dotsync 0.1.7 → 0.1.8
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 +5 -0
- data/Gemfile.lock +1 -1
- data/lib/dotsync/actions/concerns/mappings_transfer.rb +12 -9
- data/lib/dotsync/icons.rb +2 -0
- data/lib/dotsync/utils/directory_differ.rb +10 -0
- data/lib/dotsync/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: 3d19236d9990f40338b046f38198ddee169c172ec1d57f8914661af46c758c4d
|
|
4
|
+
data.tar.gz: 1999643c1f8ce059eb4e51fc6699005630d6c7a575fbd58a60f018a88b80174e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '03262956f985e6aa2b2e82de93546f75aa6ea45964f976561a2d53464b6c3a27a28a0a3b06135a3305b0f932b8316b2ec58b414234fc016fd3412542ef8e3182'
|
|
7
|
+
data.tar.gz: 46e24ab637d1ea4c7217ce4e5c318b268b5aebeac36f166c4944bbc3434d4dcfdf2021af54e57e6840d1d889f94f997c6b5208e67d8cee444618384c3dcea65a
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -7,7 +7,7 @@ module Dotsync
|
|
|
7
7
|
def_delegator :@config, :mappings
|
|
8
8
|
|
|
9
9
|
def show_mappings
|
|
10
|
-
info("Mappings:", icon: :config
|
|
10
|
+
info("Mappings:", icon: :config)
|
|
11
11
|
|
|
12
12
|
mappings.each do |mapping|
|
|
13
13
|
logger.log(" #{mapping}")
|
|
@@ -18,14 +18,17 @@ module Dotsync
|
|
|
18
18
|
diffs = valid_mappings.map do |mapping|
|
|
19
19
|
Dotsync::DirectoryDiffer.new(mapping).diff
|
|
20
20
|
end
|
|
21
|
-
diffs.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
if diffs.any?
|
|
22
|
+
info("Diff:", icon: :diff)
|
|
23
|
+
diffs.flat_map(&:additions).sort.each do |path|
|
|
24
|
+
logger.log(" #{path}", color: Dotsync::Colors.diff_additions)
|
|
25
|
+
end
|
|
26
|
+
diffs.flat_map(&:modifications).sort.each do |path|
|
|
27
|
+
logger.log(" #{path}", color: Dotsync::Colors.diff_modifications)
|
|
28
|
+
end
|
|
29
|
+
diffs.flat_map(&:removals).sort.each do |path|
|
|
30
|
+
logger.log(" #{path}", color: Dotsync::Colors.diff_removals)
|
|
31
|
+
end
|
|
29
32
|
end
|
|
30
33
|
end
|
|
31
34
|
|
data/lib/dotsync/icons.rb
CHANGED
|
@@ -8,6 +8,7 @@ module Dotsync
|
|
|
8
8
|
|
|
9
9
|
# Configuration icon
|
|
10
10
|
CONFIG = " "
|
|
11
|
+
DIFF = " "
|
|
11
12
|
|
|
12
13
|
# Default Mapping icons
|
|
13
14
|
DEFAULT_FORCE = " "
|
|
@@ -57,6 +58,7 @@ module Dotsync
|
|
|
57
58
|
info: INFO,
|
|
58
59
|
error: ERROR,
|
|
59
60
|
config: CONFIG,
|
|
61
|
+
diff: DIFF,
|
|
60
62
|
force: -> { force },
|
|
61
63
|
ignore: -> { ignore },
|
|
62
64
|
pull: PULL,
|
|
@@ -5,8 +5,13 @@ module Dotsync
|
|
|
5
5
|
# differ = DirectoryDiffer.new("/path/to/src", "/path/to/dest")
|
|
6
6
|
# differences = differ.diff
|
|
7
7
|
class DirectoryDiffer
|
|
8
|
+
extend Forwardable
|
|
9
|
+
|
|
8
10
|
attr_reader :src, :dest
|
|
9
11
|
|
|
12
|
+
def_delegator @mapping, :original_src
|
|
13
|
+
def_delegator @mapping, :original_dest
|
|
14
|
+
|
|
10
15
|
# Initializes a new DirectoryDiffer.
|
|
11
16
|
#
|
|
12
17
|
# @param mapping [Dotsync::Mapping] the mapping object containing source, destination, force, and ignore details
|
|
@@ -15,6 +20,7 @@ module Dotsync
|
|
|
15
20
|
# @option mapping [Boolean] :force? optional flag to force actions
|
|
16
21
|
# @option mapping [Array<String>] :ignores optional list of files/directories to ignore
|
|
17
22
|
def initialize(mapping)
|
|
23
|
+
@mapping = mapping
|
|
18
24
|
@src = mapping.src
|
|
19
25
|
@dest = mapping.dest
|
|
20
26
|
@force = mapping.force?
|
|
@@ -60,6 +66,10 @@ module Dotsync
|
|
|
60
66
|
removals = filter_paths(removals, @ignores)
|
|
61
67
|
end
|
|
62
68
|
|
|
69
|
+
additions.map! { |rel_path| File.join(@mapping.original_dest, rel_path) }
|
|
70
|
+
modifications.map! { |rel_path| File.join(@mapping.original_dest, rel_path) }
|
|
71
|
+
removals.map! { |rel_path| File.join(@mapping.original_dest, rel_path) }
|
|
72
|
+
|
|
63
73
|
Dotsync::Diff.new(additions: additions, modifications: modifications, removals: removals)
|
|
64
74
|
end
|
|
65
75
|
|
data/lib/dotsync/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dotsync
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Sáenz
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-10-
|
|
11
|
+
date: 2025-10-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: toml-rb
|