Sha256: c85424d2882ca419eff899b535cc4ee6a52ffb330862a1dd1ec066bc11c02df6

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 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
        abort 'DSL Object not recognized!'
      end
    end

    def create_object_for_project(project)
      puts 'Creating 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)
      puts 'Creating Target...'
      @project.new_target(target)
    end

    def create_object_for_configuration(configuration)
      puts 'Creating Configuration...'
      @project.new_configuration(configuration)
    end

    def create_object_for_node(node)
      puts 'Creating Group...'
      @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

1 entries across 1 versions & 1 rubygems

Version Path
xcake-0.6.20 lib/xcake/context/xcodeproj_context.rb