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.
-
.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
.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 |
.framework_plist_filename ⇒ Object
Returns the value of attribute framework_plist_filename.
43 44 45 |
# File 'lib/pod_builder/configuration.rb', line 43 def framework_plist_filename @framework_plist_filename end |
.lfs_include_pods_folder ⇒ Object
Returns the value of attribute lfs_include_pods_folder.
40 41 42 |
# File 'lib/pod_builder/configuration.rb', line 40 def lfs_include_pods_folder @lfs_include_pods_folder 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 |
.lfs_update_gitattributes ⇒ Object
Returns the value of attribute lfs_update_gitattributes.
39 40 41 |
# File 'lib/pod_builder/configuration.rb', line 39 def lfs_update_gitattributes @lfs_update_gitattributes 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 |
.lock_filename ⇒ Object
Returns the value of attribute lock_filename.
44 45 46 |
# File 'lib/pod_builder/configuration.rb', line 44 def lock_filename @lock_filename end |
.project_name ⇒ Object
Returns the value of attribute project_name.
41 42 43 |
# File 'lib/pod_builder/configuration.rb', line 41 def project_name @project_name end |
.restore_enabled ⇒ Object
Returns the value of attribute restore_enabled.
42 43 44 |
# File 'lib/pod_builder/configuration.rb', line 42 def restore_enabled @restore_enabled 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 |
Class Method Details
.check_inited ⇒ Object
68 69 70 |
# File 'lib/pod_builder/configuration.rb', line 68 def self.check_inited raise "\n\nNot inited, run `pod_builder init`\n".red if podbuilder_path.nil? end |
.exists ⇒ Object
72 73 74 |
# File 'lib/pod_builder/configuration.rb', line 72 def self.exists return !config_path.nil? && File.exist?(config_path) end |
.load ⇒ Object
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 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 |
# File 'lib/pod_builder/configuration.rb', line 76 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["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 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
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/pod_builder/configuration.rb', line 170 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["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 |