Class: Pod::Command::Spec::Which
- Inherits:
-
Pod::Command::Spec
- Object
- CLAide::Command
- Pod::Command
- Pod::Command::Spec
- Pod::Command::Spec::Which
- Defined in:
- lib/cocoapods/command/spec/which.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Which
constructor
A new instance of Which.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from Pod::Command::Spec
#all_paths_from_set, #get_path_of_spec, #pathname_from_spec, #spec_and_source_from_set, #validate_regex!
Methods inherited from Pod::Command
#ensure_master_spec_repo_exists!, ensure_not_root_or_allowed!, git_version, #installer_for_config, report_error, run, #verify_lockfile_exists!, verify_minimum_git_version!, #verify_podfile_exists!, verify_xcode_license_approved!
Methods included from Pod::Config::Mixin
Constructor Details
#initialize(argv) ⇒ Which
Returns a new instance of Which.
23 24 25 26 27 28 29 30 |
# 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 |
Class Method Details
.options ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/cocoapods/command/spec/which.rb', line 15 def self. [ ['--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 |
Instance Method Details
#run ⇒ Object
38 39 40 41 |
# 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! ⇒ Object
32 33 34 35 36 |
# 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 |