From 10499593c41a33b26a09fa722c3c28893d813e7a Mon Sep 17 00:00:00 2001 From: Laurent Sansonetti Date: Thu, 15 May 2014 19:47:14 +0200 Subject: [PATCH] =?UTF-8?q?move=20the=20`rake=20clear=E2=80=99=20logic=20t?= =?UTF-8?q?o=20platform-specific=20config=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/motion/project.rb | 14 +------------- lib/motion/project/config.rb | 15 +++++++++++++++ lib/motion/project/xcode_config.rb | 5 +++++ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/lib/motion/project.rb b/lib/motion/project.rb index b52de8c1..062c72ec 100644 --- a/lib/motion/project.rb +++ b/lib/motion/project.rb @@ -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 diff --git a/lib/motion/project/config.rb b/lib/motion/project/config.rb index 47aa5cf4..ada47b58 100644 --- a/lib/motion/project/config.rb +++ b/lib/motion/project/config.rb @@ -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 diff --git a/lib/motion/project/xcode_config.rb b/lib/motion/project/xcode_config.rb index 3cb9e835..e27f960d 100644 --- a/lib/motion/project/xcode_config.rb +++ b/lib/motion/project/xcode_config.rb @@ -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