class Fui::Project

Represents an Xcode Project pbxproj file

Attributes

bridging_header[RW]
filename[RW]
path[RW]

Public Class Methods

new(path) click to toggle source
# File lib/fui/project.rb, line 10
def initialize(path)
  @path = path
  @filename = File.basename(path)
end
project?(path) click to toggle source
# File lib/fui/project.rb, line 6
def self.project?(path)
  File.extname(path) == '.pbxproj'
end

Public Instance Methods

bridging_headers(verbose) click to toggle source
# File lib/fui/project.rb, line 15
def bridging_headers(verbose)
  @bridging_headers ||= begin
    regex = /(SWIFT_OBJC_BRIDGING_HEADER) = \".+\"/
    bridging_headers = []
    File.new(path).grep regex do |result|
      tokens = result.split('"')
      next if tokens.length < 2

      path_tokens = tokens[1].split('/')
      bridging_header = path_tokens[path_tokens.length - 1]
      puts "Bridging Header Found: #{bridging_header} in #{project_path}." if verbose
      bridging_headers << bridging_header
    end
    bridging_headers.uniq
  end
end