Class: Referee::Project
- Inherits:
-
Xcodeproj::Project
- Object
- Xcodeproj::Project
- Referee::Project
- Defined in:
- lib/referee/project.rb
Overview
Helper subclass of ‘Xcode::Project`. Provides accessors into resources, etc.
Constant Summary collapse
- STORYBOARD_FILETYPE =
'file.storyboard'- VIEW_CONTROLLER_TAGS =
%w(viewController tableViewController navigationController glkViewController pageViewController collectionViewController splitViewController avPlayerViewController tabBarController)- DEFAULT_VIEW_CONTROLLER_TYPES =
%w( UIViewController UITableViewController UINavigationController GLKViewController UIPageViewController UICollectionViewController UISplitViewController AVPlayerViewController UITabBarController )- VIEW_CONTROLLER_TYPE_MAP =
Hash[VIEW_CONTROLLER_TAGS.zip(DEFAULT_VIEW_CONTROLLER_TYPES)]
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#resources ⇒ Object
Returns the value of attribute resources.
Class Method Summary collapse
-
.new_with_config(config) ⇒ Object
Instantiate a new ‘Project` instance given a `Configuration`.
Instance Method Summary collapse
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
30 31 32 |
# File 'lib/referee/project.rb', line 30 def config @config end |
#resources ⇒ Object
Returns the value of attribute resources.
30 31 32 |
# File 'lib/referee/project.rb', line 30 def resources @resources end |
Class Method Details
.new_with_config(config) ⇒ Object
Instantiate a new ‘Project` instance given a `Configuration`.
33 34 35 36 37 38 39 |
# File 'lib/referee/project.rb', line 33 def self.new_with_config(config) project = new(config.project) project.initialize_from_file project.config = config project.parse_project project end |
Instance Method Details
#parse_project ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/referee/project.rb', line 41 def parse_project @resources = [] find_storyboards.each do |storyboard| # Parse out XML representation. xml = storyboard_xml(storyboard) table_cells = table_cells(xml) collection_cells = collection_cells(xml) view_controllers = view_controllers(xml) non_empty_view_controllers = view_controllers.compact.uniq segues = segues(xml) # Add to resources collection group = ResourceGroup.new(storyboard, table_cells, collection_cells, non_empty_view_controllers, segues, @config) @resources << group # Check for missing view controller IDs in this storyboard. if non_empty_view_controllers.count != view_controllers.count msg = "Missing view controller ID(s) in '#{group.storyboard_name}' storyboard!" if @config.error_on_missing_storyboard_ids build_output.die msg else build_output.warn msg end end end end |