Class: PodBuilder::Configuration
- Inherits:
-
Object
- Object
- PodBuilder::Configuration
- Defined in:
- lib/pod_builder/configuration.rb
Constant Summary collapse
- DEFAULT_SPEC_OVERRIDE =
{ "Google-Mobile-Ads-SDK" => { "module_name": "GoogleMobileAds" } }.freeze
- DEFAULT_SKIP_PODS =
["GoogleMaps"]
- DEFAULT_FORCE_PREBUILD_PODS =
["Firebase", "GoogleTagManager"]
Class Attribute Summary collapse
-
.allow_building_development_pods ⇒ Object
Returns the value of attribute allow_building_development_pods.
-
.base_path ⇒ Object
Returns the value of attribute base_path.
-
.build_base_path ⇒ Object
Returns the value of attribute build_base_path.
-
.build_path ⇒ Object
Returns the value of attribute build_path.
-
.build_settings ⇒ Object
Returns the value of attribute build_settings.
-
.build_settings_overrides ⇒ Object
Returns the value of attribute build_settings_overrides.
-
.build_system ⇒ Object
Returns the value of attribute build_system.
-
.configuration_filename ⇒ Object
Returns the value of attribute configuration_filename.
-
.dev_pods_configuration_filename ⇒ Object
Returns the value of attribute dev_pods_configuration_filename.
-
.development_pods_paths ⇒ Object
Returns the value of attribute development_pods_paths.
-
.force_prebuild_pods ⇒ Object
Returns the value of attribute force_prebuild_pods.
-
.framework_plist_filename ⇒ Object
Returns the value of attribute framework_plist_filename.
-
.lfs_include_pods_folder ⇒ Object
Returns the value of attribute lfs_include_pods_folder.
-
.lfs_min_file_size ⇒ Object
Returns the value of attribute lfs_min_file_size.
-
.lfs_update_gitattributes ⇒ Object
Returns the value of attribute lfs_update_gitattributes.
-
.license_filename ⇒ Object
Returns the value of attribute license_filename.
-
.lock_filename ⇒ Object
Returns the value of attribute lock_filename.
-
.project_name ⇒ Object
Returns the value of attribute project_name.
-
.restore_enabled ⇒ Object
Returns the value of attribute restore_enabled.
-
.skip_licenses ⇒ Object
Returns the value of attribute skip_licenses.
-
.skip_pods ⇒ Object
Returns the value of attribute skip_pods.
-
.spec_overrides ⇒ Object
Returns the value of attribute spec_overrides.
-
.subspecs_to_split ⇒ Object
Returns the value of attribute subspecs_to_split.
Class Method Summary collapse
Class Attribute Details
.allow_building_development_pods ⇒ Object
Returns the value of attribute allow_building_development_pods.
27 28 29 |
# File 'lib/pod_builder/configuration.rb', line 27 def allow_building_development_pods @allow_building_development_pods end |
.base_path ⇒ Object
Returns the value of attribute base_path.
31 32 33 |
# File 'lib/pod_builder/configuration.rb', line 31 def base_path @base_path end |
.build_base_path ⇒ Object
Returns the value of attribute build_base_path.
39 40 41 |
# File 'lib/pod_builder/configuration.rb', line 39 def build_base_path @build_base_path end |
.build_path ⇒ Object
Returns the value of attribute build_path.
40 41 42 |
# File 'lib/pod_builder/configuration.rb', line 40 def build_path @build_path end |
.build_settings ⇒ Object
Returns the value of attribute build_settings.
28 29 30 |
# File 'lib/pod_builder/configuration.rb', line 28 def build_settings @build_settings end |
.build_settings_overrides ⇒ Object
Returns the value of attribute build_settings_overrides.
29 30 31 |
# File 'lib/pod_builder/configuration.rb', line 29 def build_settings_overrides @build_settings_overrides end |
.build_system ⇒ Object
Returns the value of attribute build_system.
30 31 32 |
# File 'lib/pod_builder/configuration.rb', line 30 def build_system @build_system end |
.configuration_filename ⇒ Object
Returns the value of attribute configuration_filename.
41 42 43 |
# File 'lib/pod_builder/configuration.rb', line 41 def configuration_filename @configuration_filename end |
.dev_pods_configuration_filename ⇒ Object
Returns the value of attribute dev_pods_configuration_filename.
42 43 44 |
# File 'lib/pod_builder/configuration.rb', line 42 def dev_pods_configuration_filename @dev_pods_configuration_filename end |
.development_pods_paths ⇒ Object
Returns the value of attribute development_pods_paths.
38 39 40 |
# File 'lib/pod_builder/configuration.rb', line 38 def development_pods_paths @development_pods_paths end |
.force_prebuild_pods ⇒ Object
Returns the value of attribute force_prebuild_pods.
35 36 37 |
# File 'lib/pod_builder/configuration.rb', line 35 def force_prebuild_pods @force_prebuild_pods end |
.framework_plist_filename ⇒ Object
Returns the value of attribute framework_plist_filename.
48 49 50 |
# File 'lib/pod_builder/configuration.rb', line 48 def framework_plist_filename @framework_plist_filename end |
.lfs_include_pods_folder ⇒ Object
Returns the value of attribute lfs_include_pods_folder.
45 46 47 |
# File 'lib/pod_builder/configuration.rb', line 45 def lfs_include_pods_folder @lfs_include_pods_folder end |
.lfs_min_file_size ⇒ Object
Returns the value of attribute lfs_min_file_size.
43 44 45 |
# File 'lib/pod_builder/configuration.rb', line 43 def lfs_min_file_size @lfs_min_file_size end |
.lfs_update_gitattributes ⇒ Object
Returns the value of attribute lfs_update_gitattributes.
44 45 46 |
# File 'lib/pod_builder/configuration.rb', line 44 def lfs_update_gitattributes @lfs_update_gitattributes end |
.license_filename ⇒ Object
Returns the value of attribute license_filename.
36 37 38 |
# File 'lib/pod_builder/configuration.rb', line 36 def license_filename @license_filename end |
.lock_filename ⇒ Object
Returns the value of attribute lock_filename.
49 50 51 |
# File 'lib/pod_builder/configuration.rb', line 49 def lock_filename @lock_filename end |
.project_name ⇒ Object
Returns the value of attribute project_name.
46 47 48 |
# File 'lib/pod_builder/configuration.rb', line 46 def project_name @project_name end |
.restore_enabled ⇒ Object
Returns the value of attribute restore_enabled.
47 48 49 |
# File 'lib/pod_builder/configuration.rb', line 47 def restore_enabled @restore_enabled end |
.skip_licenses ⇒ Object
Returns the value of attribute skip_licenses.
33 34 35 |
# File 'lib/pod_builder/configuration.rb', line 33 def skip_licenses @skip_licenses end |
.skip_pods ⇒ Object
Returns the value of attribute skip_pods.
34 35 36 |
# File 'lib/pod_builder/configuration.rb', line 34 def skip_pods @skip_pods end |
.spec_overrides ⇒ Object
Returns the value of attribute spec_overrides.
32 33 34 |
# File 'lib/pod_builder/configuration.rb', line 32 def spec_overrides @spec_overrides end |
.subspecs_to_split ⇒ Object
Returns the value of attribute subspecs_to_split.
37 38 39 |
# File 'lib/pod_builder/configuration.rb', line 37 def subspecs_to_split @subspecs_to_split end |
Class Method Details
.check_inited ⇒ Object
76 77 78 |
# File 'lib/pod_builder/configuration.rb', line 76 def self.check_inited raise "\n\nNot inited, run `pod_builder init`\n".red if podbuilder_path.nil? end |
.exists ⇒ Object
80 81 82 |
# File 'lib/pod_builder/configuration.rb', line 80 def self.exists return !config_path.nil? && File.exist?(config_path) end |
.load ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/pod_builder/configuration.rb', line 84 def self.load unless podbuilder_path return end Configuration.base_path = podbuilder_path if exists begin json = JSON.parse(File.read(config_path)) rescue => exception raise "\n\n#{File.basename(config_path)} is an invalid JSON\n".red end if value = json["spec_overrides"] if value.is_a?(Hash) && value.keys.count > 0 Configuration.spec_overrides = value end end if value = json["skip_licenses"] if value.is_a?(Array) && value.count > 0 Configuration.skip_licenses = value end end if value = json["skip_pods"] if value.is_a?(Array) && value.count > 0 Configuration.skip_pods = value end end if value = json["force_prebuild_pods"] if value.is_a?(Array) && value.count > 0 Configuration.force_prebuild_pods = value end end if value = json["build_settings"] if value.is_a?(Hash) && value.keys.count > 0 Configuration.build_settings = value end end if value = json["build_settings_overrides"] if value.is_a?(Hash) && value.keys.count > 0 Configuration.build_settings_overrides = value end end if value = json["build_system"] if value.is_a?(String) && ["Latest", "Legacy"].include?(value) Configuration.build_system = value end end if value = json["license_filename"] if value.is_a?(String) && value.length > 0 Configuration.license_filename = value end end if value = json["subspecs_to_split"] if value.is_a?(Array) && value.count > 0 Configuration.subspecs_to_split = value end end if value = json["lfs_update_gitattributes"] if [TrueClass, FalseClass].include?(value.class) Configuration.lfs_update_gitattributes = value end end if value = json["lfs_include_pods_folder"] if [TrueClass, FalseClass].include?(value.class) Configuration.lfs_include_pods_folder = value end end if value = json["project_name"] if value.is_a?(String) && value.length > 0 Configuration.project_name = value end end if value = json["restore_enabled"] if [TrueClass, FalseClass].include?(value.class) Configuration.restore_enabled = value end end if value = json["allow_building_development_pods"] if [TrueClass, FalseClass].include?(value.class) Configuration.allow_building_development_pods = value end end Configuration.build_settings.freeze else write end dev_pods_configuration_path = File.join(Configuration.base_path, Configuration.dev_pods_configuration_filename) if File.exist?(dev_pods_configuration_path) begin json = JSON.parse(File.read(dev_pods_configuration_path)) rescue => exception raise "\n\n#{File.basename(dev_pods_configuration_path)} is an invalid JSON\n".red end Configuration.development_pods_paths = json || [] Configuration.development_pods_paths.freeze end end |
.write ⇒ Object
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/pod_builder/configuration.rb', line 188 def self.write config = {} config["project_name"] = Configuration.project_name config["spec_overrides"] = Configuration.spec_overrides config["skip_licenses"] = Configuration.skip_licenses config["skip_pods"] = Configuration.skip_pods config["force_prebuild_pods"] = Configuration.force_prebuild_pods config["build_settings"] = Configuration.build_settings config["build_settings_overrides"] = Configuration.build_settings_overrides config["build_system"] = Configuration.build_system config["license_filename"] = Configuration.license_filename config["subspecs_to_split"] = Configuration.subspecs_to_split config["lfs_update_gitattributes"] = Configuration.lfs_update_gitattributes config["lfs_include_pods_folder"] = Configuration.lfs_include_pods_folder File.write(config_path, JSON.pretty_generate(config)) end |