Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

Commit

Permalink
Fixing gem
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel committed Feb 13, 2015
1 parent a07f0d5 commit 01b155d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gem/ghunit.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "ghunit"
s.version = "1.0.3"
s.version = "1.0.5"
s.executables << "ghunit"
s.date = "2014-07-14"
s.summary = "GHUnit"
Expand Down
37 changes: 35 additions & 2 deletions Gem/lib/ghunit/project.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'xcodeproj'
require 'xcodeproj/ext'
require 'fileutils'
require 'logger'
require 'colorize'
Expand Down Expand Up @@ -153,7 +152,8 @@ def create_test_target
end

# Get main target prefix header
prefix_header = main_target.build_settings("Debug")["GCC_PREFIX_HEADER"]
debug_settings = main_target.build_settings("Debug")
prefix_header = debug_settings["GCC_PREFIX_HEADER"] if debug_settings

# Clear default OTHER_LDFLAGS (otherwise CocoaPods gives a warning)
test_target.build_configurations.each do |c|
Expand Down Expand Up @@ -277,6 +277,39 @@ def check_pod
EOS
end

def sync_test_target_membership
test_target = find_test_target
if !test_target
logger.error "No test target to add to"
return false
end

tests_group = project.groups.select { |g| g.name == test_target_name }.first
if !tests_group
logger.error "No test group to add to"
return false
end

sources_phase = main_target.build_phases.select { |p|
p.class == Xcodeproj::Project::Object::PBXSourcesBuildPhase }.first

if !sources_phase
logger.error "No main target source phase found"
return false
end

logger.debug "Adding to test target: "
sources_phase.files_references.each do |file_ref|
next if file_ref.path == "main.m"
test_file = tests_group.find_file_by_path(file_ref.path)
if !test_file
logger.debug " #{file_ref.path}"
test_target.add_file_references([file_ref])
end
end
project.save
end

def install_run_tests_script
run_script_name = "Run Tests (CLI)"
# Find run script build phase and install RunTests.sh
Expand Down

0 comments on commit 01b155d

Please sign in to comment.