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
Class Attribute Summary collapse
-
.base_path ⇒ Object
Returns the value of attribute 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.
-
.lfs_min_file_size ⇒ Object
Returns the value of attribute lfs_min_file_size.
-
.license_filename ⇒ Object
Returns the value of attribute license_filename.
-
.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.
-
.update_lfs_gitattributes ⇒ Object
Returns the value of attribute update_lfs_gitattributes.
Class Method Summary collapse
- .check_inited ⇒ Object
- .config_path ⇒ Object
- .exists ⇒ Object
- .load ⇒ Object
- .podbuilder_path ⇒ Object
- .write ⇒ Object
Class Attribute Details
.base_path ⇒ Object
Returns the value of attribute base_path.
28 29 30 |
# File 'lib/pod_builder/configuration.rb', line 28 def base_path @base_path end |
.build_path ⇒ Object
Returns the value of attribute build_path.
35 36 37 |
# File 'lib/pod_builder/configuration.rb', line 35 def build_path @build_path end |
.build_settings ⇒ Object
Returns the value of attribute build_settings.
25 26 27 |
# File 'lib/pod_builder/configuration.rb', line 25 def build_settings @build_settings end |
.build_settings_overrides ⇒ Object
Returns the value of attribute build_settings_overrides.
26 27 28 |
# File 'lib/pod_builder/configuration.rb', line 26 def build_settings_overrides @build_settings_overrides end |
.build_system ⇒ Object
Returns the value of attribute build_system.
27 28 29 |
# File 'lib/pod_builder/configuration.rb', line 27 def build_system @build_system end |
.configuration_filename ⇒ Object
Returns the value of attribute configuration_filename.
36 37 38 |
# File 'lib/pod_builder/configuration.rb', line 36 def configuration_filename @configuration_filename end |
.dev_pods_configuration_filename ⇒ Object
Returns the value of attribute dev_pods_configuration_filename.
37 38 39 |
# File 'lib/pod_builder/configuration.rb', line 37 def dev_pods_configuration_filename @dev_pods_configuration_filename end |
.development_pods_paths ⇒ Object
Returns the value of attribute development_pods_paths.
34 35 36 |
# File 'lib/pod_builder/configuration.rb', line 34 def development_pods_paths @development_pods_paths end |
.lfs_min_file_size ⇒ Object
Returns the value of attribute lfs_min_file_size.
38 39 40 |
# File 'lib/pod_builder/configuration.rb', line 38 def lfs_min_file_size @lfs_min_file_size end |
.license_filename ⇒ Object
Returns the value of attribute license_filename.
32 33 34 |
# File 'lib/pod_builder/configuration.rb', line 32 def license_filename @license_filename end |
.skip_licenses ⇒ Object
Returns the value of attribute skip_licenses.
30 31 32 |
# File 'lib/pod_builder/configuration.rb', line 30 def skip_licenses @skip_licenses end |
.skip_pods ⇒ Object
Returns the value of attribute skip_pods.
31 32 33 |
# File 'lib/pod_builder/configuration.rb', line 31 def skip_pods @skip_pods end |
.spec_overrides ⇒ Object
Returns the value of attribute spec_overrides.
29 30 31 |
# File 'lib/pod_builder/configuration.rb', line 29 def spec_overrides @spec_overrides end |
.subspecs_to_split ⇒ Object
Returns the value of attribute subspecs_to_split.
33 34 35 |
# File 'lib/pod_builder/configuration.rb', line 33 def subspecs_to_split @subspecs_to_split end |
.update_lfs_gitattributes ⇒ Object
Returns the value of attribute update_lfs_gitattributes.
39 40 41 |
# File 'lib/pod_builder/configuration.rb', line 39 def update_lfs_gitattributes @update_lfs_gitattributes end |
Class Method Details
.check_inited ⇒ Object
58 59 60 |
# File 'lib/pod_builder/configuration.rb', line 58 def self.check_inited raise "\n\nNot inited, run `pod_builder init`\n".red if podbuilder_path.nil? end |
.config_path ⇒ Object
163 164 165 166 167 168 169 |
# File 'lib/pod_builder/configuration.rb', line 163 def self.config_path unless path = podbuilder_path return nil end return File.join(path, Configuration.configuration_filename) end |
.exists ⇒ Object
62 63 64 |
# File 'lib/pod_builder/configuration.rb', line 62 def self.exists return !config_path.nil? && File.exist?(config_path) end |
.load ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 |
# File 'lib/pod_builder/configuration.rb', line 66 def self.load unless podbuilder_path return end Configuration.base_path = podbuilder_path if exists json = JSON.parse(File.read(config_path)) 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["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["update_lfs_gitattributes"] if [TrueClass, FalseClass].include?(value.class) Configuration.update_lfs_gitattributes = value end end if value = json["lfs_min_file_size_kb"] if value.is_a?(Integer) if value > 50 Configuration.lfs_min_file_size = value else puts "\n\n⚠️ Skipping `lfs_min_file_size` value too small".yellow end 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) json = JSON.parse(File.read(dev_pods_configuration_path)) Configuration.development_pods_paths = json || [] Configuration.development_pods_paths.freeze end end |
.podbuilder_path ⇒ Object
171 172 173 174 175 176 |
# File 'lib/pod_builder/configuration.rb', line 171 def self.podbuilder_path paths = Dir.glob("#{PodBuilder::home}/**/.pod_builder") raise "\n\nToo many .pod_builder found `#{paths.join("\n")}`\n".red if paths.count > 1 return paths.count > 0 ? File.dirname(paths.first) : nil end |
.write ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/pod_builder/configuration.rb', line 144 def self.write config = {} config["spec_overrides"] = Configuration.spec_overrides config["skip_licenses"] = Configuration.skip_licenses config["skip_pods"] = Configuration.skip_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["update_lfs_gitattributes"] = Configuration.update_lfs_gitattributes config["lfs_min_file_size_kb"] = Configuration.lfs_min_file_size File.write(config_path, JSON.pretty_generate(config)) end |