@@ -8,15 +8,35 @@ desc "build"
88task :build , :workspace , :schemes do |t , args |
99 schemes = args [ :schemes ] . gsub ( /'/ , '' ) . split ( ' ' )
1010 schemes . each do |scheme |
11- sh "xcodebuild -workspace #{ args [ :workspace ] } -scheme #{ scheme } CODE_SIGN_IDENTITY=\" \" CODE_SIGNING_REQUIRED=NO | xcpretty -c; exit ${PIPESTATUS[0]}"
11+ options = {
12+ workspace : "#{ args [ :workspace ] } " ,
13+ scheme : "#{ scheme } "
14+ }
15+ options = join_option ( options : options , prefix : "-" , seperator : " " )
16+ settings = {
17+ CODE_SIGN_IDENTITY : "" ,
18+ CODE_SIGNING_REQUIRED : "NO"
19+ }
20+ settings = join_option ( options : settings , prefix : "" , seperator : "=" )
21+ sh "xcodebuild #{ options } #{ settings } build | xcpretty -c; exit ${PIPESTATUS[0]}"
1222 end
1323end
1424
1525desc "clean"
1626task :clean , :workspace , :schemes do |t , args |
1727 schemes = args [ :schemes ] . gsub ( /'/ , '' ) . split ( ' ' )
1828 schemes . each do |scheme |
19- sh "xcodebuild clean -workspace #{ args [ :workspace ] } -scheme #{ scheme } CODE_SIGN_IDENTITY=\" \" CODE_SIGNING_REQUIRED=NO | xcpretty -c; exit ${PIPESTATUS[0]}"
29+ options = {
30+ workspace : "#{ args [ :workspace ] } " ,
31+ scheme : "#{ scheme } "
32+ }
33+ options = join_option ( options : options , prefix : "-" , seperator : " " )
34+ settings = {
35+ CODE_SIGN_IDENTITY : "" ,
36+ CODE_SIGNING_REQUIRED : "NO"
37+ }
38+ settings = join_option ( options : settings , prefix : "" , seperator : "=" )
39+ sh "xcodebuild #{ options } #{ settings } clean | xcpretty -c; exit ${PIPESTATUS[0]}"
2040 end
2141end
2242
@@ -25,7 +45,20 @@ task :test, :workspace, :schemes do |t, args|
2545 schemes = args [ :schemes ] . gsub ( /'/ , '' ) . split ( ' ' )
2646 schemes . each do |scheme |
2747 DESTINATIONS . each do |destination |
28- sh "xcodebuild test -workspace #{ args [ :workspace ] } -scheme #{ scheme } -configuration Debug -sdk iphonesimulator -destination \" #{ destination } \" | xcpretty -tc; exit ${PIPESTATUS[0]}"
48+ options = {
49+ workspace : "#{ args [ :workspace ] } " ,
50+ scheme : "#{ scheme } " ,
51+ configuration : "Debug" ,
52+ sdk : "iphonesimulator" ,
53+ destination : "#{ destination } "
54+ }
55+ options = join_option ( options : options , prefix : "-" , seperator : " " )
56+ sh "xcodebuild test #{ options } | xcpretty -tc; exit ${PIPESTATUS[0]}"
2957 end
3058 end
3159end
60+
61+ def join_option ( options : { } , prefix : "" , seperator : "" )
62+ _options = options . map { |k , v | %(#{ prefix } #{ k } #{ seperator } "#{ v } ") }
63+ _options = _options . join ( " " )
64+ end
0 commit comments