dotsync 0.3.2 → 0.3.3
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 +11 -0
- data/Gemfile.lock +1 -1
- data/exe/dotsync +5 -0
- data/lib/dotsync/actions/base_action.rb +1 -0
- data/lib/dotsync/actions/concerns/mappings_transfer.rb +32 -4
- data/lib/dotsync/actions/pull_action.rb +2 -2
- data/lib/dotsync/actions/push_action.rb +2 -2
- data/lib/dotsync/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 918c52bf2da4cb3e03aa03725cc037bf6d3a5c6ede78c6c4f30b8bc6b74d8a55
|
|
4
|
+
data.tar.gz: 53ee0db3a70dd65effc25cc83717fe4c3c98e193f9a389efdd82a2922d4eccba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ff87f445e42c1216a5d4e4b362d5023dabe0f9264dc926ec8be41a0890693d497b5152fdc9c9b2835989227e0a97ee94d25b27f4ddd9e8d361a7c64fbe7ec35
|
|
7
|
+
data.tar.gz: d965b970d2324afa4eb95662ef18cbce918439ee9d783b3c48d159f271c5e6a6cfbf3e262c067ba72dbbdd5c4f7eb0839885160a1106e2da5b9b947085840ca9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [0.3.3] - 2026-02-16
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- Add --force-hooks flag to re-run hooks when no files changed (#25) (#26)
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Update version
|
|
10
|
+
|
|
1
11
|
## [0.3.2] - 2026-02-14
|
|
2
12
|
|
|
3
13
|
### Fixed
|
|
@@ -451,5 +461,6 @@ Add gem executables
|
|
|
451
461
|
|
|
452
462
|
Initial version
|
|
453
463
|
|
|
464
|
+
[0.3.3]: https://github.com/dsaenztagarro/dotsync/compare/v0.3.2...v0.3.3
|
|
454
465
|
[0.3.2]: https://github.com/dsaenztagarro/dotsync/compare/v0.3.1...v0.3.2
|
|
455
466
|
[0.3.1]: https://github.com/dsaenztagarro/dotsync/compare/v0.3.0...v0.3.1
|
data/Gemfile.lock
CHANGED
data/exe/dotsync
CHANGED
|
@@ -52,6 +52,7 @@ opt_parser = OptionParser.new do |opts|
|
|
|
52
52
|
--only-mappings Show only the mappings section
|
|
53
53
|
-v, --verbose Force showing all available information
|
|
54
54
|
--diff-content Show git-like content diff for modified files
|
|
55
|
+
--force-hooks Run hooks even when no files changed
|
|
55
56
|
--trace Show full error backtraces (for debugging)
|
|
56
57
|
--version Show version number
|
|
57
58
|
-h, --help Show this help message
|
|
@@ -117,6 +118,10 @@ opt_parser = OptionParser.new do |opts|
|
|
|
117
118
|
options[:diff_content] = true
|
|
118
119
|
end
|
|
119
120
|
|
|
121
|
+
opts.on("--force-hooks", "Run hooks even when no files changed") do
|
|
122
|
+
options[:force_hooks] = true
|
|
123
|
+
end
|
|
124
|
+
|
|
120
125
|
opts.on("--trace", "Show full error backtraces (for debugging)") do
|
|
121
126
|
options[:trace] = true
|
|
122
127
|
end
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "find"
|
|
4
|
+
|
|
3
5
|
module Dotsync
|
|
4
6
|
# MappingsTransfer provides shared functionality for push/pull actions.
|
|
5
7
|
#
|
|
@@ -136,20 +138,25 @@ module Dotsync
|
|
|
136
138
|
end
|
|
137
139
|
end
|
|
138
140
|
|
|
139
|
-
def execute_hooks
|
|
141
|
+
def execute_hooks(force: false)
|
|
140
142
|
valid_mappings.each_with_index do |mapping, idx|
|
|
141
143
|
next unless mapping.has_hooks?
|
|
142
144
|
|
|
143
145
|
differ = differs[idx]
|
|
144
146
|
changed_files = differ.additions + differ.modifications
|
|
145
|
-
|
|
147
|
+
if changed_files.empty?
|
|
148
|
+
next unless force
|
|
149
|
+
|
|
150
|
+
changed_files = all_dest_files(mapping)
|
|
151
|
+
next if changed_files.empty?
|
|
152
|
+
end
|
|
146
153
|
|
|
147
154
|
runner = Dotsync::HookRunner.new(mapping: mapping, changed_files: changed_files, logger: logger)
|
|
148
155
|
runner.execute
|
|
149
156
|
end
|
|
150
157
|
end
|
|
151
158
|
|
|
152
|
-
def show_hooks_preview
|
|
159
|
+
def show_hooks_preview(force: false)
|
|
153
160
|
hooks_to_run = []
|
|
154
161
|
|
|
155
162
|
valid_mappings.each_with_index do |mapping, idx|
|
|
@@ -157,7 +164,12 @@ module Dotsync
|
|
|
157
164
|
|
|
158
165
|
differ = differs[idx]
|
|
159
166
|
changed_files = differ.additions + differ.modifications
|
|
160
|
-
|
|
167
|
+
if changed_files.empty?
|
|
168
|
+
next unless force
|
|
169
|
+
|
|
170
|
+
changed_files = all_dest_files(mapping)
|
|
171
|
+
next if changed_files.empty?
|
|
172
|
+
end
|
|
161
173
|
|
|
162
174
|
runner = Dotsync::HookRunner.new(mapping: mapping, changed_files: changed_files, logger: logger)
|
|
163
175
|
hooks_to_run.concat(runner.preview)
|
|
@@ -217,5 +229,21 @@ module Dotsync
|
|
|
217
229
|
def valid_mappings
|
|
218
230
|
mappings.select(&:valid?)
|
|
219
231
|
end
|
|
232
|
+
|
|
233
|
+
def all_dest_files(mapping)
|
|
234
|
+
if File.directory?(mapping.dest)
|
|
235
|
+
files = []
|
|
236
|
+
Find.find(mapping.dest) do |path|
|
|
237
|
+
next if File.directory?(path)
|
|
238
|
+
|
|
239
|
+
files << path
|
|
240
|
+
end
|
|
241
|
+
files
|
|
242
|
+
elsif File.file?(mapping.dest)
|
|
243
|
+
[mapping.dest]
|
|
244
|
+
else
|
|
245
|
+
[]
|
|
246
|
+
end
|
|
247
|
+
end
|
|
220
248
|
end
|
|
221
249
|
end
|
|
@@ -16,7 +16,7 @@ module Dotsync
|
|
|
16
16
|
show_mappings if output_sections[:mappings]
|
|
17
17
|
show_differences_legend if has_differences? && output_sections[:differences_legend]
|
|
18
18
|
show_differences(diff_content: output_sections[:diff_content]) if output_sections[:differences]
|
|
19
|
-
show_hooks_preview if output_sections[:differences]
|
|
19
|
+
show_hooks_preview(force: options[:force_hooks]) if output_sections[:differences]
|
|
20
20
|
|
|
21
21
|
return unless options[:apply]
|
|
22
22
|
|
|
@@ -33,7 +33,7 @@ module Dotsync
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
transfer_mappings
|
|
36
|
-
execute_hooks
|
|
36
|
+
execute_hooks(force: options[:force_hooks])
|
|
37
37
|
action("Mappings pulled", icon: :done)
|
|
38
38
|
end
|
|
39
39
|
|
|
@@ -14,7 +14,7 @@ module Dotsync
|
|
|
14
14
|
show_mappings if output_sections[:mappings]
|
|
15
15
|
show_differences_legend if has_differences? && output_sections[:differences_legend]
|
|
16
16
|
show_differences(diff_content: output_sections[:diff_content]) if output_sections[:differences]
|
|
17
|
-
show_hooks_preview if output_sections[:differences]
|
|
17
|
+
show_hooks_preview(force: options[:force_hooks]) if output_sections[:differences]
|
|
18
18
|
|
|
19
19
|
return unless options[:apply]
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@ module Dotsync
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
transfer_mappings
|
|
27
|
-
execute_hooks
|
|
27
|
+
execute_hooks(force: options[:force_hooks])
|
|
28
28
|
action("Mappings pushed", icon: :done)
|
|
29
29
|
end
|
|
30
30
|
end
|
data/lib/dotsync/version.rb
CHANGED