Class: Xcake::Xcode::SchemeList

Inherits:
Object
  • Object
show all
Defined in:
lib/xcake/xcode/scheme_list.rb

Overview

This class is used to represent a list of Schemes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ SchemeList

Returns a new instance of SchemeList.

Parameters:

  • project (Project)

    project to create scheme list for.



24
25
26
27
28
29
30
31
32
# File 'lib/xcake/xcode/scheme_list.rb', line 24

def initialize(project)
  @project = project
  @schemes = []

  @xcschememanagement = {
    'SchemeUserState' => {},
    'SuppressBuildableAutocreation' => {}
  }
end

Instance Attribute Details

#projectProject

Returns the project for the scheme list.

Returns:

  • (Project)

    the project for the scheme list



10
11
12
# File 'lib/xcake/xcode/scheme_list.rb', line 10

def project
  @project
end

#schemesArray<Scheme>

Returns the schemes in the list.

Returns:

  • (Array<Scheme>)

    the schemes in the list



14
15
16
# File 'lib/xcake/xcode/scheme_list.rb', line 14

def schemes
  @schemes
end

#xcschememanagementHash<String, Object>

Returns xcschememanagementfile contents.

Returns:

  • (Hash<String, Object>)

    xcschememanagementfile contents



19
20
21
# File 'lib/xcake/xcode/scheme_list.rb', line 19

def xcschememanagement
  @xcschememanagement
end

Instance Method Details

#saveObject

Writes scheme list data.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/xcake/xcode/scheme_list.rb', line 46

def save
  schemes_dir = Scheme.user_data_dir(@project.path)

  FileUtils.rm_rf(schemes_dir)
  FileUtils.mkdir_p(schemes_dir)

  schemes.each do |s|
    s.save_as(@project.path, s.name, true)

    @xcschememanagement['SchemeUserState']["#{s.name}.xcscheme_^#shared#^_"] = {
      'isShown' => true
    }
  end

  xcschememanagement_path = schemes_dir + 'xcschememanagement.plist'
  write_plist(xcschememanagement_path)
end

#supress_autocreation_of_target(target) ⇒ Object

Adds target to add instructions to tell xcode not to autocreate scheme for target

Parameters:

  • target (Target)

    target to supress autocreation for



40
41
42
# File 'lib/xcake/xcode/scheme_list.rb', line 40

def supress_autocreation_of_target(target)
  @xcschememanagement['SuppressBuildableAutocreation'][target.uuid] = { 'primary' => true }
end