Sha256: 92af76e8858747e89e3272e72856dbdb0f3d0644a4bd934f6fafe99e23eaf400

Contents?: true

Size: 1.1 KB

Versions: 21

Compression:

Stored size: 1.1 KB

Contents

require 'nokogiri'

module Xcode
  
  # Schemes are an XML file that describe build, test, launch and profile actions
  # For the purposes of Xcoder, we want to be able to build and test
  # The scheme's build action only describes a target, so we need to look at launch for the config
  class Scheme
    attr_reader :project, :path, :name, :launch, :test
    def initialize(project, path)
      @project = project
      @path = File.expand_path(path)
      @name = File.basename(path).gsub(/\.xcscheme$/,'')
      doc = Nokogiri::XML(open(@path))
      
      @launch = parse_action(doc, 'launch')
      @test = parse_action(doc, 'test')
    end
    
    def builder
      Xcode::Builder.new(self)
    end
    
    private 
    
    def parse_action(doc, action_name)
      action = doc.xpath("//#{action_name.capitalize}Action").first
      buildableReference = action.xpath('BuildableProductRunnable/BuildableReference').first
      return nil if buildableReference.nil?
      
      target_name = buildableReference['BlueprintName']
      @project.target(target_name).config(action['buildConfiguration'])
    end

  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
xcoder-0.1.12 lib/xcode/scheme.rb
xcoder-0.1.11 lib/xcode/scheme.rb
xcoder-0.1.10 lib/xcode/scheme.rb
xcoder-0.1.9 lib/xcode/scheme.rb
xcoder-0.1.8 lib/xcode/scheme.rb
xcoder-0.1.7 lib/xcode/scheme.rb
xcoder-0.1.6 lib/xcode/scheme.rb
xcoder-0.1.4 lib/xcode/scheme.rb
xcoder-0.1.3 lib/xcode/scheme.rb
xcoder-0.1.2 lib/xcode/scheme.rb
xcoder-0.1.0 lib/xcode/scheme.rb
xcoder-0.0.21 lib/xcode/scheme.rb
xcoder-0.0.20 lib/xcode/scheme.rb
xcoder-0.0.19 lib/xcode/scheme.rb
xcoder-0.0.18 lib/xcode/scheme.rb
xcoder-0.0.17 lib/xcode/scheme.rb
xcoder-0.0.16 lib/xcode/scheme.rb
xcoder-0.0.15 lib/xcode/scheme.rb
xcoder-0.0.14 lib/xcode/scheme.rb
xcoder-0.0.12 lib/xcode/scheme.rb