move the `rake clear’ logic to platform-specific config files

This commit is contained in:
Laurent Sansonetti
2014-05-15 19:47:14 +02:00
parent 656af65680
commit 10499593c4
3 changed files with 21 additions and 13 deletions

View File

@@ -42,19 +42,7 @@ system("/usr/bin/ruby \"#{motion_bin_path}\" update --check")
desc "Clear local build objects"
task :clean do
paths = [App.config.build_dir]
paths.concat(Dir.glob(App.config.resources_dirs.flatten.map{ |x| x + '/**/*.{nib,storyboardc,momd}' }))
paths.each do |p|
next if File.extname(p) == ".nib" && !File.exist?(p.sub(/\.nib$/, ".xib"))
App.info 'Delete', p
rm_rf p
if File.exist?(p)
# It can happen that because of file permissions a dir/file is not
# actually removed, which can lead to confusing issues.
App.fail "Failed to remove `#{p}'. Please remove this path manually."
end
end
App.config.vendor_projects.each { |vendor| vendor.clean }
App.config.clean_project
end
namespace :clean do

View File

@@ -296,5 +296,20 @@ in the debugger.
EOS
$stderr.puts '=' * 80
end
def clean_project
paths = [self.build_dir]
paths.concat(Dir.glob(self.resources_dirs.flatten.map{ |x| x + '/**/*.{nib,storyboardc,momd}' }))
paths.each do |p|
next if File.extname(p) == ".nib" && !File.exist?(p.sub(/\.nib$/, ".xib"))
App.info 'Delete', p
rm_rf p
if File.exist?(p)
# It can happen that because of file permissions a dir/file is not
# actually removed, which can lead to confusing issues.
App.fail "Failed to remove `#{p}'. Please remove this path manually."
end
end
end
end
end; end

View File

@@ -409,5 +409,10 @@ EOS
def unvendor_project(path)
@vendor_projects.delete_if { |x| x.path == path }
end
def clean_project
super
@vendor_projects.each { |vendor| vendor.clean }
end
end
end; end