Class: Ambient::ProjectHelper
- Inherits:
-
Object
- Object
- Ambient::ProjectHelper
- Defined in:
- lib/ambient/project_helper.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path) ⇒ ProjectHelper
constructor
A new instance of ProjectHelper.
- #print_info ⇒ Object
- #process_capabilities(capabilities_hash) ⇒ Object
- #process_development_teams(development_teams) ⇒ Object
- #process_project_options(options) ⇒ Object
- #process_scheme_options(options) ⇒ Object
- #process_shared_target_options(shared_target_options) ⇒ Object
- #process_target_options(target_options) ⇒ Object
- #reset_capabilities_to_defaults ⇒ Object
- #reset_project_to_defaults ⇒ Object
- #reset_targets_to_defaults ⇒ Object
- #save_changes ⇒ Object
Constructor Details
#initialize(path) ⇒ ProjectHelper
Returns a new instance of ProjectHelper.
5 6 7 8 9 |
# File 'lib/ambient/project_helper.rb', line 5 def initialize(path) @path = path projects = Dir.glob(path + '/*.xcodeproj') @project = Xcodeproj::Project.open(projects.first) end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/ambient/project_helper.rb', line 3 def path @path end |
Instance Method Details
#print_info ⇒ Object
99 100 101 102 103 104 105 106 107 |
# File 'lib/ambient/project_helper.rb', line 99 def print_info puts "" puts "Targets:" @project.targets.each { |t| puts "- #{t.to_s}" } puts "" puts "Build configurations:" @project.build_configurations.each { |c| puts "- #{c.to_s}" } puts "" end |
#process_capabilities(capabilities_hash) ⇒ Object
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/ambient/project_helper.rb', line 67 def process_capabilities(capabilities_hash) capabilities_hash.each do |target_name, capabilities| @project.targets.each do |target| if target_name == target.to_s helper = CapabilitiesHelper.new(@project, target) capabilities.each { |c| helper.enable_capability(c) } end end end end |
#process_development_teams(development_teams) ⇒ Object
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/ambient/project_helper.rb', line 88 def process_development_teams(development_teams) development_teams.each do |target_name, development_team| @project.targets.each do |target| if target_name == target.to_s helper = CapabilitiesHelper.new(@project, target) helper.set_development_team(development_team) end end end end |
#process_project_options(options) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/ambient/project_helper.rb', line 33 def () @project.build_configurations.each do |configuration| .each do |key, value| configuration.build_settings[key] = value configuration.build_settings.delete(key) if value == nil end end end |
#process_scheme_options(options) ⇒ Object
78 79 80 81 82 83 84 85 86 |
# File 'lib/ambient/project_helper.rb', line 78 def () @project.build_configurations.each do |configuration| = [configuration.to_s] || {} .each do |key, value| configuration.build_settings[key] = value configuration.build_settings.delete(key) if value == nil end end end |
#process_shared_target_options(shared_target_options) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ambient/project_helper.rb', line 42 def () @project.targets.each do |target| = [target.to_s] if @project.build_configurations.each do |configuration| target.build_configuration_list.build_settings(configuration.to_s).merge!() end end end end |
#process_target_options(target_options) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ambient/project_helper.rb', line 53 def () @project.targets.each do |target| = [target.to_s] if @project.build_configurations.each do |configuration| = [configuration.to_s] if target.build_configuration_list.build_settings(configuration.to_s).merge!() end end end end end |
#reset_capabilities_to_defaults ⇒ Object
27 28 29 30 31 |
# File 'lib/ambient/project_helper.rb', line 27 def reset_capabilities_to_defaults @project.targets.each do |target| CapabilitiesHelper.new(@project, target).clear_capabilities end end |
#reset_project_to_defaults ⇒ Object
11 12 13 14 15 16 |
# File 'lib/ambient/project_helper.rb', line 11 def reset_project_to_defaults @project.build_configurations.each do |configuration| build_settings = configuration.build_settings build_settings.each { |k, _| build_settings.delete(k) } end end |
#reset_targets_to_defaults ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/ambient/project_helper.rb', line 18 def reset_targets_to_defaults @project.targets.each do |target| @project.build_configurations.each do |configuration| build_settings = target.build_configuration_list.build_settings(configuration.to_s) build_settings.each { |k, _| build_settings.delete(k) } end end end |
#save_changes ⇒ Object
109 110 111 |
# File 'lib/ambient/project_helper.rb', line 109 def save_changes @project.save end |