From b1134536ae421e40915b92c38e78328c8a0339c3 Mon Sep 17 00:00:00 2001 From: David Jennes Date: Wed, 1 Mar 2017 23:48:39 +0100 Subject: [PATCH] do the same for pod and spm --- rakelib/pod.rake | 12 +++++++----- rakelib/spm.rake | 22 ++++++++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/rakelib/pod.rake b/rakelib/pod.rake index ce53d966..8224e820 100644 --- a/rakelib/pod.rake +++ b/rakelib/pod.rake @@ -1,7 +1,9 @@ -namespace :pod do - desc 'Lint the Pod' - task :lint do |task| - Utils.print_info 'Linting the pod spec' - Utils.run(%Q(bundle exec pod lib lint "#{POD_NAME}.podspec" --quick), task) +if File.file?('Podfile') + namespace :pod do + desc 'Lint the Pod' + task :lint do |task| + Utils.print_info 'Linting the pod spec' + Utils.run(%Q(bundle exec pod lib lint "#{POD_NAME}.podspec" --quick), task) + end end end diff --git a/rakelib/spm.rake b/rakelib/spm.rake index 3526e1f1..d88da894 100644 --- a/rakelib/spm.rake +++ b/rakelib/spm.rake @@ -1,13 +1,15 @@ -namespace :spm do - desc 'Build using SPM' - task :build do |task| - Utils.print_info 'Compile using SPM' - Utils.run("swift build", task, xcrun: true) - end +if File.file?('Package.swift') + namespace :spm do + desc 'Build using SPM' + task :build do |task| + Utils.print_info 'Compile using SPM' + Utils.run("swift build", task, xcrun: true) + end - desc 'Run SPM Unit Tests' - task :test => :build do |task| - Utils.print_info 'Run the unit tests using SPM' - Utils.run("swift test", task, xcrun: true) + desc 'Run SPM Unit Tests' + task :test => :build do |task| + Utils.print_info 'Run the unit tests using SPM' + Utils.run("swift test", task, xcrun: true) + end end end