Class: Pandan::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/pandan/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workspace_path, filter) ⇒ Parser

Returns a new instance of Parser.



9
10
11
12
13
14
# File 'lib/pandan/parser.rb', line 9

def initialize(workspace_path, filter)
  @workspace_dir = File.dirname(workspace_path)
  @workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
  @regex = filter
  @regex ||= '.*' # Match everything
end

Instance Attribute Details

#regexObject (readonly)

Returns the value of attribute regex.



7
8
9
# File 'lib/pandan/parser.rb', line 7

def regex
  @regex
end

#workspaceObject (readonly)

Returns the value of attribute workspace.



7
8
9
# File 'lib/pandan/parser.rb', line 7

def workspace
  @workspace
end

#workspace_dirObject (readonly)

Returns the value of attribute workspace_dir.



7
8
9
# File 'lib/pandan/parser.rb', line 7

def workspace_dir
  @workspace_dir
end

Instance Method Details

#all_targetsObject



16
17
18
19
# File 'lib/pandan/parser.rb', line 16

def all_targets
  @projects ||= projects
  projects.flat_map(&:targets).select { |target| target.name =~ /#{regex}/ }
end

#other_linker_flagsObject



21
22
23
24
25
26
27
28
# File 'lib/pandan/parser.rb', line 21

def other_linker_flags
  @projects ||= projects
  ld_flags_info = {}
  projects.flat_map(&:targets).each do |target|
    ld_flags_info[target] = target.resolved_build_setting('OTHER_LDFLAGS', true)
  end
  ld_flags_info
end