Module: Ambient
Constant Summary collapse
- ROOT =
File.('.', File.dirname(__FILE__))
Instance Method Summary collapse
- #configure(&block) ⇒ Object
- #load_in_parent_target_values ⇒ Object
- #process_capabilities ⇒ Object
- #process_development_teams ⇒ Object
- #process_project_options ⇒ Object
- #process_scheme_options ⇒ Object
- #process_shared_target_options ⇒ Object
- #process_target_options ⇒ Object
- #project_helper ⇒ Object
- #reset_capabilites_to_defaults ⇒ Object
- #reset_project_to_defaults ⇒ Object
- #reset_targets_to_defaults ⇒ Object
- #run_ambientfile(filename) ⇒ Object
- #set_capability(target_name, capability_name) ⇒ Object
- #set_development_team(target_name, team_name) ⇒ Object
- #set_option(option, value, target: nil, scheme: nil, parent: nil) ⇒ Object
- #set_parent_target(target, child, parent) ⇒ Object
- #setup_project(ambientfile) ⇒ Object
Instance Method Details
#configure(&block) ⇒ Object
26 27 28 |
# File 'lib/ambient.rb', line 26 def configure(&block) instance_eval &block end |
#load_in_parent_target_values ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/ambient.rb', line 133 def load_in_parent_target_values @parents.each do |target, parents| parents.each do |child, parent| if parent = [target] = [child] = [parent] .merge!() { |_, child, _| child } end end end end |
#process_capabilities ⇒ Object
123 124 125 126 |
# File 'lib/ambient.rb', line 123 def process_capabilities puts "applying ambient capabilities" project_helper.process_capabilities(@capabilities) end |
#process_development_teams ⇒ Object
128 129 130 131 |
# File 'lib/ambient.rb', line 128 def process_development_teams puts "applying ambient development teams" project_helper.process_development_teams(@development_teams) end |
#process_project_options ⇒ Object
102 103 104 105 |
# File 'lib/ambient.rb', line 102 def puts "applying ambient project settings" project_helper.() end |
#process_scheme_options ⇒ Object
107 108 109 110 |
# File 'lib/ambient.rb', line 107 def puts "applying ambient scheme settings" project_helper.() end |
#process_shared_target_options ⇒ Object
112 113 114 115 |
# File 'lib/ambient.rb', line 112 def puts "applying ambient shared target settings" project_helper.() end |
#process_target_options ⇒ Object
117 118 119 120 121 |
# File 'lib/ambient.rb', line 117 def puts "applying ambient target settings" load_in_parent_target_values project_helper.() end |
#project_helper ⇒ Object
30 31 32 |
# File 'lib/ambient.rb', line 30 def project_helper @project_helper ||= ProjectHelper.new end |
#reset_capabilites_to_defaults ⇒ Object
97 98 99 100 |
# File 'lib/ambient.rb', line 97 def reset_capabilites_to_defaults puts "resetting capabilities to xcode default settings" project_helper.reset_capabilities_to_defaults end |
#reset_project_to_defaults ⇒ Object
87 88 89 90 |
# File 'lib/ambient.rb', line 87 def reset_project_to_defaults puts "resetting project settings to xcode default settings" project_helper.reset_project_to_defaults end |
#reset_targets_to_defaults ⇒ Object
92 93 94 95 |
# File 'lib/ambient.rb', line 92 def reset_targets_to_defaults puts "resetting target settings to xcode default settings" project_helper.reset_targets_to_defaults end |
#run_ambientfile(filename) ⇒ Object
146 147 148 149 150 151 |
# File 'lib/ambient.rb', line 146 def run_ambientfile(filename) puts "Reading settings from #{filename}" ambient = File.join(Dir.pwd, filename) raise "#{filename} not found in current directory." unless File.exists?(ambient) load ambient end |
#set_capability(target_name, capability_name) ⇒ Object
63 64 65 66 |
# File 'lib/ambient.rb', line 63 def set_capability(target_name, capability_name) capabilities = @capabilities[target_name] ||= [] capabilities << capability_name end |
#set_development_team(target_name, team_name) ⇒ Object
68 69 70 |
# File 'lib/ambient.rb', line 68 def set_development_team(target_name, team_name) @development_teams[target_name] = team_name end |
#set_option(option, value, target: nil, scheme: nil, parent: nil) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ambient.rb', line 39 def set_option(option, value, target: nil, scheme: nil, parent: nil) value = "YES" if value == true value = "NO" if value == false value = nil if value == :default if target if scheme [target] ||= {} [target][scheme] ||= {} [target][scheme][option] = value else [target] ||= {} [target][option] = value end else if scheme [scheme] ||= {} [scheme][option] = value else [option] = value end end end |
#set_parent_target(target, child, parent) ⇒ Object
34 35 36 37 |
# File 'lib/ambient.rb', line 34 def set_parent_target(target, child, parent) @parents[target] ||= {} @parents[target][child] = parent end |
#setup_project(ambientfile) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/ambient.rb', line 72 def setup_project(ambientfile) run_ambientfile(ambientfile) project_helper.print_info reset_project_to_defaults if @use_defaults reset_targets_to_defaults if @use_defaults reset_capabilites_to_defaults if @use_defaults process_capabilities process_development_teams project_helper.save_changes end |