1+ #!/usr/bin/rake
2+
13## UTILS ##
24
35def run ( command , xcpretty : true )
@@ -38,16 +40,15 @@ namespace :carthage do
3840 end
3941end
4042
41- namespace :swiftlint do
42- desc "Install SwiftLint from pkg"
43- task :install do
44- next if system ( 'which swiftlint >/dev/null' )
45- install_pkg ( 'https://github.com/realm/SwiftLint/releases/download/0.26.0/SwiftLint.pkg' )
43+ namespace :demo do
44+ desc "Builds the ReusableDemo app for iOS using xcodebuild."
45+ task :ios do |t , args |
46+ xcodebuild ( scheme : 'ReusableDemo iOS' , sdk : 'iphonesimulator' , destination : DESTINATIONS [ :ios_sim ] )
4647 end
4748
48- desc "Run SwiftLint on the source code "
49- task :run do
50- run ( 'swiftlint lint --strict' , xcpretty : false )
49+ desc "Builds the ReusableDemo app for tvOS using xcodebuild. "
50+ task :tvos do | t , args |
51+ xcodebuild ( scheme : 'ReusableDemo tvOS' , sdk : 'appletvsimulator' , destination : DESTINATIONS [ :tvos_sim ] )
5152 end
5253end
5354
@@ -63,23 +64,38 @@ namespace :fmk do
6364 end
6465end
6566
66- namespace :demo do
67- desc "Builds the ReusableDemo app for iOS using xcodebuild. "
68- task :ios do |t , args |
69- xcodebuild ( scheme : 'ReusableDemo iOS' , sdk : 'iphonesimulator' , destination : DESTINATIONS [ :ios_sim ] )
67+ namespace :pod do
68+ desc "Lints the Reusable.podspec "
69+ task :lint do |t |
70+ run ( "pod lib lint --allow-warnings --quick" , xcpretty : false )
7071 end
72+ end
7173
72- desc "Builds the ReusableDemo app for tvOS using xcodebuild."
73- task :tvos do |t , args |
74- xcodebuild ( scheme : 'ReusableDemo tvOS' , sdk : 'appletvsimulator' , destination : DESTINATIONS [ :tvos_sim ] )
74+ namespace :spm do
75+ desc 'Build using SPM'
76+ task :build do |task |
77+ Utils . print_header 'Compile using SPM'
78+ Utils . run ( 'swift build' , task , xcrun : true )
79+ end
80+
81+ desc 'Run SPM Unit Tests'
82+ task :test => :build do |task |
83+ Utils . print_header 'Run the unit tests using SPM'
84+ Utils . run ( 'swift test' , task , xcrun : true )
7585 end
7686end
7787
78- # TODO: "namespace :test" once we have Unit Tests
88+ namespace :swiftlint do
89+ desc "Install SwiftLint from pkg"
90+ task :install do
91+ next if system ( 'which swiftlint >/dev/null' )
92+ install_pkg ( 'https://github.com/realm/SwiftLint/releases/download/0.26.0/SwiftLint.pkg' )
93+ end
7994
80- namespace :pod do
81- desc "Lints the Reusable.podspec"
82- task :lint do |t |
83- run ( "pod lib lint --allow-warnings --quick" , xcpretty : false )
95+ desc "Run SwiftLint on the source code"
96+ task :run do
97+ run ( 'swiftlint lint --strict' , xcpretty : false )
8498 end
8599end
100+
101+ # TODO: "namespace :test" once we have Unit Tests
0 commit comments