class Pod::Command::Spec::Which

Public Class Methods

new(argv) click to toggle source
Calls superclass method Pod::Command::new
# File lib/cocoapods/command/spec/which.rb, line 23
def initialize(argv)
  @use_regex = argv.flag?('regex')
  @show_all = argv.flag?('show-all')
  @version = argv.option('version')
  @query = argv.shift_argument
  @query = @query.gsub('.podspec', '') unless @query.nil?
  super
end
options() click to toggle source
Calls superclass method Pod::Command::options
# File lib/cocoapods/command/spec/which.rb, line 15
def self.options
  [
    ['--regex', 'Interpret the `QUERY` as a regular expression'],
    ['--show-all', 'Print all versions of the given podspec'],
    ['--version', 'Print a specific version of the given podspec'],
  ].concat(super)
end

Public Instance Methods

run() click to toggle source
# File lib/cocoapods/command/spec/which.rb, line 38
def run
  query = @use_regex ? @query : Regexp.escape(@query)
  UI.puts get_path_of_spec(query, @show_all || @version)
end
validate!() click to toggle source
Calls superclass method
# File lib/cocoapods/command/spec/which.rb, line 32
def validate!
  super
  help! 'A podspec name is required.' unless @query
  validate_regex!(@query) if @use_regex
end