Skip to content
This repository

Improved search #177

Closed
irrationalfab opened this Issue · 14 comments

3 participants

Fabio Pelosin Victor Ilyukevich Eloy Durán
Fabio Pelosin
Owner

Inspired by the work of @yas375 I'm proposing some improvements to pod search

  • Colors: I'm not sure if there could be any compatibility issues or ugly coloring with some color schemes.
  • Description wrap: currently long descriptions are wrapped by the terminal and lose indentation. I found a nice way to word split a string at a given colum. However, I'm not sure on how to properly credit a short function.
  • Github watchers and followers: this is very useful for me. However it makes the search slower because a request to GitHub is made for every pod. If accepted I plan to introduce an option to disable it and a very short (2s) timeout.

Here is an example of what I have. Layout needs a bit of fine tuning.
Imgur

Victor Ilyukevich
Collaborator

It's very nice!

About github: maybe better to not include watchers and forks by default and only include this info by calling search command with specific flag?

Fabio Pelosin irrationalfab referenced this issue from a commit
Fabio Pelosin irrationalfab [#177] Search command improvements
- colors
- description wrap
- GitHub watchers and followers
53b7113
Eloy Durán
Owner
alloy commented

Indeed, it's very nice!

But, I agree with Victor that we hold probably not enable the github info by default, as it is not essential information and obviously adds lag due to each network connection, which you will not want when trying multiple searches.

It’s probably best to work on having an RC file asap so that the users can set their own defaults.

Fabio Pelosin
Owner

@yas375 and @alloy what do you think about the option name?

Eloy Durán
Owner
alloy commented

@irrationalfab What do you think about always including the source, but make the stats part optional and changing the option name to --stats?

Fabio Pelosin
Owner

@alloy this is a much cleaner approach.

Fabio Pelosin
Owner

Btw, sorry for the push noise: I missed your comment and then I did a misstake that I realized only after push.

Eloy Durán
Owner
alloy commented

Awesome! Please merge :)

Btw, sorry for the push noise: I missed your comment and then I did a misstake that I realized only after push.

Don’t worry man, it’s only a sign of someone doing work, I can’t have any problem with that ;)

Victor Ilyukevich
Collaborator

cool feature!

thank you, @irrationalfab =)

P.S. I like --stat param name) And sorry for delay with reply: I don't have much free time at work((

Fabio Pelosin
Owner

cool feature!

Hahah.. thanks, but you share part of the credit as it was inspired by your changes.

I like --stat param name

Actually it is --stats as suggested by alloy, however I was undecided wether to use the plural or not. Any opinion about that?

Eloy Durán
Owner
alloy commented

According to wikipedia, ‘stats’ is the more often used form for ‘statistics’ in British English contexts.

Statistics are: ( used with a plural verb ) the numerical facts or data themselves..

So --stats means: ‘shows statistics’.

For some unknown reason I find British English more charming :)

Fabio Pelosin
Owner

Such a great explanation would convince even this guy.

Eloy Durán
Owner
alloy commented

Note that I could very well be wrong, though ;) English is not my native language.

Victor Ilyukevich
Collaborator

@irrationalfab something went wrong on showing stats for ASIWebPageRequest.

➜  CocoaPods git:(master) ./bin/pod search --stats asiweb
--> ASIWebPageRequest (1.8.1)
    The ASIWebPageRequest class included with ASIHTTPRequest lets you download
        complete webpages, including external resources like images and stylesheets.
    - Homepage: http://allseeing-i.com/ASIHTTPRequest/ASIWebPageRequest
/Users/yas/code/CocoaPods/lib/cocoapods/command/error_report.rb:38:in `report': undefined method `read' for nil:NilClass (NoMethodError)
    from /Users/yas/code/CocoaPods/lib/cocoapods/command.rb:62:in `rescue in run'
    from /Users/yas/code/CocoaPods/lib/cocoapods/command.rb:54:in `run'
    from ./bin/pod:11:in `<main>'

I will fix in a minute error with undefined method in error_report. But last error occur on creating nice error report and there are problem in lib/cocoapods/command.rb:62 (

cool feature!

Hahah.. thanks, but you share part of the credit as it was inspired by your changes.

I talked about colored output and repo stats)

Victor Ilyukevich yas375 referenced this issue from a commit
Victor Ilyukevich yas375 fix creating error report when pod was ran not from project dir
I run pod search not from directory with xcode project and it there was
an error with reading podfile. Than I added check for existence of
podfile. [#177]
7af8430
Victor Ilyukevich
Collaborator

here is details of problem mentioned in my previous post:

➜  CocoaPods git:(master) ./bin/pod search --stats asiweb
--> ASIWebPageRequest (1.8.1)
    The ASIWebPageRequest class included with ASIHTTPRequest lets you download
        complete webpages, including external resources like images and stylesheets.
    - Homepage: http://allseeing-i.com/ASIHTTPRequest/ASIWebPageRequest
Oh no, an error occurred. 

Search for existing github issues similar to yours:

  https://github.com/CocoaPods/CocoaPods/issues/search?q=%22undefined+method+%60match%27+for+nil%3ANilClass%22

If none exists, create a ticket with the following information to:

  https://github.com/CocoaPods/CocoaPods/issues/new

Don't forget to anonymize any private data!


### Stack

* Host version: Mac OS X 10.7.3 (11D50)
* Xcode version: 4.3.2 (4E2002)
* Ruby version: ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
* Ruby lib dir: /Users/yas/.rvm/rubies/ruby-1.9.3-p125/lib
* RubyGems version: 1.8.19
* CocoaPods version: 0.5.1
* Specification repositories:
  - master - git://github.com/CocoaPods/Specs.git @ 2799f8dcb3285134fa27d84ae8dc1e902717c367


### Podfile

```ruby

```


### Error

```
undefined method `match' for nil:NilClass
  /Users/yas/code/CocoaPods/lib/cocoapods/command/search.rb:57:in `puts_github_info'
  /Users/yas/code/CocoaPods/lib/cocoapods/command/search.rb:36:in `block in run'
  /Users/yas/code/CocoaPods/lib/cocoapods/command/search.rb:29:in `each'
  /Users/yas/code/CocoaPods/lib/cocoapods/command/search.rb:29:in `run'
  /Users/yas/code/CocoaPods/lib/cocoapods/command.rb:56:in `run'
  ./bin/pod:11:in `<main>'
```
Victor Ilyukevich yas375 reopened this
Eloy Durán alloy closed this in 745ca34
Dieter Komendera kommen referenced this issue from a commit in kommen/CocoaPods
Fabio Pelosin irrationalfab Merge branch 'master', remote-tracking branch 'origin'
* origin:
  Erroneously deleted + on self.options
  [#177] @alloy's suggestions
  Revert .git behaviour and refactoring
  [fix] Support for dashes in GitHub repo and author
  [#177] Fix for GitHub repos missing final .git in the source
  [#177] Added --extended option
  Tweaks to regex and coloring
  [#177] Search command improvements

* master:
8da0137
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.