Sha256: 8634f32fb2a7cb01fde7d692487271cd98af1c7c4669823264973df792a7f23a

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

#!/usr/bin/env ruby
# coding: utf-8
# ----------------------------------------------------------------------------
#
# $1 -> configuration environment (dev or jenkins)
# $2 -> device type. Builds for 'simulator' or 'device'
#
#
# REMEMBER to fill the configuration file build_app.yml

require 'fileutils'
require 'yaml'

# When running on CI
# It is a good pratice to run pod install when executing this script
# on the CI to avoid building problems
# %x(pod install)

# Parsing the yaml configuration file
config = YAML.load_file(File.join(File.dirname(__FILE__), 'build_app.yml'))

if ARGV.length < 2
  puts 'Error: Wrong number of arguments!'
  puts 'Usage: build_app.rb environment device_type'
  puts "Available Environments: #{config.keys.join(', ')}"
  puts "Device type: 'simulator' or 'device'"
  exit 1
end

puts "Starting at #{Time.now.strftime('%H:%M:%S')}"

if config[ARGV[0]].nil?
  puts 'Error: Wrong configuration environment!'
  puts "Available Environments: #{config.keys}"
  exit 1
else
  config = config[ARGV[0]]
end

export_path = File.join(config['export_path'], ARGV[1])

# Creating the folder where the .app will be stored
FileUtils.mkdir_p export_path

puts 'Building project'

system <<eos
  xcodebuild -workspace "#{config['xcworkspace']}" \
  -scheme "#{config['scheme']}" -sdk "#{config["sdk_#{ARGV[1]}"]}" \
  -configuration "#{config['configuration']}" clean build \
  CONFIGURATION_BUILD_DIR="#{export_path}"
eos

puts "APP_BUNDLE_PATH=#{File.join(export_path, config['scheme'])}.app"

puts "End: #{Time.now.strftime('%H:%M:%S')}"
puts 'Bye!'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cs-bdd-0.1.3 lib/skeleton/config/scripts/ios/build_app.rb