Skip to content

Instantly share code, notes, and snippets.

@alanzeino
Created May 6, 2016 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanzeino/59ded726c0713c6ceebdde94fc8f7829 to your computer and use it in GitHub Desktop.
Save alanzeino/59ded726c0713c6ceebdde94fc8f7829 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'yaml'
def find_value_for_key(yaml_file, key)
yaml_file.each do |yaml_key, yaml_value|
if key == yaml_key
return yaml_value
end
end
return nil
end
if ARGV.length != 2
puts "Usage: #{$PROGRAM_NAME} derived_data_path configuration_build_directory"
exit 1
end
slather_file = '.slather.yml'
# Open the slather yaml
slather_yml = YAML.load_file(File.join(Dir.pwd, slather_file))
# Get the scheme name
scheme_name = find_value_for_key(slather_yml, 'scheme')
if scheme_name == nil
puts "Couldn't find scheme in #{slather_file}"
end
# Find the Scheme app in build_path
derived_data_path = ARGV[0]
build_path = ARGV[1]
app_scheme_path = File.join(build_path, "#{scheme_name}.framework/", scheme_name)
puts "Running slather with app scheme path: #{app_scheme_path}"
system('slather', 'coverage', '--input-format', 'profdata', '-s', '--build-directory', derived_data_path, '--binary-file', app_scheme_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment