Skip to content

Commit 35616b9

Browse files
committed
Fix: prune command must only remove directories
The issue was found in the nightly builds.
1 parent cceb4c4 commit 35616b9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/commands/prune.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module Shards
99
return unless lockfile?
1010

1111
Dir[File.join(Shards.install_path, "*")].each do |path|
12-
next unless Dir.exists?(path)
12+
next unless File.directory?(path)
1313
name = File.basename(path)
1414

1515
if locks.none? { |d| d.name == name }

test/integration/prune_test.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class PruneCommandTest < Minitest::Test
2626
end
2727

2828
def test_wont_remove_files
29-
File.write(File.join(application_path, "lib", ".keep"), "")
29+
File.write(File.join(application_path, "lib", "keep"), "")
3030
Dir.cd(application_path) { run "shards prune" }
31-
assert_equal [".keep", "web"], installed_dependencies.sort
31+
assert_equal ["keep", "web"], installed_dependencies.sort
3232
end
3333

3434
private def installed_dependencies

0 commit comments

Comments
 (0)