Class: Fui::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/fui/project.rb

Overview

Represents an Xcode Project pbxproj file

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Project

Returns a new instance of Project.



10
11
12
13
# File 'lib/fui/project.rb', line 10

def initialize(path)
  @path = path
  @filename = File.basename(path)
end

Instance Attribute Details

#bridging_headerObject

Returns the value of attribute bridging_header.



4
5
6
# File 'lib/fui/project.rb', line 4

def bridging_header
  @bridging_header
end

#filenameObject

Returns the value of attribute filename.



4
5
6
# File 'lib/fui/project.rb', line 4

def filename
  @filename
end

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/fui/project.rb', line 4

def path
  @path
end

Class Method Details

.project?(path) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/fui/project.rb', line 6

def self.project?(path)
  File.extname(path) == '.pbxproj'
end

Instance Method Details

#bridging_headers(verbose) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 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