Sha256: 6c429632dc2db660ec208592dab29c16f29509637015b15b3e0fa541e6abe0c2

Contents?: true

Size: 1.44 KB

Versions: 82

Compression:

Stored size: 1.44 KB

Contents

module Frank module Cucumber
  class XCode4Project
    def initialize( workspace_path, derived_dir )
      @workspace_path, @derived_dir = workspace_path, derived_dir 
    end

    def derived_name
      File.basename( @derived_dir )
    end

    def project_name
      derived_name.split('-')[0]
    end

    def workspace_dir
      File.dirname( @workspace_path )
    end

    def available_app_bundles
      Dir.glob( File.join( @derived_dir, "Build", "Products", "*", "*.app" ) )
    end

  end

  # utility class which will find all XCode4 projects which are using DerivedData to store their
  # build output, and present information about those projects
  class AppBundleLocator
    def initialize
      @projects = find_all_known_xcode_projects
    end

    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

    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

  end
end end

Version data entries

82 entries across 82 versions & 4 rubygems

Version Path
sc-frank-ios-1.2.3 lib/frank-cucumber/app_bundle_locator.rb
frank-cucumber-1.2.5 lib/frank-cucumber/app_bundle_locator.rb
frank-cucumber-1.2.4.pre1 lib/frank-cucumber/app_bundle_locator.rb
frank-pivotal-1.3.0.pre.2 lib/frank-pivotal/app_bundle_locator.rb
sc-frank-cucumber-1.2.1.bba52d7.debug lib/frank-cucumber/app_bundle_locator.rb
sc-frank-cucumber-1.2.1.e1e3ccb.debug lib/frank-cucumber/app_bundle_locator.rb
sc-frank-cucumber-1.2.1.1a856ca.debug lib/frank-cucumber/app_bundle_locator.rb
frank-pivotal-1.3.0.pre.1 lib/frank-pivotal/app_bundle_locator.rb
frank-pivotal-1.2.4 lib/frank-pivotal/app_bundle_locator.rb
frank-pivotal-1.2.3.pre.2 lib/frank-pivotal/app_bundle_locator.rb
frank-pivotal-1.2.3.pre.1 lib/frank-pivotal/app_bundle_locator.rb
frank-pivotal-1.2.3 lib/frank-pivotal/app_bundle_locator.rb
sc-frank-cucumber-1.2.1.b7791c5.debug lib/frank-cucumber/app_bundle_locator.rb
frank-cucumber-1.2.3 lib/frank-cucumber/app_bundle_locator.rb
sc-frank-cucumber-1.2.1.3256dc1.debug lib/frank-cucumber/app_bundle_locator.rb
sc-frank-cucumber-1.2.1.9c95c03.debug lib/frank-cucumber/app_bundle_locator.rb
sc-frank-cucumber-1.2.1.1dcc760.debug lib/frank-cucumber/app_bundle_locator.rb
frank-cucumber-1.2.2 lib/frank-cucumber/app_bundle_locator.rb
sc-frank-cucumber-1.2.1.1dcc760 lib/frank-cucumber/app_bundle_locator.rb
frank-cucumber-1.2.1 lib/frank-cucumber/app_bundle_locator.rb