ambient-xcode 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/plist_helper.rb DELETED
@@ -1,29 +0,0 @@
1
- require 'plist'
2
-
3
- class PlistHelper
4
- attr_reader :path
5
-
6
- def initialize(path)
7
- @path = path
8
- end
9
-
10
- def add_entry(key, value)
11
- plist_as_dictionary[key] = value
12
- puts "applying to plist: #{path} #{key}"
13
- save
14
- end
15
-
16
- private
17
-
18
- def plist_as_dictionary
19
- @plist_as_dictionary ||= Plist::parse_xml(path)
20
- end
21
-
22
- def to_plist
23
- plist_as_dictionary.to_plist
24
- end
25
-
26
- def save
27
- File.open(path, 'w') { |file| file.write(to_plist) }
28
- end
29
- end
@@ -1,112 +0,0 @@
1
- require 'xcodeproj'
2
-
3
- class ProjectHelper
4
- PROJECTS = Dir.glob('*.xcodeproj')
5
-
6
- def initialize
7
- @project = Xcodeproj::Project.open(PROJECTS.first)
8
- end
9
-
10
- def reset_project_to_defaults
11
- @project.build_configurations.each do |configuration|
12
- build_settings = configuration.build_settings
13
- build_settings.each { |k, _| build_settings.delete(k) }
14
- end
15
- end
16
-
17
- def reset_targets_to_defaults
18
- @project.targets.each do |target|
19
- @project.build_configurations.each do |configuration|
20
- build_settings = target.build_configuration_list.build_settings(configuration.to_s)
21
- build_settings.each { |k, _| build_settings.delete(k) }
22
- end
23
- end
24
- end
25
-
26
- def reset_capabilities_to_defaults
27
- @project.targets.each do |target|
28
- CapabilitiesHelper.new(@project, target).clear_capabilities
29
- end
30
- end
31
-
32
- def process_project_options(options)
33
- @project.build_configurations.each do |configuration|
34
- options.each do |key, value|
35
- configuration.build_settings[key] = value
36
- configuration.build_settings.delete(key) if value == nil
37
- end
38
- end
39
- end
40
-
41
- def process_shared_target_options(shared_target_options)
42
- @project.targets.each do |target|
43
- options = shared_target_options[target.to_s]
44
- if options
45
- @project.build_configurations.each do |configuration|
46
- target.build_configuration_list.build_settings(configuration.to_s).merge!(options)
47
- end
48
- end
49
- end
50
- end
51
-
52
- def process_target_options(target_options)
53
- @project.targets.each do |target|
54
- options = target_options[target.to_s]
55
- if options
56
- @project.build_configurations.each do |configuration|
57
- scheme_options = options[configuration.to_s]
58
- if scheme_options
59
- target.build_configuration_list.build_settings(configuration.to_s).merge!(scheme_options)
60
- end
61
- end
62
- end
63
- end
64
- end
65
-
66
- def process_capabilities(capabilities_hash)
67
- capabilities_hash.each do |target_name, capabilities|
68
- @project.targets.each do |target|
69
- if target_name == target.to_s
70
- helper = CapabilitiesHelper.new(@project, target)
71
- capabilities.each { |c| helper.enable_capability(c) }
72
- end
73
- end
74
- end
75
- end
76
-
77
- def process_scheme_options(options)
78
- @project.build_configurations.each do |configuration|
79
- scheme_options = options[configuration.to_s] || {}
80
- scheme_options.each do |key, value|
81
- configuration.build_settings[key] = value
82
- configuration.build_settings.delete(key) if value == nil
83
- end
84
- end
85
- end
86
-
87
- def process_development_teams(development_teams)
88
- development_teams.each do |target_name, development_team|
89
- @project.targets.each do |target|
90
- if target_name == target.to_s
91
- helper = CapabilitiesHelper.new(@project, target)
92
- helper.set_development_team(development_team)
93
- end
94
- end
95
- end
96
- end
97
-
98
- def print_info
99
- puts ""
100
- puts "Targets:"
101
- @project.targets.each { |t| puts "- #{t.to_s}" }
102
- puts ""
103
- puts "Build configurations:"
104
- @project.build_configurations.each { |c| puts "- #{c.to_s}" }
105
- puts ""
106
- end
107
-
108
- def save_changes
109
- @project.save
110
- end
111
-
112
- end