lib/pod_builder/command/clean.rb in pod-builder-0.3.2 vs lib/pod_builder/command/clean.rb in pod-builder-0.3.3
- old
+ new
@@ -82,16 +82,15 @@
if confirm.downcase == 'y'
PodBuilder::safe_rm_rf(path)
end
end
- current_dir = Dir.pwd
- Dir.chdir(base_path)
- # Before deleting anything be sure we're in a git repo
- h = `git rev-parse --show-toplevel`.strip()
- raise "\n\nNo git repository found in current folder `#{Dir.pwd}`!\n".red if h.empty?
- system("find . -type d -empty -delete") # delete empty folders
- Dir.chdir(current_dir)
+ Dir.chdir(base_path) do
+ # Before deleting anything be sure we're in a git repo
+ h = `git rev-parse --show-toplevel`.strip()
+ raise "\n\nNo git repository found in current folder `#{Dir.pwd}`!\n".red if h.empty?
+ system("find . -type d -empty -delete") # delete empty folders
+ end
end
end
end
end