Class: Xcake::Xcode::SchemeList
- Inherits:
-
Object
- Object
- Xcake::Xcode::SchemeList
- Defined in:
- lib/xcake/xcode/scheme_list.rb
Overview
This class is used to represent a list of Schemes.
Instance Attribute Summary collapse
-
#project ⇒ Project
The project for the scheme list.
-
#schemes ⇒ Array<Scheme>
The schemes in the list.
-
#xcschememanagement ⇒ Hash<String, Object>
Xcschememanagementfile contents.
Instance Method Summary collapse
-
#initialize(project) ⇒ SchemeList
constructor
A new instance of SchemeList.
-
#save ⇒ Object
Writes scheme list data.
-
#supress_autocreation_of_target(target) ⇒ Object
Adds target to add instructions to tell xcode not to autocreate scheme for target.
-
#write_plist(xcschememanagement_path) ⇒ Object
private
Constructor Details
#initialize(project) ⇒ SchemeList
Returns a new instance of SchemeList.
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
#project ⇒ Project
Returns the project for the scheme list.
10 11 12 |
# File 'lib/xcake/xcode/scheme_list.rb', line 10 def project @project end |
#schemes ⇒ Array<Scheme>
Returns the schemes in the list.
14 15 16 |
# File 'lib/xcake/xcode/scheme_list.rb', line 14 def schemes @schemes end |
#xcschememanagement ⇒ Hash<String, Object>
Returns xcschememanagementfile contents.
19 20 21 |
# File 'lib/xcake/xcode/scheme_list.rb', line 19 def xcschememanagement @xcschememanagement end |
Instance Method Details
#save ⇒ Object
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
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 |
#write_plist(xcschememanagement_path) ⇒ Object (private)
66 67 68 69 70 71 72 |
# File 'lib/xcake/xcode/scheme_list.rb', line 66 def write_plist(xcschememanagement_path) if Xcake.modern_xcodeproj? Xcodeproj::Plist.write_to_path(@xcschememanagement, xcschememanagement_path) else Xcodeproj.write_plist(@xcschememanagement, xcschememanagement_path) end end |