Class: Xcodeproj::Util
- Inherits:
-
Object
- Object
- Xcodeproj::Util
- Defined in:
- lib/core_blur/check/util.rb
Class Method Summary collapse
Class Method Details
.get_podspec_content(podspec_path) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/core_blur/check/util.rb', line 3 def self.get_podspec_content(podspec_path) podspec_json_path = podspec_path.to_s.end_with?(".podspec.json") ? podspec_path : nil podspec_content = nil if podspec_json_path and File.exist?(podspec_json_path) json = File.read(podspec_json_path) podspec_content = JSON.parse(json) elsif podspec_path and File.exist?(podspec_path) json = get_podspec_file_content(podspec_path) podspec_content = JSON.parse(json) end podspec_content end |
.get_podspec_file_content(podspec_path) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/core_blur/check/util.rb', line 16 def self.get_podspec_file_content(podspec_path) spec_contents = File.open(podspec_path, 'r:utf-8', &:read) if spec_contents.respond_to?(:encoding) && spec_contents.encoding.name != 'UTF-8' spec_contents.encode!('UTF-8') end path = Pathname.new(podspec_path) spec = ::Pod._eval_podspec(spec_contents, path) spec.to_json end |