Class: Pod::Command::Show

Inherits:
Pod::Command show all
Defined in:
lib/pod/command/show.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Show

Returns a new instance of Show.



18
19
20
21
# File 'lib/pod/command/show.rb', line 18

def initialize(argv)
  @filter = argv.shift_argument
  super
end

Instance Attribute Details

#filterObject (readonly)

Returns the value of attribute filter.



16
17
18
# File 'lib/pod/command/show.rb', line 16

def filter
  @filter
end

Instance Method Details

#runObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/pod/command/show.rb', line 23

def run
  verify_lockfile_exists!
  section_title = "Installed pods"
  section_title += " matching '#{filter}'" if filter
  UI.section("#{section_title}:") do
    config_hash = config.lockfile.to_hash
    config_hash['PODS'].each do |pod|
      pod = pod.keys.first if pod.is_a?(Hash)
      next if filter && pod.scan(filter).empty?
      pod_name, version = Specification.name_and_version_from_string(pod)
      if config_hash['CHECKOUT OPTIONS']
        pod_source = config_hash['CHECKOUT OPTIONS'][pod_name]
        if pod_source && pod_source[:commit]
          git_version = pod_source[:commit][0,7]
          version = "#{version} #{git_version}"
        end
      end
      UI.puts "  * #{pod_name} (#{version})"
    end
  end
end