dotsync 0.1.6 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b671284dfcdd29739df951c9656b8a0a9867619b57175ac62c5eb6f45137ed0
4
- data.tar.gz: 26ee6f58257a4a556ea2a7f1eedc06660743fd47e1e073f1977b0a591a2db7f3
3
+ metadata.gz: 3d19236d9990f40338b046f38198ddee169c172ec1d57f8914661af46c758c4d
4
+ data.tar.gz: 1999643c1f8ce059eb4e51fc6699005630d6c7a575fbd58a60f018a88b80174e
5
5
  SHA512:
6
- metadata.gz: a0206e946ca9040ed97d5385c33fea54b0080e824fbe5c3844adac5bc37cdf452e75efd6ebc40ac1f40d66d1bfa52e9f60ec962ab5a247dda0a8acdea15c2235
7
- data.tar.gz: 2902acbf3de208132ced6cde1b22f4f3a5a72eacacd6c9c048d3edbf8f20ebf636bf5e7549aec207aba07c642d0a54cf55a6684191a6cb259c66fd31878e32bc
6
+ metadata.gz: '03262956f985e6aa2b2e82de93546f75aa6ea45964f976561a2d53464b6c3a27a28a0a3b06135a3305b0f932b8316b2ec58b414234fc016fd3412542ef8e3182'
7
+ data.tar.gz: 46e24ab637d1ea4c7217ce4e5c318b268b5aebeac36f166c4944bbc3434d4dcfdf2021af54e57e6840d1d889f94f997c6b5208e67d8cee444618384c3dcea65a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 0.1.8
2
+
3
+ - Show full relative path on diff
4
+ - Show Diff section header
5
+
6
+ # 0.1.7
7
+
8
+ - Fixes broken runner
9
+
1
10
  # 0.1.6
2
11
 
3
12
  - Show diff changes on PushAction and PullAction.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dotsync (0.1.6)
4
+ dotsync (0.1.8)
5
5
  fileutils (~> 1.7.3)
6
6
  find (~> 0.2.0)
7
7
  listen (~> 3.9.0)
@@ -37,7 +37,7 @@ GEM
37
37
  logger (1.7.0)
38
38
  ostruct (0.6.3)
39
39
  parallel (1.27.0)
40
- parser (3.3.9.0)
40
+ parser (3.3.10.0)
41
41
  ast (~> 2.4.1)
42
42
  racc
43
43
  prism (1.6.0)
@@ -90,7 +90,7 @@ GEM
90
90
  rubocop-rspec (3.7.0)
91
91
  lint_roller (~> 1.1)
92
92
  rubocop (~> 1.72, >= 1.72.1)
93
- ruby-lsp (0.26.1)
93
+ ruby-lsp (0.26.2)
94
94
  language_server-protocol (~> 3.17.0)
95
95
  prism (>= 1.2, < 2.0)
96
96
  rbs (>= 3, < 5)
@@ -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.flat_map(&:additions).sort.each do |path|
22
- logger.log(" #{path}", color: Dotsync::Colors.diff_additions)
23
- end
24
- diffs.flat_map(&:modifications).sort.each do |path|
25
- logger.log(" #{path}", color: Dotsync::Colors.diff_modifications)
26
- end
27
- diffs.flat_map(&:removals).sort.each do |path|
28
- logger.log(" #{path}", color: Dotsync::Colors.diff_removals)
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
 
@@ -10,9 +10,9 @@ module Dotsync
10
10
 
11
11
  def self.load_custom_colors(config)
12
12
  @custom_colors = {
13
- diff_additions: config.dig("colors", "diff_additions") || DEFAULT_FORCE,
14
- diff_modifications: config.dig("colors", "diff_modifications") || DEFAULT_IGNORE,
15
- diff_removals: config.dig("colors", "diff_removals") || DEFAULT_INVALID
13
+ diff_additions: config.dig("colors", "diff_additions") || DEFAULT_DIFF_ADDITIONS,
14
+ diff_modifications: config.dig("colors", "diff_modifications") || DEFAULT_DIFF_MODIFICATIONS,
15
+ diff_removals: config.dig("colors", "diff_removals") || DEFAULT_DIFF_REMOVALS
16
16
  }
17
17
  end
18
18
 
@@ -16,6 +16,10 @@ module Dotsync
16
16
  validate!
17
17
  end
18
18
 
19
+ def to_h
20
+ @config
21
+ end
22
+
19
23
  private
20
24
  # Validates the configuration file.
21
25
  #
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,
@@ -17,8 +17,8 @@ module Dotsync
17
17
  config_class = Dotsync.const_get("#{camelize(action_name.to_s)}ActionConfig")
18
18
 
19
19
  config = config_class.new(Dotsync.config_path)
20
- Dotsync::Icons.load_custom_icons(config)
21
- Dotsync::Colors.load_custom_colors(config)
20
+ Dotsync::Icons.load_custom_icons(config.to_h)
21
+ Dotsync::Colors.load_custom_colors(config.to_h)
22
22
 
23
23
  action = action_class.new(config, @logger)
24
24
 
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dotsync
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.8"
5
5
  end
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.6
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-28 00:00:00.000000000 Z
11
+ date: 2025-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: toml-rb