Commit beaaa73b authored by Chris McKnight's avatar Chris McKnight

Just add license as a key to get from the specification

parent 2019ee33
...@@ -14,8 +14,7 @@ module Pod ...@@ -14,8 +14,7 @@ module Pod
def self.options def self.options
[ [
["--all", "Show information about all Pods with dependencies that are used in a project"], ["--all", "Show information about all Pods with dependencies that are used in a project"],
["--md", "Output information in Markdown format"], ["--md", "Output information in Markdown format"]
["--license", "Additionally output license type"]
].concat(super) ].concat(super)
end end
...@@ -59,16 +58,13 @@ module Pod ...@@ -59,16 +58,13 @@ module Pod
pods.collect! {|pod| (pod.is_a?(Hash)) ? pod.keys.first : pod} pods.collect! {|pod| (pod.is_a?(Hash)) ? pod.keys.first : pod}
end end
def pods_info_hash(pods, keys=[:name, :homepage, :summary]) def pods_info_hash(pods, keys=[:name, :homepage, :summary, :license])
pods_info = [] pods_info = []
pods.each do |pod| pods.each do |pod|
spec = (Pod::SourcesManager.search_by_name(pod).first rescue nil) spec = (Pod::SourcesManager.search_by_name(pod).first rescue nil)
if spec if spec
info = {} info = {}
keys.each { |k| info[k] = spec.specification.send(k) } keys.each { |k| info[k] = spec.specification.send(k) }
if @info_license
info[:license] ||= spec.specification.license[:type]
end
pods_info << info pods_info << info
else else
...@@ -79,13 +75,13 @@ module Pod ...@@ -79,13 +75,13 @@ module Pod
end end
def pods_info(pods, in_md=false) def pods_info(pods, in_md=false)
pods = pods_info_hash(pods, [:name, :homepage, :summary]) pods = pods_info_hash(pods, [:name, :homepage, :summary, :license])
pods.each do |pod| pods.each do |pod|
if in_md if in_md
UI.puts ["* [#{pod[:name]}](#{pod[:homepage]}) - #{pod[:summary]}", pod[:license]].compact.join(' - ') UI.puts "* [#{pod[:name]}](#{pod[:homepage]}) - #{pod[:summary]} - #{pod[:license][:type]}"
else else
UI.puts ["- #{pod[:name]} - #{pod[:summary]}", pod[:license]].compact.join(' - ') UI.puts "- #{pod[:name]} - #{pod[:summary]} - #{pod[:license][:type]}"
end end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment