Sha256: ce76f778cbccc19a7eebc9304446b658422a2cb3f941e3aa55cd9b9440593b37

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

require 'xcodeproj'

module Xcake
  class XcodeprojContext
    include Context

    attr_accessor :project

    def create_object_for(dsl_object)
      case dsl_object
      when Project
        create_object_for_project(dsl_object)
      when Target
        create_object_for_target(dsl_object)
      when Configuration
        create_object_for_configuration(dsl_object)
      when Node
        create_object_for_node(dsl_object)
      else
        nil
      end
    end

    def create_object_for_project(project)
      # TODO: Make setup of project testable
      @project = Xcode::Project.new("./#{project.name}.xcodeproj", true)
      @project.setup_for_xcake
      @project
    end

    def create_object_for_target(target)
      @project.new_target(target)
    end

    def create_object_for_configuration(configuration)
      @project.new_configuration(configuration)
    end

    def create_object_for_node(node)
      @project.new_group(node)
    end

    def file_reference_for_path(path)
      @project.reference_for_path(path) || @project.new_file_reference(path)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
xcake-0.6.25 lib/xcake/context/xcodeproj_context.rb
xcake-0.6.24 lib/xcake/context/xcodeproj_context.rb
xcake-0.6.23 lib/xcake/context/xcodeproj_context.rb
xcake-0.6.22 lib/xcake/context/xcodeproj_context.rb
xcake-0.6.21 lib/xcake/context/xcodeproj_context.rb