[Feature Request] Support YAML for podspec and JSON for Podfile
Closed this issue · 5 comments
I found that, the Podfile support ruby
and yaml
, not the json
, but the podspec support ruby
and json
, not the yaml
.
The Podfile:
def self.from_file(path)
path = Pathname.new(path)
unless path.exist?
raise Informative, "No Podfile exists at path `#{path}`."
end
case path.extname
when '', '.podfile', '.rb'
Podfile.from_ruby(path)
when '.yaml'
Podfile.from_yaml(path)
else
raise Informative, "Unsupported Podfile format `#{path}`."
end
end
The podspec:
def self.from_string(spec_contents, path, subspec_name = nil)
path = Pathname.new(path).expand_path
spec = nil
Dir.chdir(path.parent.directory? ? path.parent : Dir.pwd) do
case path.extname
when '.podspec'
spec = ::Pod._eval_podspec(spec_contents, path)
unless spec.is_a?(Specification)
raise Informative, "Invalid podspec file at path `#{path}`."
end
when '.json'
spec = Specification.from_json(spec_contents)
else
raise Informative, "Unsupported specification format `#{path.extname}` for spec at `#{path}`."
end
end
spec.defined_in_file = path
spec.subspec_by_name(subspec_name, true)
end
I known it is not a important feature for using same format, but I still create this issue. Has Somebody free time to add the format support?
By the way, the command line could convert podfile to yaml, but could not convert the podspec to yaml:
Usage:
$ pod ipc COMMAND
Inter-process communication
Commands:
+ list Lists the specifications known to CocoaPods
+ podfile Converts a Podfile to YAML
+ podfile-json Converts a Podfile to JSON
+ repl The repl listens to commands on standard input
+ spec Converts a podspec to JSON
+ update-search-index Updates the search index
I think it is strange that I could get the json from Podfile and could not pass the json to Cocoapods.
And the podspec is same.
We built pod ipc podfile-json
for the CocoaPods Mac app I believe, which didn't need to read JSON podfiles, but as a GUI it was very useful to get a JSON equivalent.
Yes, I agree that. I have an app to handle the cocoapods, it likes CocoaPods Mac app. But I have a feature to generate the Podfile, and read it. It is too slow to pod ipc podfile-json
, and it hard to write a Podfile( it is a ruby script ). I could not use some model tools ( eg: JSONModel ).
For example, I use the yaml formatter for Podfile, and use the json formatter for podspec. I must have two libraries to handle them. Of cause, it is not too hard, but I think it is very strange.