From 478472308c49b25413c31697c19e52037f2a427c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Fri, 17 Oct 2014 12:55:57 +0200 Subject: [PATCH] [rake] Re-instate top-level `clean` task and refactor into XcodeConfig. Related to: * https://github.com/lrz/RubyMotion/commit/646cbb1918a1796ad595082e1887e80c6c8c7f24 * https://github.com/lrz/RubyMotion/commit/bddc880f9868af26285a6266403885f86803c746 --- lib/motion/project.rb | 5 +++++ lib/motion/project/config.rb | 2 +- lib/motion/project/template/android.rb | 4 ---- lib/motion/project/template/android/config.rb | 1 - lib/motion/project/template/ios-extension.rb | 5 ----- lib/motion/project/template/ios-framework.rb | 5 ----- lib/motion/project/template/ios.rb | 5 ----- lib/motion/project/template/osx.rb | 5 ----- lib/motion/project/xcode_config.rb | 2 +- 9 files changed, 7 insertions(+), 27 deletions(-) diff --git a/lib/motion/project.rb b/lib/motion/project.rb index 70d71364..bcd1d817 100644 --- a/lib/motion/project.rb +++ b/lib/motion/project.rb @@ -42,6 +42,11 @@ unless ENV['RM_TARGET_BUILD'] system("/usr/bin/ruby \"#{motion_bin_path}\" update --check") end +desc "Clear local build objects" +task :clean do + App.config.clean_project +end + namespace :clean do desc "Clean all build objects" task :all do diff --git a/lib/motion/project/config.rb b/lib/motion/project/config.rb index 70f1ad41..c6b4d53d 100644 --- a/lib/motion/project/config.rb +++ b/lib/motion/project/config.rb @@ -291,7 +291,7 @@ EOS $stderr.puts '=' * 80 end - def clean_project(platforms) + 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| diff --git a/lib/motion/project/template/android.rb b/lib/motion/project/template/android.rb index 1be84a70..f34c2533 100644 --- a/lib/motion/project/template/android.rb +++ b/lib/motion/project/template/android.rb @@ -523,7 +523,3 @@ task :device => ['build', 'device:install', 'device:start'] desc "Build the app then run it in the emulator" task :default => 'emulator:start' -desc "Clear local build objects" -task :clean do - App.config.clean_project -end diff --git a/lib/motion/project/template/android/config.rb b/lib/motion/project/template/android/config.rb index 4d271c13..e05a3102 100644 --- a/lib/motion/project/template/android/config.rb +++ b/lib/motion/project/template/android/config.rb @@ -236,7 +236,6 @@ module Motion; module Project; end def clean_project - super [] vendored_bs_files(false).each do |path| if File.exist?(path) App.info 'Delete', path diff --git a/lib/motion/project/template/ios-extension.rb b/lib/motion/project/template/ios-extension.rb index 28a78621..f1e725cb 100644 --- a/lib/motion/project/template/ios-extension.rb +++ b/lib/motion/project/template/ios-extension.rb @@ -37,11 +37,6 @@ require 'motion/project' require 'motion/project/template/ios-extension-config' require 'motion/project/template/ios-extension-builder' -desc "Clear local build objects" -task :clean do - App.config.clean_project(['iPhoneSimulator', 'iPhoneOS']) -end - desc "Build the simulator version" task :default => :"build:simulator" diff --git a/lib/motion/project/template/ios-framework.rb b/lib/motion/project/template/ios-framework.rb index 7094ff76..816348d7 100644 --- a/lib/motion/project/template/ios-framework.rb +++ b/lib/motion/project/template/ios-framework.rb @@ -37,11 +37,6 @@ require 'motion/project' require 'motion/project/template/ios-framework/config' require 'motion/project/template/ios-framework/builder' -desc "Clear local build objects" -task :clean do - App.config.clean_project(['iPhoneSimulator', 'iPhoneOS']) -end - desc "Build the simulator version" task :default => :"build:simulator" diff --git a/lib/motion/project/template/ios.rb b/lib/motion/project/template/ios.rb index 5e9f98dd..417e9ba0 100644 --- a/lib/motion/project/template/ios.rb +++ b/lib/motion/project/template/ios.rb @@ -33,11 +33,6 @@ require 'motion/project' require 'motion/project/template/ios/config' require 'motion/project/template/ios/builder' -desc "Clear local build objects" -task :clean do - App.config.clean_project(['iPhoneSimulator', 'iPhoneOS']) -end - desc "Build the project, then run the simulator" task :default => :simulator diff --git a/lib/motion/project/template/osx.rb b/lib/motion/project/template/osx.rb index 1ddcf390..d7f2e15a 100644 --- a/lib/motion/project/template/osx.rb +++ b/lib/motion/project/template/osx.rb @@ -32,11 +32,6 @@ require 'motion/project' require 'motion/project/template/osx/config' require 'motion/project/template/osx/builder' -desc "Clear local build objects" -task :clean do - App.config.clean_project(['MacOSX']) -end - desc "Build the project, then run it" task :default => :run diff --git a/lib/motion/project/xcode_config.rb b/lib/motion/project/xcode_config.rb index 9458d254..eda780fd 100644 --- a/lib/motion/project/xcode_config.rb +++ b/lib/motion/project/xcode_config.rb @@ -486,7 +486,7 @@ EOS @vendor_projects.delete_if { |x| x.path == path } end - def clean_project(platforms) + def clean_project super @vendor_projects.each { |vendor| vendor.clean(platforms) } @targets.each { |target| target.clean }