Class: Pod::Command::Binary::Search

Inherits:
Pod::Command::Binary show all
Defined in:
lib/cocoapods-tdfire-binary/command/search.rb

Instance Method Summary collapse

Methods inherited from Pod::Command::Binary

#binary_config, #first_podspec, #private_sources

Constructor Details

#initialize(argv) ⇒ Search

Returns a new instance of Search.



20
21
22
23
# File 'lib/cocoapods-tdfire-binary/command/search.rb', line 20

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

Instance Method Details

#runObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/cocoapods-tdfire-binary/command/search.rb', line 30

def run
  result = Pod::Tdfire::BinaryUrlManager.search_binary(@name)
  pod = JSON.parse(result) unless result.nil?
  pod ||= {'' => []}

  name = pod['name'] || @name
  versions = pod['versions'] || []

  title = "-> #{name} (#{versions.last})".green

  Pod::UI::title(title, '', 1) do
    Pod::UI::labeled('Versions', versions.join(', '))
  end
end

#validate!Object



25
26
27
28
# File 'lib/cocoapods-tdfire-binary/command/search.rb', line 25

def validate!
  super
  help! "必须指定有效组件名" if @name.nil?
end