dotlayer 0.3.1 → 0.3.2

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: adde5780e85065e220d516e6f2238a63122c5a4151aea1bee55e98e272c04750
4
- data.tar.gz: 693c72cb55917e957677c70b43114a6fe61968289f766662fb1198e96bcb283d
3
+ metadata.gz: 6cc8bde13229782ad14103053a087d775df340ce8c7d120201bdd435b0385ad7
4
+ data.tar.gz: 3922e94b846518b408738a05f4872d0bbac4aaa6d303c4f9df545c80ee17ed76
5
5
  SHA512:
6
- metadata.gz: fdba914ec98999e747f9eb2b4dc547e60887206ef51b60415d412882b6be1f21ba854418f306f82f80cb1970bd83cba67d13f048235162d5140abb6903082857
7
- data.tar.gz: 7692ffeb12541dcbffe01c9b3e42e9f7ff1dd39774cf0a49dc23025554c516be1be179b8c7fb745c8f316726638be785056283f658f32452f79ef497e35f8a68
6
+ metadata.gz: 6a1df6c95a538c11bcab8b2fec4c4db2ffd760c1dc993cfabb3743e198da9399172d31e320373097b66e571d3353a1770e0a27ddb7ff8252de546b543e2f0dbe
7
+ data.tar.gz: 8f2b0df93647c194ae9a02a387e0e810e0accdeec10af9803b2bb186d30b934644472ff60635954cb85616e64e4ceb287c54635658861678065f1a8f175ad1c7
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to dotlayer. Versions follow [Semantic Versioning](https://semver.org/).
4
4
 
5
+ ## 0.3.2 — 2026-11-05
6
+
7
+ ### Added
8
+
9
+ - `doctor` reports managed files that are no longer links. Tools that save by
10
+ writing a temp file and renaming it, or with `sed -i`, replace a stowed link
11
+ with a plain file, and changes in the repo stop reaching the machine. Before,
12
+ only `install` noticed, by failing with conflicts. The check asks Stow in
13
+ simulate mode, so it follows Stow's own ignore rules.
14
+
5
15
  ## 0.3.1 — 2026-11-05
6
16
 
7
17
  First RubyGems release since 0.2.2: it includes everything listed under 0.3.0,
data/README.md CHANGED
@@ -289,7 +289,7 @@ Exit status: `0` when nothing would change, `1` when changes are pending (so it
289
289
 
290
290
  ### doctor
291
291
 
292
- Checks that stow is installed, repos and packages exist, and that managed config paths have no broken symlinks. It also scans the whole target dir (default `~`) for symlinks that point into a configured repo but whose target no longer exists. The scan skips `.cache`, `node_modules`, `.git`, `.local/share/Steam` and the repos themselves. It also skips other git checkouts (any directory with a `.git`, like `~/src/*`), unless a package ships files into that path, since stow only links there in that case. It never follows directory symlinks, and stops at `--depth` levels (default 6). It only reports: each dangling link is listed with its target, followed by a suggested `rm` command.
292
+ Checks that stow is installed, repos and packages exist, that managed config paths have no broken symlinks, and that every managed file is still a link: an app that saves by replacing the file leaves a plain file there, which `install` would refuse to overwrite. It also scans the whole target dir (default `~`) for symlinks that point into a configured repo but whose target no longer exists. The scan skips `.cache`, `node_modules`, `.git`, `.local/share/Steam` and the repos themselves. It also skips other git checkouts (any directory with a `.git`, like `~/src/*`), unless a package ships files into that path, since stow only links there in that case. It never follows directory symlinks, and stops at `--depth` levels (default 6). It only reports: each dangling link is listed with its target, followed by a suggested `rm` command.
293
293
 
294
294
  Exit status: `0` when no issues are found, `1` otherwise.
295
295
 
@@ -30,6 +30,7 @@ module Dotlayer
30
30
  check_repos_exist
31
31
  check_packages_exist(@packages)
32
32
  check_broken_symlinks
33
+ check_unlinked_files
33
34
  check_dangling_repo_links
34
35
 
35
36
  puts
@@ -47,7 +48,7 @@ module Dotlayer
47
48
 
48
49
  def check_stow_installed
49
50
  print " Checking stow... "
50
- if system("which", "stow", out: File::NULL, err: File::NULL)
51
+ if (@stow_installed = system("which", "stow", out: File::NULL, err: File::NULL))
51
52
  ok "installed"
52
53
  else
53
54
  error "missing"
@@ -95,6 +96,35 @@ module Dotlayer
95
96
  end
96
97
  end
97
98
 
99
+ # Tools that save by writing a temp file and renaming it (or `sed -i`)
100
+ # replace a stowed link with a plain file, and the repo stops reaching
101
+ # the machine. Stow's simulate mode reports those as conflicts, so ask
102
+ # it instead of re-implementing its ignore rules.
103
+ def check_unlinked_files
104
+ return unless @stow_installed
105
+
106
+ print " Checking that managed files are still links... "
107
+ stow = Stow.new(target: @config.target, dry_run: true, quiet: true)
108
+ conflicts = @packages.flat_map { |repo_path, package|
109
+ next [] if !Dir.exist?(File.join(repo_path, package)) || stow.restow(repo_path, package)
110
+
111
+ conflicts = stow.last_output.to_s.each_line(chomp: true).filter_map { |line| Diff::CONFLICT_LINE.match(line)&.[](1) }
112
+ conflicts = [stow.last_error] if conflicts.empty?
113
+ conflicts.map { |conflict| [repo_path, package, conflict] }
114
+ }
115
+
116
+ if conflicts.empty?
117
+ ok "yes"
118
+ return
119
+ end
120
+
121
+ warning "#{conflicts.size} not linked"
122
+ conflicts.each do |repo_path, package, conflict|
123
+ @issues << "#{File.basename(repo_path)}/#{package}: #{conflict}"
124
+ end
125
+ @hints << "Compare each file with its repo copy (dotlayer diff lists them), keep what you need, delete the plain file, then run dotlayer install."
126
+ end
127
+
98
128
  # Report-only scan of the whole target dir for links into a configured
99
129
  # repo whose destination no longer exists. Never follows directory
100
130
  # symlinks and never deletes anything.
data/lib/dotlayer.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dotlayer
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
 
4
4
  autoload :CLI, "dotlayer/cli"
5
5
  autoload :Config, "dotlayer/config"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotlayer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Douglas Andrade