Method: Pod::UserInterface.pod

Defined in:
lib/cocoapods/user_interface.rb

.pod(set, mode = :normal) ⇒ Object

Prints the textual representation of a given set.

Parameters:

  • set (Set)

    the set that should be presented.

  • mode (Symbol) (defaults to: :normal)

    the presentation mode, either :normal or :name_and_version.



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/cocoapods/user_interface.rb', line 216

def pod(set, mode = :normal)
  if mode == :name_and_version
    puts_indented "#{set.name} #{set.versions.first.version}"
  else
    pod = Specification::Set::Presenter.new(set)
    title = "-> #{pod.name} (#{pod.version})"
    if pod.spec.deprecated?
      title += " #{pod.deprecation_description}"
      colored_title = title.red
    else
      colored_title = title.green
    end

    title(colored_title, '', 1) do
      puts_indented pod.summary if pod.summary
      puts_indented "pod '#{pod.name}', '~> #{pod.version}'"
      labeled('Homepage', pod.homepage)
      labeled('Source',   pod.source_url)
      labeled('Versions', pod.versions_by_source)
      if mode == :stats
        labeled('Authors',  pod.authors) if pod.authors =~ /,/
        labeled('Author',   pod.authors) if pod.authors !~ /,/
        labeled('License',  pod.license)
        labeled('Platform', pod.platform)
        labeled('Stars',    pod.github_stargazers)
        labeled('Forks',    pod.github_forks)
      end
      labeled('Subspecs', pod.subspecs)
    end
  end
end