8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/bean/xcodebuild.rb', line 8
def self.archive(config)
workspace = config.workspace
scheme = config.scheme
export_path = config.export_path
tmp_dir = Workspace::TMP_DIR
Dir.mkdir(tmp_dir) unless Dir.exist?(tmp_dir)
archive_path = File.expand_path("#{scheme}.xcarchive", tmp_dir)
archive_command = "xcodebuild -workspace #{workspace} -scheme #{scheme} clean archive -archivePath #{archive_path}"
begin_time = Time.now
return Workspace.clear unless system archive_command
return unless export_option_plist = config.export_options_plist
puts config
export_command = "xcodebuild -exportArchive -archivePath #{archive_path} -exportPath #{export_path} -exportOptionsPlist #{export_option_plist}"
return Workspace.clear unless system export_command
Workspace.clear
duration = (Time.now - begin_time) / 60
puts "🎉🎉🎉 Done. It takes you #{duration.to_i.to_s.yellow} min."
end
|