Skip to content

Commit 74dbf7c

Browse files
authored
prune - Don't raise an exception if install_path doesn't exist (#557)
1 parent 8aee2eb commit 74dbf7c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

spec/integration/prune_spec.cr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,9 @@ describe "prune" do
3636
Dir.cd(application_path) { run "shards prune" }
3737
installed_dependencies.sort.should eq([".keep_hidden", "keep_not_hidden", "web"])
3838
end
39+
40+
it "should not fail if the install directory does not exist" do
41+
run "rm -rf #{install_path}"
42+
Dir.cd(application_path) { run "shards prune" }
43+
end
3944
end

src/commands/prune.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Shards
66
module Commands
77
class Prune < Command
88
def run
9-
return unless lockfile?
9+
return unless lockfile? && Dir.exists?(Shards.install_path)
1010

1111
Dir.each_child(Shards.install_path) do |name|
1212
path = File.join(Shards.install_path, name)

0 commit comments

Comments
 (0)