Class: Frank::Cucumber::AppBundleLocator

Inherits:
Object
  • Object
show all
Defined in:
lib/frank-cucumber/app_bundle_locator.rb

Overview

utility class which will find all XCode4 projects which are using DerivedData to store their build output, and present information about those projects

Instance Method Summary collapse

Constructor Details

#initializeAppBundleLocator

Returns a new instance of AppBundleLocator.



28
29
30
# File 'lib/frank-cucumber/app_bundle_locator.rb', line 28

def initialize
  @projects = find_all_known_xcode_projects
end

Instance Method Details

#find_all_known_xcode_projectsObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/frank-cucumber/app_bundle_locator.rb', line 32

def find_all_known_xcode_projects
  require 'plist'

  projects = []
  Dir.glob( File.expand_path( "~/Library/Developer/Xcode/DerivedData/*/info.plist" ) ) do |plist_path|
    workspace_path = Plist::parse_xml(plist_path)['WorkspacePath']
    projects << XCode4Project.new( workspace_path, File.dirname(plist_path) )
  end
  projects
end

#guess_possible_app_bundles_for_dir(dir) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/frank-cucumber/app_bundle_locator.rb', line 43

def guess_possible_app_bundles_for_dir( dir )
  return [] if dir == '/'

  project = @projects.find do |project|
    project.workspace_dir == dir
  end

  if project.nil?
    return guess_possible_app_bundles_for_dir( File.dirname(dir) )
  end

  return project.available_app_bundles
end