module CocoapodsUnitTest
Constants
- VERSION
Public Class Methods
modify_build_settings(target, is_target)
click to toggle source
# File lib/cocoapods_plugin.rb, line 13 def self.modify_build_settings(target, is_target) target.build_configurations.each {|config| config.coverage_build_settings = is_target} if is_target target.add_coverage_script_phase() end end
modify_schemes_settings(xcproj, test_specs)
click to toggle source
# File lib/cocoapods_plugin.rb, line 20 def self.modify_schemes_settings(xcproj, test_specs) project_path = xcproj.path test_targets = xcproj.targets.select { |target| test_specs.include?(target.name.to_s) } Dir[File.join(project_path, 'xcuserdata', '**', 'xcschemes', '*.xcscheme')].select { |e| !test_targets.select { |target| File.basename(e, '.xcscheme').start_with?("#{target.name.to_s}-Unit") }.empty? }.each do |path| scheme = File.basename(path, '.xcscheme') puts "Check scheme: #{scheme}" scheme_targets = test_targets.select { |e| scheme.include?(e.name.to_s) } unless scheme_targets.empty? puts "Test scheme: #{scheme} with targets: " + scheme_targets.map { |e| e.name.to_s }.join(",") xcproj_scheme = Xcodeproj::XCScheme.new(file_path = path) testAction = xcproj_scheme.test_action testAction.code_coverage_enabled = true testAction.coverage_specified_targets = true scheme_targets.each { |e| testAction.add_coverage_target(e) } # xcproj_scheme.save! File.delete(path) xcproj_scheme.save_as(project_path, scheme) else File.delete(path) end end end