Skip to content

Commit

Permalink
Remove entries from shards info file when pruning (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
waj committed Apr 30, 2020
1 parent 00f0c3b commit e43b63f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion spec/integration/prune_spec.cr
Expand Up @@ -23,7 +23,7 @@ describe "prune" do
it "removes unused dependencies" do
Dir.cd(application_path) { run "shards prune" }
installed_dependencies.should eq(["web"])
File.exists?(File.join(application_path, "lib", "orm.sha1")).should be_false
Shards::Info.new(install_path).installed.keys.should eq(["web"])
end

it "removes directories" do
Expand Down
9 changes: 3 additions & 6 deletions src/commands/prune.cr
Expand Up @@ -16,15 +16,12 @@ module Shards
Log.debug { "rm -rf '#{Helpers::Path.escape(path)}'" }
FileUtils.rm_rf(path)

version_file = "#{path}.version"
if File.exists?(version_file)
Log.debug { "rm '#{Helpers::Path.escape(version_file)}'" }
File.delete(version_file)
end

Shards.info.installed.delete(name)
Log.info { "Pruned #{File.join(File.basename(Shards.install_path), name)}" }
end
end

Shards.info.save
end
end
end
Expand Down

0 comments on commit e43b63f

Please sign in to comment.