Class: Pod::Command::Plugins::Search
- Inherits:
-
Pod::Command::Plugins
- Object
- Pod::Command
- Pod::Command::Plugins
- Pod::Command::Plugins::Search
- Defined in:
- lib/pod/command/plugins/search.rb
Overview
The search subcommand. Used to search a plugin in the list of known plugins, searching into the name, author description fields
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Search
constructor
A new instance of Search.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Search
Returns a new instance of Search.
30 31 32 33 34 |
# File 'lib/pod/command/plugins/search.rb', line 30 def initialize(argv) @full_text_search = argv.flag?('full') @query = argv.shift_argument unless argv.arguments.empty? super end |
Class Method Details
.options ⇒ Object
24 25 26 27 28 |
# File 'lib/pod/command/plugins/search.rb', line 24 def self. [ ['--full', 'Search by name, author, and description'], ].concat(super.reject { |option, _| option == '--silent' }) end |
Instance Method Details
#run ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/pod/command/plugins/search.rb', line 46 def run plugins = PluginsHelper.matching_plugins(@query, @full_text_search) GemHelper.download_and_cache_specs if self.verbose? UI.title "Available CocoaPods Plugins matching '#{@query}':" plugins.each do |plugin| PluginsHelper.print_plugin plugin, self.verbose? end end |
#validate! ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/pod/command/plugins/search.rb', line 36 def validate! super help! 'A search query is required.' if @query.nil? || @query.empty? begin /#{@query}/ rescue RegexpError help! 'A valid regular expression is required.' end end |