mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-01 09:31:20 +08:00
move the `rake clear’ logic to platform-specific config files
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user