cocoapods-sorted-search 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +39 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +64 -0
- data/LICENSE +21 -0
- data/README.md +26 -0
- data/Rakefile +2 -0
- data/cocoapods-sorted-search.gemspec +25 -0
- data/example.gif +0 -0
- data/lib/cocoapods_plugin.rb +1 -0
- data/lib/pod/command/search_sort.rb +109 -0
- data/spec/spec_helper.rb +8 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d8612a2226901a31f938c6050d9346daf6f9cb81
|
4
|
+
data.tar.gz: 9823c86f56204cdf11bb0f2ec8c3ee488efba362
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 137160da6b61dc6285b61277176e4db9af7e167c269483d75048a90f3fbb45d08af9c9bdc68d6052fa45de93e18b6f01d7e98ee7641f16b0f0075656099e0227
|
7
|
+
data.tar.gz: bd6ab400126b1890bdc97ac29017cd91ffc34e1eef8c095acbc84f5a14ca83948e8a329ac221cb050f8a06b4090a3d27cdde59ad5d0d466d9f64699e9df6ebf4
|
data/.gitignore
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
# Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
35
|
+
|
36
|
+
|
37
|
+
# IntelliJ
|
38
|
+
|
39
|
+
.idea/**
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cocoapods-sorted-search (0.1.0)
|
5
|
+
cocoapods (~> 0.28)
|
6
|
+
ruby-progressbar
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (3.2.17)
|
12
|
+
i18n (~> 0.6, >= 0.6.4)
|
13
|
+
multi_json (~> 1.0)
|
14
|
+
claide (0.5.0)
|
15
|
+
cocoapods (0.31.1)
|
16
|
+
activesupport (>= 3.2.15, < 4)
|
17
|
+
claide (~> 0.5.0)
|
18
|
+
cocoapods-core (= 0.31.1)
|
19
|
+
cocoapods-downloader (~> 0.4.1)
|
20
|
+
cocoapods-try (~> 0.2.0)
|
21
|
+
colored (~> 1.2)
|
22
|
+
escape (~> 0.0.4)
|
23
|
+
json_pure (~> 1.8)
|
24
|
+
nap (~> 0.5)
|
25
|
+
open4 (~> 1.3)
|
26
|
+
xcodeproj (~> 0.16.0)
|
27
|
+
cocoapods-core (0.31.1)
|
28
|
+
activesupport (>= 3.2.15, < 4)
|
29
|
+
fuzzy_match (~> 2.0.4)
|
30
|
+
json_pure (~> 1.8)
|
31
|
+
nap (~> 0.5)
|
32
|
+
cocoapods-downloader (0.4.1)
|
33
|
+
cocoapods-try (0.2.0)
|
34
|
+
colored (1.2)
|
35
|
+
diff-lcs (1.2.5)
|
36
|
+
escape (0.0.4)
|
37
|
+
fuzzy_match (2.0.4)
|
38
|
+
i18n (0.6.9)
|
39
|
+
json_pure (1.8.1)
|
40
|
+
multi_json (1.9.2)
|
41
|
+
nap (0.7.0)
|
42
|
+
open4 (1.3.3)
|
43
|
+
rake (10.2.2)
|
44
|
+
rspec (2.14.1)
|
45
|
+
rspec-core (~> 2.14.0)
|
46
|
+
rspec-expectations (~> 2.14.0)
|
47
|
+
rspec-mocks (~> 2.14.0)
|
48
|
+
rspec-core (2.14.8)
|
49
|
+
rspec-expectations (2.14.5)
|
50
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
51
|
+
rspec-mocks (2.14.6)
|
52
|
+
ruby-progressbar (1.4.2)
|
53
|
+
xcodeproj (0.16.0)
|
54
|
+
activesupport (~> 3.0)
|
55
|
+
colored (~> 1.2)
|
56
|
+
|
57
|
+
PLATFORMS
|
58
|
+
ruby
|
59
|
+
|
60
|
+
DEPENDENCIES
|
61
|
+
bundler
|
62
|
+
cocoapods-sorted-search!
|
63
|
+
rake
|
64
|
+
rspec
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Denys Telezhkin
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
CocoaPods sorted search
|
2
|
+
==============
|
3
|
+
|
4
|
+
CocoaPods plugin which adds a `sort` subcommand for `pod search` to sort search results by amount of stars, forks, or github activity.
|
5
|
+
|
6
|
+
##Usage
|
7
|
+
|
8
|
+
pod search sort --stars POD_NAME
|
9
|
+
|
10
|
+
## Params
|
11
|
+
|
12
|
+
* **--stars** - sort by stars
|
13
|
+
* **--forks** - sort by forks
|
14
|
+
* **--activity** - sort by most recent commits
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
[sudo] gem install cocoapods-sorted-search
|
19
|
+
|
20
|
+
## Known issues
|
21
|
+
|
22
|
+
Currently GitHub has a rate limit set for 60 API requests per hour. CocoaPods does great job at caching results, but it is easy to exceed current limit. Use with care =)
|
23
|
+
|
24
|
+
## Example
|
25
|
+
|
26
|
+

|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "cocoapods-sorted-search"
|
7
|
+
spec.version = '0.1.0'
|
8
|
+
spec.authors = ["Denys Telezhkin"]
|
9
|
+
spec.email = ["strangervir@gmail.com"]
|
10
|
+
spec.summary = %q{CocoaPods plugin for sorted searching amongst CocoaPods.}
|
11
|
+
spec.description = %q{Sort CocoaPods search results by amount of stars, forks, or commit activity!}
|
12
|
+
spec.homepage = "https://github.com/DenHeadless/cocoapods-sorted-search"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_runtime_dependency 'cocoapods', '~> 0.28'
|
20
|
+
spec.add_dependency 'ruby-progressbar'
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
end
|
data/example.gif
ADDED
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'pod/command/search_sort'
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'ruby-progressbar'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class Search
|
6
|
+
class Sorted < Search
|
7
|
+
self.summary = 'Sort pod search results easily!'
|
8
|
+
|
9
|
+
self.description = <<-DESC
|
10
|
+
Sort CocoaPods search results by stars, forks, or repo activity.
|
11
|
+
DESC
|
12
|
+
|
13
|
+
self.command = "sort"
|
14
|
+
|
15
|
+
def initialize(argv)
|
16
|
+
super
|
17
|
+
@sort_by_stars = argv.flag?('stars')
|
18
|
+
@sort_by_commits = argv.flag?('activity')
|
19
|
+
@sort_by_forks = argv.flag?('forks')
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.options
|
23
|
+
[
|
24
|
+
["--stars", "Sort by stars"],
|
25
|
+
["--activity", "Sort by most recently changed repo"],
|
26
|
+
["--forks", "Sort by amount of forks"]
|
27
|
+
].concat(super)
|
28
|
+
end
|
29
|
+
|
30
|
+
def run
|
31
|
+
specs = find_specs(@query)
|
32
|
+
fetch_github_info(specs)
|
33
|
+
sorted_pods = sort_specs(specs)
|
34
|
+
print_specs(sorted_pods)
|
35
|
+
end
|
36
|
+
|
37
|
+
def fetch_github_info(specs)
|
38
|
+
found = "\nFound " + specs.count.to_s + " specs. Fetching GitHub info, wait a moment please.\n"
|
39
|
+
UI.puts found.green
|
40
|
+
|
41
|
+
progress_bar = ProgressBar.create(total: specs.count, length: 60)
|
42
|
+
specs.each do |spec|
|
43
|
+
pod = pod_from_spec(spec)
|
44
|
+
pod.github_watchers # This will force statistics provider to fetch github info unless it is already cached
|
45
|
+
progress_bar.increment
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def pod_from_spec(spec)
|
50
|
+
statistics_provider = Config.instance.spec_statistics_provider
|
51
|
+
Specification::Set::Presenter.new(spec, statistics_provider)
|
52
|
+
end
|
53
|
+
|
54
|
+
def print_specs(sorted_pods)
|
55
|
+
sorted_pods.each do |pod|
|
56
|
+
UI.title("-> #{pod.name} (#{pod.version})".green, '', 1) do
|
57
|
+
next unless pod.github_last_activity
|
58
|
+
stars = [0x2605].pack("U") + " " + pod.github_watchers.to_s + " "
|
59
|
+
forks = [0x2442].pack("U") + " " + pod.github_forks.to_s + " "
|
60
|
+
commit = "Last commit: "+ pod.github_last_activity
|
61
|
+
|
62
|
+
UI.puts_indented pod.summary
|
63
|
+
UI.puts_indented stars.yellow + forks.yellow
|
64
|
+
UI.puts_indented commit.yellow
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
UI.puts
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
def sort_specs(specs)
|
74
|
+
pods = specs.map { |spec| pod_from_spec(spec) }
|
75
|
+
|
76
|
+
if @sort_by_stars
|
77
|
+
return pods.sort do |x,y|
|
78
|
+
y.github_watchers.to_i <=> x.github_watchers.to_i
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
if @sort_by_commits
|
83
|
+
return pods.sort do |x,y|
|
84
|
+
y.statistics_provider.github_pushed_at(y.set).to_i <=> x.statistics_provider.github_pushed_at(x.set).to_i
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
if @sort_by_forks
|
89
|
+
return pods.sort do |x,y|
|
90
|
+
y.github_forks.to_i <=> x.github_forks.to_i
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def find_specs(query)
|
96
|
+
sets = SourcesManager.search_by_name(query.join(' ').strip, @full_text_search)
|
97
|
+
if @supported_on_ios
|
98
|
+
sets.reject!{ |set| !set.specification.available_platforms.map(&:name).include?(:ios) }
|
99
|
+
end
|
100
|
+
if @supported_on_osx
|
101
|
+
sets.reject!{ |set| !set.specification.available_platforms.map(&:name).include?(:osx) }
|
102
|
+
end
|
103
|
+
|
104
|
+
sets
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-sorted-search
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Denys Telezhkin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cocoapods
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.28'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.28'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ruby-progressbar
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Sort CocoaPods search results by amount of stars, forks, or commit activity!
|
84
|
+
email:
|
85
|
+
- strangervir@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
92
|
+
- Gemfile.lock
|
93
|
+
- LICENSE
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- cocoapods-sorted-search.gemspec
|
97
|
+
- example.gif
|
98
|
+
- lib/cocoapods_plugin.rb
|
99
|
+
- lib/pod/command/search_sort.rb
|
100
|
+
- spec/spec_helper.rb
|
101
|
+
homepage: https://github.com/DenHeadless/cocoapods-sorted-search
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.2.2
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: CocoaPods plugin for sorted searching amongst CocoaPods.
|
125
|
+
test_files:
|
126
|
+
- spec/spec_helper.rb
|
127
|
+
has_rdoc:
|