thrust 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/bin/thrust +2 -9
  3. data/lib/config/{ios_example.yml → thrust_example.yml} +26 -19
  4. data/lib/tasks/autotag.rake +2 -2
  5. data/lib/tasks/cedar.rake +8 -11
  6. data/lib/tasks/testflight.rake +5 -14
  7. data/lib/tasks/version.rake +3 -7
  8. data/lib/thrust.rb +11 -13
  9. data/lib/thrust/agv_tool.rb +14 -0
  10. data/lib/thrust/app_config.rb +24 -10
  11. data/lib/thrust/cedar_results_parser.rb +7 -0
  12. data/lib/thrust/config_loader.rb +48 -0
  13. data/lib/thrust/deploy.rb +53 -0
  14. data/lib/thrust/deploy_provider.rb +17 -0
  15. data/lib/thrust/deployment_target.rb +6 -6
  16. data/lib/thrust/execution_helper.rb +1 -1
  17. data/lib/thrust/executor.rb +2 -1
  18. data/lib/thrust/ios_spec_launcher.rb +36 -0
  19. data/lib/thrust/osx_spec_launcher.rb +15 -0
  20. data/lib/thrust/scheme_parser.rb +35 -0
  21. data/lib/thrust/{ios_spec_target.rb → spec_target.rb} +1 -3
  22. data/lib/thrust/tasks.rb +1 -1
  23. data/lib/thrust/tasks/autotag/list.rb +2 -2
  24. data/lib/thrust/tasks/clean.rb +5 -5
  25. data/lib/thrust/tasks/focused_specs.rb +14 -4
  26. data/lib/thrust/tasks/nof.rb +8 -3
  27. data/lib/thrust/tasks/spec_runner.rb +75 -0
  28. data/lib/thrust/xcode_tools.rb +159 -0
  29. data/lib/thrust/xcode_tools_provider.rb +11 -0
  30. metadata +36 -23
  31. data/lib/config/android_example.yml +0 -17
  32. data/lib/thrust/android/deploy.rb +0 -38
  33. data/lib/thrust/android/deploy_provider.rb +0 -16
  34. data/lib/thrust/android/tools.rb +0 -43
  35. data/lib/thrust/config.rb +0 -43
  36. data/lib/thrust/ios/agv_tool.rb +0 -16
  37. data/lib/thrust/ios/cedar.rb +0 -27
  38. data/lib/thrust/ios/deploy.rb +0 -55
  39. data/lib/thrust/ios/deploy_provider.rb +0 -19
  40. data/lib/thrust/ios/x_code_tools.rb +0 -154
  41. data/lib/thrust/ios/x_code_tools_provider.rb +0 -13
  42. data/lib/thrust/tasks/ios_specs.rb +0 -43
@@ -0,0 +1,11 @@
1
+ module Thrust
2
+ class XcodeToolsProvider
3
+ def initialize(thrust_executor = Thrust::Executor.new)
4
+ @thrust_executor = thrust_executor
5
+ end
6
+
7
+ def instance(out, build_configuration, build_directory, options)
8
+ Thrust::XcodeTools.new(@thrust_executor, out, build_configuration, build_directory, options)
9
+ end
10
+ end
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thrust
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Levine
@@ -27,7 +27,7 @@ authors:
27
27
  autorequire:
28
28
  bindir: bin
29
29
  cert_chain: []
30
- date: 2015-01-09 00:00:00.000000000 Z
30
+ date: 2015-01-29 00:00:00.000000000 Z
31
31
  dependencies:
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: colorize
@@ -71,6 +71,20 @@ dependencies:
71
71
  - - "~>"
72
72
  - !ruby/object:Gem::Version
73
73
  version: '10.1'
74
+ - !ruby/object:Gem::Dependency
75
+ name: nori
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: 2.4.0
81
+ type: :runtime
82
+ prerelease: false
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: 2.4.0
74
88
  - !ruby/object:Gem::Dependency
75
89
  name: fakefs
76
90
  requirement: !ruby/object:Gem::Requirement
@@ -91,14 +105,14 @@ dependencies:
91
105
  requirements:
92
106
  - - '='
93
107
  - !ruby/object:Gem::Version
94
- version: '2.14'
108
+ version: 3.1.0
95
109
  type: :development
96
110
  prerelease: false
97
111
  version_requirements: !ruby/object:Gem::Requirement
98
112
  requirements:
99
113
  - - '='
100
114
  - !ruby/object:Gem::Version
101
- version: '2.14'
115
+ version: 3.1.0
102
116
  - !ruby/object:Gem::Dependency
103
117
  name: timecop
104
118
  requirement: !ruby/object:Gem::Requirement
@@ -113,50 +127,48 @@ dependencies:
113
127
  - - "~>"
114
128
  - !ruby/object:Gem::Version
115
129
  version: '0.7'
116
- description: Thrust provides a collection of rake tasks for iOS and Android projects. These
117
- include tasks for running Cedar test suites (iOS) and for deploying apps to Testflight
118
- (iOS and Android).
119
- email: mc+jbritz@pivotallabs.com
130
+ description: Thrust provides a collection of rake tasks for iOS projects. These include
131
+ tasks for running Cedar test suites and for deploying iOS apps to Testflight.
132
+ email: edellapenna@pivotal.io
120
133
  executables:
121
134
  - thrust
122
135
  extensions: []
123
136
  extra_rdoc_files: []
124
137
  files:
125
138
  - bin/thrust
126
- - lib/config/android_example.yml
127
- - lib/config/ios_example.yml
139
+ - lib/config/thrust_example.yml
128
140
  - lib/tasks/autotag.rake
129
141
  - lib/tasks/cedar.rake
130
142
  - lib/tasks/testflight.rake
131
143
  - lib/tasks/version.rake
132
144
  - lib/thrust.rb
133
- - lib/thrust/android/deploy.rb
134
- - lib/thrust/android/deploy_provider.rb
135
- - lib/thrust/android/tools.rb
145
+ - lib/thrust/agv_tool.rb
136
146
  - lib/thrust/app_config.rb
137
- - lib/thrust/config.rb
147
+ - lib/thrust/cedar_results_parser.rb
148
+ - lib/thrust/config_loader.rb
149
+ - lib/thrust/deploy.rb
150
+ - lib/thrust/deploy_provider.rb
138
151
  - lib/thrust/deployment_target.rb
139
152
  - lib/thrust/execution_helper.rb
140
153
  - lib/thrust/executor.rb
141
154
  - lib/thrust/git.rb
142
- - lib/thrust/ios/agv_tool.rb
143
- - lib/thrust/ios/cedar.rb
144
- - lib/thrust/ios/deploy.rb
145
- - lib/thrust/ios/deploy_provider.rb
146
- - lib/thrust/ios/x_code_tools.rb
147
- - lib/thrust/ios/x_code_tools_provider.rb
148
- - lib/thrust/ios_spec_target.rb
155
+ - lib/thrust/ios_spec_launcher.rb
156
+ - lib/thrust/osx_spec_launcher.rb
157
+ - lib/thrust/scheme_parser.rb
158
+ - lib/thrust/spec_target.rb
149
159
  - lib/thrust/tasks.rb
150
160
  - lib/thrust/tasks/autotag/create.rb
151
161
  - lib/thrust/tasks/autotag/list.rb
152
162
  - lib/thrust/tasks/clean.rb
153
163
  - lib/thrust/tasks/focused_specs.rb
154
- - lib/thrust/tasks/ios_specs.rb
155
164
  - lib/thrust/tasks/nof.rb
165
+ - lib/thrust/tasks/spec_runner.rb
156
166
  - lib/thrust/tasks/trim.rb
157
167
  - lib/thrust/testflight.rb
158
168
  - lib/thrust/testflight_credentials.rb
159
169
  - lib/thrust/user_prompt.rb
170
+ - lib/thrust/xcode_tools.rb
171
+ - lib/thrust/xcode_tools_provider.rb
160
172
  homepage: http://github.com/pivotal/thrust
161
173
  licenses:
162
174
  - MIT
@@ -180,5 +192,6 @@ rubyforge_project:
180
192
  rubygems_version: 2.2.2
181
193
  signing_key:
182
194
  specification_version: 4
183
- summary: Thrust is a collection of rake tasks for iOS/Android development and deployment
195
+ summary: Thrust is a collection of rake tasks for iOS development and deployment
184
196
  test_files: []
197
+ has_rdoc:
@@ -1,17 +0,0 @@
1
- thrust_version: 0.5
2
- project_name: My Great Project
3
- app_name: My Great App
4
-
5
- testflight:
6
- api_token: 'testflight api token'
7
- team_token: 'testflight team token'
8
-
9
- deployment_targets:
10
- staging:
11
- distribution_list: Developers
12
- notify: true
13
- note_generation_method: autotag # If you set this value, it will auto-generate the deploy notes from the commit history. Optional.
14
-
15
- demo:
16
- distribution_list: Beta Testers
17
- notify: true
@@ -1,38 +0,0 @@
1
- module Thrust
2
- module Android
3
- class Deploy
4
- def initialize(out, tools, git, testflight, deployment_config, deployment_target)
5
- @out = out
6
- @tools = tools
7
- @git = git
8
- @testflight = testflight
9
- @deployment_config = deployment_config
10
- @deployment_target = deployment_target
11
- end
12
-
13
- def run
14
- @git.ensure_clean
15
-
16
- begin
17
- @git.checkout_tag(@deployment_config.tag) if @deployment_config.tag
18
-
19
- @tools.change_build_number(Time.now.utc.strftime('%y%m%d%H%M'), @git.current_commit)
20
- apk_path = @tools.build_signed_release
21
-
22
- autogenerate_notes = @deployment_config.note_generation_method == 'autotag'
23
- @testflight.upload(apk_path, @deployment_config.notify, @deployment_config.distribution_list, autogenerate_notes, @deployment_target)
24
-
25
- @git.create_tag(@deployment_target)
26
- @git.reset
27
- rescue Exception => e
28
- @out.puts "\n\n"
29
- @out.puts e.message.red
30
- @out.puts "\n\n"
31
-
32
- @git.reset
33
- exit 1
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,16 +0,0 @@
1
- module Thrust
2
- module Android
3
- class DeployProvider
4
- def instance(thrust_config, deployment_config, deployment_target)
5
- thrust_executor = Thrust::Executor.new
6
- tools = Thrust::Android::Tools.new($stdout, thrust_executor)
7
- git = Thrust::Git.new($stdout, thrust_executor)
8
-
9
- testflight_config = thrust_config.app_config.testflight
10
- testflight = Thrust::Testflight.new(thrust_executor, $stdout, $stdin, testflight_config.api_token, testflight_config.team_token)
11
-
12
- Thrust::Android::Deploy.new($stdout, tools, git, testflight, deployment_config, deployment_target)
13
- end
14
- end
15
- end
16
- end
@@ -1,43 +0,0 @@
1
- require 'colorize'
2
-
3
- module Thrust
4
- module Android
5
- class Tools
6
- def initialize(out = $stdout, thrust_executor = Thrust::Executor.new)
7
- @thrust_executor = thrust_executor
8
- @out = out
9
- end
10
-
11
- def change_build_number(version_code, version_name)
12
- @thrust_executor.system_or_exit(
13
- "sed -i ''" +
14
- " -e 's/android:versionCode=\"[0-9]*\"/android:versionCode=\"#{version_code}\"/'" +
15
- " -e 's/android:versionName=\"\\([^ \"]*\\)[^\"]*\"/android:versionName=\"\\1 (#{version_name})\"/'" +
16
- " AndroidManifest.xml")
17
- @thrust_executor.system_or_exit(
18
- "sed -i ''" +
19
- " '1,/<version>/s/<version>\\([^- <]*\\)[^<]*<\\/version>/<version>\\1 (#{version_name})<\\/version>/'" +
20
- " pom.xml")
21
- end
22
-
23
- def build_signed_release
24
- verify_android_installed!
25
- @thrust_executor.system_or_exit('mvn clean package -Prelease')
26
- Dir.glob('target/*-signed-aligned.apk').first or raise 'Signed APK was not generated'
27
- end
28
-
29
- private
30
-
31
- def verify_android_installed!
32
- if ENV['ANDROID_HOME'].nil?
33
- if File.directory?('/usr/local/opt/android-sdk')
34
- @out.puts 'Setting /usr/local/opt/android-sdk as ANDROID_HOME...'.magenta
35
- ENV['ANDROID_HOME'] = '/usr/local/opt/android-sdk'
36
- else
37
- raise('**********Android is not installed. Run `brew install android`.**********')
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,43 +0,0 @@
1
- require 'colorize'
2
- require_relative 'app_config'
3
- require 'yaml'
4
-
5
- module Thrust
6
- class Config
7
- attr_reader :project_root, :app_config, :build_dir
8
-
9
- THRUST_VERSION = '0.5'
10
- THRUST_ROOT = File.expand_path('../..', __FILE__)
11
-
12
- def self.make(relative_project_root, config_file)
13
- begin
14
- config_file_contents = YAML.load_file(config_file)
15
- rescue Errno::ENOENT
16
- puts ""
17
- puts " Missing thrust.yml. Create by running:\n".red
18
- puts " cp thrust.example.yml thrust.yml".blue
19
- exit 1
20
- rescue Psych::SyntaxError
21
- puts ""
22
- puts " Malformed thrust.yml.".red
23
- exit 1
24
- end
25
- new(relative_project_root, config_file_contents)
26
- end
27
-
28
- def initialize(relative_project_root, config)
29
- @project_root = File.expand_path(relative_project_root)
30
- @build_dir = File.join(project_root, 'build')
31
- @app_config = Thrust::AppConfig.new(config)
32
- verify_configuration
33
- end
34
-
35
- private
36
-
37
- def verify_configuration
38
- if @app_config.thrust_version != THRUST_VERSION
39
- fail "Invalid configuration. Have you updated thrust recently? Your thrust.yml specifies an out-of-date version, and thrust is at version: #{THRUST_VERSION}. See README for details.".red
40
- end
41
- end
42
- end
43
- end
@@ -1,16 +0,0 @@
1
- module Thrust
2
- module IOS
3
- class AgvTool
4
- def initialize(thrust_executor = Thrust::Executor.new, git = Thrust::Git.new)
5
- @thrust_executor = thrust_executor
6
- @git = git
7
- end
8
-
9
- def change_build_number(build_number, timestamp = nil, path_to_xcodeproj = nil)
10
- path_to_xcodeproj = path_to_xcodeproj ? File.dirname(path_to_xcodeproj) : '.'
11
- @thrust_executor.system_or_exit "cd #{path_to_xcodeproj} && agvtool new-version -all '#{timestamp ? timestamp + '-' : ''}#{build_number}'"
12
- @git.checkout_file("#{path_to_xcodeproj}/*.xcodeproj")
13
- end
14
- end
15
- end
16
- end
@@ -1,27 +0,0 @@
1
- require 'tmpdir'
2
-
3
- module Thrust
4
- module IOS
5
- class Cedar
6
- def initialize(out = $stdout, thrust_executor = Thrust::Executor.new)
7
- @thrust_executor = thrust_executor
8
- @out = out
9
- end
10
-
11
- def run(build_configuration, target, build_sdk, os_version, device_name, timeout, build_dir, simulator_binary)
12
- if build_sdk == 'macosx'
13
- build_path = File.join(build_dir, build_configuration)
14
- app_dir = File.join(build_path, target)
15
- @thrust_executor.check_command_for_failure(app_dir.inspect, {'DYLD_FRAMEWORK_PATH' => build_path.inspect})
16
- else
17
- device_type_id = "com.apple.CoreSimulator.SimDeviceType.#{device_name}, #{os_version}"
18
-
19
- app_executable = File.join(build_dir, "#{build_configuration}-#{build_sdk}", "#{target}.app")
20
- simulator_binary ||= 'ios-sim'
21
- timeout ||= '30'
22
- @thrust_executor.check_command_for_failure(%Q[#{simulator_binary} launch #{app_executable} --devicetypeid '#{device_type_id}' --timeout #{timeout} --setenv CFFIXED_USER_HOME=#{Dir.tmpdir} --setenv CEDAR_REPORTER_CLASS=CDRDefaultReporter])
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,55 +0,0 @@
1
- module Thrust
2
- module IOS
3
- class Deploy
4
- def initialize(out, x_code_tools, agv_tool, git, testflight, thrust_config, deployment_config, deployment_target)
5
- @out = out
6
- @x_code_tools = x_code_tools
7
- @agv_tool = agv_tool
8
- @git = git
9
- @testflight = testflight
10
- @thrust_config = thrust_config
11
- @deployment_config = deployment_config
12
- @deployment_target = deployment_target
13
- end
14
-
15
- def run
16
- @git.ensure_clean
17
-
18
- begin
19
- @git.checkout_tag(@deployment_config.tag) if @deployment_config.tag
20
-
21
- if @deployment_config.versioning_method != 'none'
22
- if @deployment_config.versioning_method == 'commits'
23
- @agv_tool.change_build_number(@git.commit_count, nil, @thrust_config.app_config.path_to_xcodeproj)
24
- elsif @deployment_config.versioning_method == 'timestamp-sha'
25
- @agv_tool.change_build_number(@git.current_commit, Time.now.utc.strftime('%y%m%d%H%M'), @thrust_config.app_config.path_to_xcodeproj)
26
- else
27
- @agv_tool.change_build_number(@git.current_commit, nil, @thrust_config.app_config.path_to_xcodeproj)
28
- end
29
- end
30
-
31
- app_name = @thrust_config.app_config.app_name
32
- target = @deployment_config.ios_target || app_name
33
-
34
- ipa_file = @x_code_tools.cleanly_create_ipa(target, app_name, @thrust_config.app_config.ios_distribution_certificate, @deployment_config.ios_provisioning_search_query)
35
-
36
- dsym_path = "#{@x_code_tools.build_configuration_directory}/#{app_name}.app.dSYM"
37
- dsym_path = nil unless File.exist?(dsym_path)
38
-
39
- autogenerate_notes = @deployment_config.note_generation_method == 'autotag'
40
- @testflight.upload(ipa_file, @deployment_config.notify, @deployment_config.distribution_list, autogenerate_notes, @deployment_target, dsym_path)
41
-
42
- @git.create_tag(@deployment_target)
43
- @git.reset
44
- rescue Exception => e
45
- @out.puts "\n\n"
46
- @out.puts e.message.red
47
- @out.puts "\n\n"
48
-
49
- @git.reset
50
- exit 1
51
- end
52
- end
53
- end
54
- end
55
- end
@@ -1,19 +0,0 @@
1
- module Thrust
2
- module IOS
3
- class DeployProvider
4
- def instance(thrust_config, deployment_config, deployment_target)
5
- stdout = $stdout
6
- thrust_executor = Thrust::Executor.new
7
- build_configuration = deployment_config.ios_build_configuration
8
- tools_options = {project_name: thrust_config.app_config.project_name, workspace_name: thrust_config.app_config.workspace_name}
9
- x_code_tools = Thrust::IOS::XCodeToolsProvider.new.instance(stdout, build_configuration, thrust_config.build_dir, tools_options)
10
- git = Thrust::Git.new(stdout, thrust_executor)
11
- agv_tool = Thrust::IOS::AgvTool.new(thrust_executor, git)
12
- testflight_config = thrust_config.app_config.testflight
13
- testflight = Thrust::Testflight.new(thrust_executor, stdout, $stdin, testflight_config.api_token, testflight_config.team_token)
14
-
15
- Thrust::IOS::Deploy.new(stdout, x_code_tools, agv_tool, git, testflight, thrust_config, deployment_config, deployment_target)
16
- end
17
- end
18
- end
19
- end
@@ -1,154 +0,0 @@
1
- module Thrust
2
- module IOS
3
- class XCodeTools
4
- ProvisioningProfileNotFound = Class.new(StandardError)
5
- ProvisioningProfileNotEmbedded = Class.new(StandardError)
6
-
7
- def initialize(thrust_executor, out, build_configuration, build_directory, options = {})
8
- @thrust_executor = thrust_executor
9
- @out = out
10
- @git = Thrust::Git.new(@out, @thrust_executor)
11
- @build_configuration = build_configuration
12
- @build_directory = build_directory
13
- @project_name = options[:project_name]
14
- @workspace_name = options[:workspace_name]
15
- raise "project_name OR workspace_name required" unless @project_name.nil? ^ @workspace_name.nil?
16
- end
17
-
18
- def cleanly_create_ipa(target, app_name, signing_identity, provision_search_query = nil)
19
- clean_build
20
- kill_simulator
21
- build_scheme_or_target(target, 'iphoneos')
22
- ipa_name = create_ipa(app_name, signing_identity, provision_search_query)
23
- verify_provision(app_name, provision_search_query)
24
-
25
- return ipa_name
26
- end
27
-
28
- def build_configuration_directory
29
- "#{@build_directory}/#{@build_configuration}-iphoneos"
30
- end
31
-
32
- def clean_build
33
- @out.puts 'Cleaning...'
34
- FileUtils.rm_rf(@build_directory)
35
- end
36
-
37
- def build_scheme_or_target(scheme_or_target, build_sdk, architecture=nil)
38
- @out.puts "Building..."
39
- run_xcode(build_sdk, scheme_or_target, architecture)
40
- end
41
-
42
- def test(scheme, build_configuration, os_version, device_name, timeout, build_dir)
43
- destination = "OS=#{os_version},name=#{device_name}"
44
- timeout ||= "30"
45
-
46
- cmd = [
47
- "xcodebuild",
48
- "test",
49
- "-scheme '#{scheme}'",
50
- "-configuration '#{build_configuration}'",
51
- "-destination '#{destination}'",
52
- "-destination-timeout '#{timeout}'",
53
- "SYMROOT='#{build_dir}'"
54
- ].join(' ')
55
-
56
- @thrust_executor.check_command_for_failure(cmd)
57
- end
58
-
59
- def kill_simulator
60
- @out.puts('Killing simulator...')
61
- @thrust_executor.system %q[killall -m -KILL "gdb"]
62
- @thrust_executor.system %q[killall -m -KILL "otest"]
63
- @thrust_executor.system %q[killall -m -KILL "iPhone Simulator"]
64
- end
65
-
66
- private
67
-
68
- def provision_path(provision_search_query)
69
- provision_search_path = File.expand_path("~/Library/MobileDevice/Provisioning Profiles")
70
- command = %Q(find '#{provision_search_path}' -print0 | xargs -0 grep -lr '#{provision_search_query}' --null | xargs -0 ls -t)
71
- provisioning_profile = `#{command}`.split("\n").first
72
- if !provisioning_profile
73
- raise(ProvisioningProfileNotFound, "\nCouldn't find provisioning profiles matching #{provision_search_query}.\n\nThe command used was:\n\n#{command}")
74
- end
75
- provisioning_profile
76
- end
77
-
78
- def create_ipa(app_name, signing_identity, provision_search_query)
79
- @out.puts 'Packaging...'
80
- app_filepath = "#{build_configuration_directory}/#{app_name}.app"
81
- ipa_filepath = "#{build_configuration_directory}/#{app_name}.ipa"
82
- package_command = [
83
- "xcrun",
84
- "-sdk iphoneos",
85
- "-v PackageApplication",
86
- "'#{app_filepath}'",
87
- "-o '#{ipa_filepath}'",
88
- "--embed '#{provision_path(provision_search_query)}'"
89
- ].join(' ')
90
- @thrust_executor.system_or_exit(package_command)
91
-
92
- @thrust_executor.system_or_exit("cd '#{build_configuration_directory}' && unzip '#{app_name}.ipa'")
93
- @thrust_executor.system_or_exit("/usr/bin/codesign --verify --force --preserve-metadata=identifier,entitlements --sign '#{signing_identity}' '#{build_configuration_directory}/Payload/#{app_name}.app'")
94
- @thrust_executor.system_or_exit("cd '#{build_configuration_directory}' && zip -qr '#{app_name}.ipa' 'Payload'")
95
-
96
- ipa_filepath
97
- end
98
-
99
- def verify_provision(app_name, provision_search_query)
100
- @out.puts 'Verifying provisioning profile...'
101
- embedded_filename = "#{build_configuration_directory}/#{app_name}.app/embedded.mobileprovision"
102
- correct_provision_filename = provision_path(provision_search_query)
103
-
104
- if !FileUtils.cmp(embedded_filename, correct_provision_filename)
105
- raise(ProvisioningProfileNotEmbedded, "Wrong mobile provision embedded by xcrun. Check your xcode provisioning profile settings.")
106
- end
107
- end
108
-
109
- def run_xcode(sdk = nil, scheme_or_target = nil, architecture = nil)
110
- architecture_flag = architecture ? "-arch #{architecture}" : nil
111
- target_flag = @workspace_name ? "-scheme \"#{scheme_or_target}\"" : "-target \"#{scheme_or_target}\""
112
- sdk_flag = sdk ? "-sdk #{sdk}" : nil
113
- configuration_build_dir = File.join(@build_directory, "#{@build_configuration}-#{sdk}").inspect
114
- configuration_build_dir_option = sdk != 'macosx' ? "CONFIGURATION_BUILD_DIR=#{configuration_build_dir}" : nil
115
-
116
- command = [
117
- 'set -o pipefail &&',
118
- 'xcodebuild',
119
- project_or_workspace_flag,
120
- architecture_flag,
121
- target_flag,
122
- "-configuration #{@build_configuration}",
123
- sdk_flag,
124
- "clean build",
125
- "SYMROOT=#{@build_directory.inspect}",
126
- configuration_build_dir_option,
127
- '2>&1',
128
- "| grep -v 'backing file'"
129
- ].compact.join(' ')
130
- output_file = output_file("#{@build_configuration}-build")
131
- begin
132
- @thrust_executor.system_or_exit(command, output_file)
133
- rescue Thrust::Executor::CommandFailed => e
134
- @out.write File.read(output_file)
135
- raise e
136
- end
137
- end
138
-
139
- def output_file(target)
140
- output_dir = if ENV['IS_CI_BOX']
141
- ENV['CC_BUILD_ARTIFACTS']
142
- else
143
- File.exists?(@build_directory) ? @build_directory : FileUtils.mkdir_p(@build_directory)
144
- end
145
-
146
- File.join(output_dir, "#{target}.output").tap { |file| @out.puts "Output: #{file}" }
147
- end
148
-
149
- def project_or_workspace_flag
150
- @workspace_name ? "-workspace #{@workspace_name}.xcworkspace" : "-project #{@project_name}.xcodeproj"
151
- end
152
- end
153
- end
154
- end