Module: Ambient
Constant Summary collapse
- ROOT =
File.('.', File.dirname(__FILE__))
Instance Method Summary collapse
- #configure(&block) ⇒ Object
- #load_in_parent_target_values ⇒ Object
- #process_project_options ⇒ Object
- #process_scheme_options ⇒ Object
- #process_shared_target_options ⇒ Object
- #process_target_options ⇒ Object
- #project_helper ⇒ Object
- #reset_project_to_defaults ⇒ Object
- #reset_targets_to_defaults ⇒ Object
- #set_option(option, value, target: nil, scheme: nil, parent: nil) ⇒ Object
- #set_parent_target(target, child, parent) ⇒ Object
- #setup_project ⇒ Object
Instance Method Details
#configure(&block) ⇒ Object
23 24 25 |
# File 'lib/ambient.rb', line 23 def configure(&block) instance_eval &block end |
#load_in_parent_target_values ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/ambient.rb', line 105 def load_in_parent_target_values @parents.each do |target, parents| parents.each do |child, parent| if parent = @target_options[target] = [child] = [parent] .merge!() { |_, child, _| child } end end end end |
#process_project_options ⇒ Object
84 85 86 87 |
# File 'lib/ambient.rb', line 84 def puts "applying ambient project settings" project_helper.(@project_options) end |
#process_scheme_options ⇒ Object
89 90 91 92 |
# File 'lib/ambient.rb', line 89 def puts "applying ambient scheme settings" project_helper.(@scheme_options) end |
#process_shared_target_options ⇒ Object
94 95 96 97 |
# File 'lib/ambient.rb', line 94 def puts "applying ambient shared target settings" project_helper.(@shared_target_options) end |
#process_target_options ⇒ Object
99 100 101 102 103 |
# File 'lib/ambient.rb', line 99 def puts "applying ambient target settings" load_in_parent_target_values project_helper.(@target_options) end |
#project_helper ⇒ Object
27 28 29 |
# File 'lib/ambient.rb', line 27 def project_helper @project_helper ||= ProjectHelper.new end |
#reset_project_to_defaults ⇒ Object
70 71 72 73 74 75 |
# File 'lib/ambient.rb', line 70 def reset_project_to_defaults if @use_defaults puts "resetting project settings to xcode default settings" project_helper.reset_project_to_defaults end end |
#reset_targets_to_defaults ⇒ Object
77 78 79 80 81 82 |
# File 'lib/ambient.rb', line 77 def reset_targets_to_defaults if @use_defaults puts "resetting target settings to xcode default settings" project_helper.reset_targets_to_defaults end end |
#set_option(option, value, target: nil, scheme: nil, parent: nil) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/ambient.rb', line 36 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_options[target] ||= {} @target_options[target][scheme] ||= {} @target_options[target][scheme][option] = value else @shared_target_options[target] ||= {} @shared_target_options[target][option] = value end else if scheme @scheme_options[scheme] ||= {} @scheme_options[scheme][option] = value else @project_options[option] = value end end end |
#set_parent_target(target, child, parent) ⇒ Object
31 32 33 34 |
# File 'lib/ambient.rb', line 31 def set_parent_target(target, child, parent) @parents[target] ||= {} @parents[target][child] = parent end |
#setup_project ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/ambient.rb', line 60 def setup_project project_helper.print_info reset_project_to_defaults reset_targets_to_defaults end |