class Pod::Target::Commands::Parser

Attributes

regex[R]
workspace[R]
workspace_dir[R]

Public Class Methods

new(workspace_path, filter) click to toggle source
# File lib/pod/target/commands/resolve/parser.rb, line 9
def initialize(workspace_path, filter)
    if workspace_path.nil?
        prompt = TTY::Prompt.new
        prompt.error("Error! Cannot find workspace path")
        exit 1
    end
    @workspace_dir = File.dirname(workspace_path)
    @workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
    @regex = filter
end

Public Instance Methods

all_targets() click to toggle source
# File lib/pod/target/commands/resolve/parser.rb, line 20
def all_targets
    @projects ||= projects
    projects.flat_map(&:targets).select { |target| target.name =~ /#{regex}/ }
end
projects() click to toggle source
# File lib/pod/target/commands/resolve/parser.rb, line 25
def projects
    all_project_paths = @workspace.file_references.map(&:path)
    all_project_paths.map do |project_path|
        Xcodeproj::Project.open(File.expand_path(project_path, @workspace_dir))
    end
end