alfi 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +96 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +42 -0
- data/Rakefile +5 -0
- data/alfi.gemspec +33 -0
- data/bin/alfi +6 -0
- data/bin/setup +7 -0
- data/extras/images/gradle01.png +0 -0
- data/extras/images/gradle02.png +0 -0
- data/extras/images/screenshot01.png +0 -0
- data/extras/images/wide-logo.png +0 -0
- data/lib/alfi.rb +108 -0
- data/lib/alfi/version.rb +3 -0
- metadata +147 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2ba11ec84b249c198b566d011eb824936e7e3ff6
|
4
|
+
data.tar.gz: 5a759350e8ea476fc59f98c0d95c3cfbaea211c6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2b62f7c46972a6ceac35e845c6b72f8d76c4321a0e918ce56336820b04aa2d642ba5db3a21a3ff2cde6f69ae75980d1ccb071791ed915938d177c3d80d2e7a63
|
7
|
+
data.tar.gz: 1d78d1a1e7f16bec0b4cb272cf6f9dc2973b91fe2decd32d329137e14c7cf439fdddafd2991cc854b5a5a9f429e2d34648e969162ef9c3fbd56567dd55211cf6
|
data/.gitignore
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
# Created by https://www.gitignore.io
|
11
|
+
|
12
|
+
### RubyMine ###
|
13
|
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
|
14
|
+
|
15
|
+
*.iml
|
16
|
+
|
17
|
+
## Directory-based project format:
|
18
|
+
.idea/
|
19
|
+
# if you remove the above rule, at least ignore the following:
|
20
|
+
|
21
|
+
# User-specific stuff:
|
22
|
+
# .idea/workspace.xml
|
23
|
+
# .idea/tasks.xml
|
24
|
+
# .idea/dictionaries
|
25
|
+
|
26
|
+
# Sensitive or high-churn files:
|
27
|
+
# .idea/dataSources.ids
|
28
|
+
# .idea/dataSources.xml
|
29
|
+
# .idea/sqlDataSources.xml
|
30
|
+
# .idea/dynamic.xml
|
31
|
+
# .idea/uiDesigner.xml
|
32
|
+
|
33
|
+
# Gradle:
|
34
|
+
# .idea/gradle.xml
|
35
|
+
# .idea/libraries
|
36
|
+
|
37
|
+
# Mongo Explorer plugin:
|
38
|
+
# .idea/mongoSettings.xml
|
39
|
+
|
40
|
+
## File-based project format:
|
41
|
+
*.ipr
|
42
|
+
*.iws
|
43
|
+
|
44
|
+
## Plugin-specific files:
|
45
|
+
|
46
|
+
# IntelliJ
|
47
|
+
/out/
|
48
|
+
|
49
|
+
# mpeltonen/sbt-idea plugin
|
50
|
+
.idea_modules/
|
51
|
+
|
52
|
+
# JIRA plugin
|
53
|
+
atlassian-ide-plugin.xml
|
54
|
+
|
55
|
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
56
|
+
com_crashlytics_export_strings.xml
|
57
|
+
crashlytics.properties
|
58
|
+
crashlytics-build.properties
|
59
|
+
|
60
|
+
|
61
|
+
### Ruby ###
|
62
|
+
*.gem
|
63
|
+
*.rbc
|
64
|
+
/.config
|
65
|
+
/coverage/
|
66
|
+
/InstalledFiles
|
67
|
+
/pkg/
|
68
|
+
/spec/reports/
|
69
|
+
/test/tmp/
|
70
|
+
/test/version_tmp/
|
71
|
+
/tmp/
|
72
|
+
|
73
|
+
## Specific to RubyMotion:
|
74
|
+
.dat*
|
75
|
+
.repl_history
|
76
|
+
build/
|
77
|
+
|
78
|
+
## Documentation cache and generated files:
|
79
|
+
/.yardoc/
|
80
|
+
/_yardoc/
|
81
|
+
/doc/
|
82
|
+
/rdoc/
|
83
|
+
|
84
|
+
## Environment normalisation:
|
85
|
+
/.bundle/
|
86
|
+
/vendor/bundle
|
87
|
+
/lib/bundler/man/
|
88
|
+
|
89
|
+
# for a library or gem, you might want to ignore these files since the code is
|
90
|
+
# intended to run in multiple environments; otherwise, check them in:
|
91
|
+
# Gemfile.lock
|
92
|
+
# .ruby-version
|
93
|
+
# .ruby-gemset
|
94
|
+
|
95
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
96
|
+
.rvmrc
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 César Ferreira
|
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.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# alfi ![Header](https://travis-ci.org/cesarferreira/alfi.svg?branch=master)
|
2
|
+
|
3
|
+
**A**ndroid **L**ibrary **Fi**nder
|
4
|
+
|
5
|
+
<p align="center">
|
6
|
+
<img src="https://raw.githubusercontent.com/cesarferreira/alfi/master/extras/images/wide-logo.png" width="100%" />
|
7
|
+
</p>
|
8
|
+
|
9
|
+
Search through thousands of android libraries that can help you scale your projects elegantly
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Install it via terminal:
|
14
|
+
|
15
|
+
$ gem install alfi
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
Search for `something`
|
20
|
+
|
21
|
+
```bash
|
22
|
+
alfi picasso
|
23
|
+
```
|
24
|
+
|
25
|
+
<p align="center">
|
26
|
+
<img src="https://raw.github.com/cesarferreira/alfi/master/extras/images/screenshot01.png" />
|
27
|
+
</p>
|
28
|
+
|
29
|
+
**Final step:** Copy the library you want to your `build.gradle` and sync it
|
30
|
+
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
1. Fork it ( https://github.com/cesarferreira/alfi/fork )
|
35
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
36
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
37
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
38
|
+
5. Create a new Pull Request
|
39
|
+
|
40
|
+
|
41
|
+
## Thanks
|
42
|
+
To [@joaquimadraz](https://github.com/joaquimadraz) for the ruby pro-tips
|
data/Rakefile
ADDED
data/alfi.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'alfi/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'alfi'
|
8
|
+
spec.version = Alfi::VERSION
|
9
|
+
spec.authors = ['cesar ferreira']
|
10
|
+
spec.email = ['cesar.manuel.ferreira@gmail.com']
|
11
|
+
|
12
|
+
if spec.respond_to?(:metadata)
|
13
|
+
#spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
|
14
|
+
end
|
15
|
+
|
16
|
+
spec.summary = 'Android Library Finder'
|
17
|
+
spec.description = 'Search through thousands of android libraries that can help you scale your projects elegantly.'
|
18
|
+
spec.homepage = "https://github.com/cesarferreira/alfi"
|
19
|
+
spec.license = 'MIT'
|
20
|
+
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
spec.bindir = 'bin'
|
23
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ['lib']
|
25
|
+
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'webmock', '~> 1.20'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.2'
|
29
|
+
spec.add_development_dependency 'vcr', '~> 2.9'
|
30
|
+
spec.add_dependency 'json', '~> 1.8.2'
|
31
|
+
spec.add_dependency 'colorize', '~> 0.7.5'
|
32
|
+
|
33
|
+
end
|
data/bin/alfi
ADDED
data/bin/setup
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/alfi.rb
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'alfi/version'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'json'
|
4
|
+
require 'net/http'
|
5
|
+
require 'uri'
|
6
|
+
require 'colorize'
|
7
|
+
|
8
|
+
module Alfi
|
9
|
+
|
10
|
+
class SearchModel
|
11
|
+
|
12
|
+
def self.query_url (query)
|
13
|
+
"http://search.maven.org/solrsearch/select?q=#{query}&rows=350&wt=json"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.fetch_results(query)
|
17
|
+
uri = URI.parse(query_url(query))
|
18
|
+
|
19
|
+
|
20
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
21
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
22
|
+
|
23
|
+
response = http.request(request)
|
24
|
+
|
25
|
+
if response.code == '200'
|
26
|
+
result = JSON.parse(response.body)
|
27
|
+
|
28
|
+
# Amount of results
|
29
|
+
num_results = result['response']['numFound']
|
30
|
+
|
31
|
+
suggestions = nil
|
32
|
+
|
33
|
+
# Possible suggestions
|
34
|
+
if num_results==0
|
35
|
+
suggestions = result['spellcheck']['suggestions'].last['suggestion']
|
36
|
+
end
|
37
|
+
|
38
|
+
# Init the result list
|
39
|
+
result_list = Array.new
|
40
|
+
|
41
|
+
# Iterate the libraries
|
42
|
+
result['response']['docs'].each do |doc|
|
43
|
+
output = " compile '#{doc['id']}:#{doc['latestVersion']}'"
|
44
|
+
result_list << output
|
45
|
+
end
|
46
|
+
|
47
|
+
return num_results, result_list, suggestions
|
48
|
+
else
|
49
|
+
puts 'Unknown ERROR!!!\n(are you even connected to the internet brah?)'.red
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.query_offline_reps(query)
|
54
|
+
#
|
55
|
+
# compile 'com.android.support:appcompat-v7:21.0.3'
|
56
|
+
# compile 'com.android.support:cardview-v7:21.0.3'
|
57
|
+
# compile 'com.android.support:gridlayout-v7:21.0.3'
|
58
|
+
# compile 'com.android.support:leanback-v17:21.0.3'
|
59
|
+
# compile 'com.android.support:mediarouter-v7:21.0.3'
|
60
|
+
# compile 'com.android.support:palette-v7:21.0.3'
|
61
|
+
# compile 'com.android.support:recyclerview-v7:21.0.3'
|
62
|
+
# compile 'com.android.support:support-annotations:21.0.3'
|
63
|
+
# compile 'com.android.support:support-v13:21.0.3'
|
64
|
+
# compile 'com.android.support:support-v4:21.0.3'
|
65
|
+
|
66
|
+
#com.google.android.gms:play-services-wearable:6.5.87
|
67
|
+
#com.google.android.gms:play-services:6.5.87
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.initialize (param)
|
71
|
+
|
72
|
+
if param == nil
|
73
|
+
puts "Missing query parameter\n\tusage: alfi SEARCH_QUERY\n".red
|
74
|
+
else
|
75
|
+
if param.size>=3
|
76
|
+
|
77
|
+
puts "Searching..."
|
78
|
+
|
79
|
+
num_results, result_list, suggestions = fetch_results(param)
|
80
|
+
|
81
|
+
|
82
|
+
# Iterate to print results
|
83
|
+
result_list.each do |result|
|
84
|
+
puts result.green
|
85
|
+
end
|
86
|
+
|
87
|
+
puts "Found: #{num_results} result#{num_results>1?'s':''} for '#{param}'"
|
88
|
+
|
89
|
+
|
90
|
+
# handle the suggestions
|
91
|
+
if suggestions!=nil
|
92
|
+
|
93
|
+
output = ''
|
94
|
+
|
95
|
+
# iterate the suggestions
|
96
|
+
suggestions.each do |suggestion|
|
97
|
+
output += "#{suggestion} ".yellow
|
98
|
+
end
|
99
|
+
puts "Did you mean: #{output}"
|
100
|
+
end
|
101
|
+
else
|
102
|
+
puts 'The search needs 3+ characters'.red
|
103
|
+
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
data/lib/alfi/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: alfi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- cesar ferreira
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: webmock
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.20'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.20'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: vcr
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: json
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.8.2
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.8.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: colorize
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.7.5
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.7.5
|
97
|
+
description: Search through thousands of android libraries that can help you scale
|
98
|
+
your projects elegantly.
|
99
|
+
email:
|
100
|
+
- cesar.manuel.ferreira@gmail.com
|
101
|
+
executables:
|
102
|
+
- alfi
|
103
|
+
- setup
|
104
|
+
extensions: []
|
105
|
+
extra_rdoc_files: []
|
106
|
+
files:
|
107
|
+
- .gitignore
|
108
|
+
- .rspec
|
109
|
+
- .travis.yml
|
110
|
+
- Gemfile
|
111
|
+
- LICENSE
|
112
|
+
- README.md
|
113
|
+
- Rakefile
|
114
|
+
- alfi.gemspec
|
115
|
+
- bin/alfi
|
116
|
+
- bin/setup
|
117
|
+
- extras/images/gradle01.png
|
118
|
+
- extras/images/gradle02.png
|
119
|
+
- extras/images/screenshot01.png
|
120
|
+
- extras/images/wide-logo.png
|
121
|
+
- lib/alfi.rb
|
122
|
+
- lib/alfi/version.rb
|
123
|
+
homepage: https://github.com/cesarferreira/alfi
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata: {}
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - '>='
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubyforge_project:
|
143
|
+
rubygems_version: 2.0.14
|
144
|
+
signing_key:
|
145
|
+
specification_version: 4
|
146
|
+
summary: Android Library Finder
|
147
|
+
test_files: []
|