Class: IosToolchain::ProjectAnalyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/ios_toolchain/project_analyzer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_root) ⇒ ProjectAnalyzer

Returns a new instance of ProjectAnalyzer.



8
9
10
11
12
13
14
15
# File 'lib/ios_toolchain/project_analyzer.rb', line 8

def initialize(project_root)
  project_root_path = Pathname.new(project_root).realpath
  @project_root = project_root_path.to_s
  @absolute_project_path = find_project_path!
  @project_file_path = relative_from_root(@absolute_project_path)

  @project = Xcodeproj::Project.open(@absolute_project_path)
end

Instance Attribute Details

#project_file_pathObject (readonly)

Returns the value of attribute project_file_path.



6
7
8
# File 'lib/ios_toolchain/project_analyzer.rb', line 6

def project_file_path
  @project_file_path
end

#project_rootObject (readonly)

Returns the value of attribute project_root.



6
7
8
# File 'lib/ios_toolchain/project_analyzer.rb', line 6

def project_root
  @project_root
end

Instance Method Details

#app_targetsObject



29
30
31
32
33
# File 'lib/ios_toolchain/project_analyzer.rb', line 29

def app_targets
  project.targets.map(&:name).find_all do |name|
    !name.include?('Tests')
  end
end

#crashlytics_framework_pathObject



24
25
26
27
# File 'lib/ios_toolchain/project_analyzer.rb', line 24

def crashlytics_framework_path
  path = glob_excluding_carthage('**/Crashlytics.framework').first || return
  relative_from_root(path)
end

#default_schemeObject



17
18
19
# File 'lib/ios_toolchain/project_analyzer.rb', line 17

def default_scheme
  shared_schemes.find { |name| name == project_name }
end

#default_sdkObject



21
22
# File 'lib/ios_toolchain/project_analyzer.rb', line 21

def default_sdk
end

#test_targetsObject



35
36
37
38
39
# File 'lib/ios_toolchain/project_analyzer.rb', line 35

def test_targets
  project.targets.map(&:name).find_all do |name|
    name.include?('Tests') && !name.include?('UITests')
  end
end

#ui_test_targetsObject



41
42
43
44
45
# File 'lib/ios_toolchain/project_analyzer.rb', line 41

def ui_test_targets
  project.targets.map(&:name).find_all do |name|
    name.include?('UITests')
  end
end