Class: Objc::Test::XcodeProject

Inherits:
Object
  • Object
show all
Defined in:
lib/objc/xcode_project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runner) ⇒ XcodeProject

Returns a new instance of XcodeProject.



6
7
8
# File 'lib/objc/xcode_project.rb', line 6

def initialize(runner)
  @runner = runner
end

Instance Attribute Details

#runnerObject (readonly)

Returns the value of attribute runner.



4
5
6
# File 'lib/objc/xcode_project.rb', line 4

def runner
  @runner
end

Instance Method Details

#add(files) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/objc/xcode_project.rb', line 16

def add(files)
  project = Xcode.project(project_path)

  puts "Loading files into #{project} at #{project_path}"

  target = project.target(target_name)
  test_group = project.group(group_name)

  source_files_in_project = files.data.map do |path_data|
    test_group.create_file path_data
  end

  files_required_to_be_built = source_files_in_project.reject do |file|
    file.name.end_with?("h")
  end

  target.sources_build_phase do
    files_required_to_be_built.each do |source_file|
      add_build_file source_file
    end
  end

  project.save!
end

#execute!Object



42
43
44
45
# File 'lib/objc/xcode_project.rb', line 42

def execute!
  pid = spawn xctool_command
  Process.wait
end

#install!Object



10
11
12
13
# File 'lib/objc/xcode_project.rb', line 10

def install!
  clean
  extract
end