fastgem 0.0.3 → 0.1.8
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +18 -16
- data/bin/fastgem +5 -9
- data/fastgem.gemspec +3 -3
- data/lib/fastgem.rb +13 -1
- data/lib/fastgem/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07c5bc3bda5b6198afdbdcdcfbd9971626cefb56
|
4
|
+
data.tar.gz: 2662394f5a6a29f2b36cc1a3a1ed4d2d7b5be2f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3e3212b5334d5ce1195de9a5ea85effa7c2db7657b8ac9d80197393a42b922b3441923e9739073ce70e024a8fec3126852258617b3c52559c6762d6982a8bf0
|
7
|
+
data.tar.gz: 99289d3db2474e589f8b1ff35fa438f2bbd5611ee3f86220f7fcdca6f628210462481d5c9d299ca5a0fc64a428b164b0891e1ba2031a723879eda43a567cf055
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,35 +1,37 @@
|
|
1
1
|
# Fastgem
|
2
|
-

|
2
|
+

|
3
3
|
|
4
|
-
Fastgem is a terminal client for
|
5
|
-
Only supports Ruby 1.9 and later.
|
6
|
-
To install fastgem, we need ruby pre-installed, please refer to https://www.ruby-lang.org/en/installation/ to know how to install ruby.
|
7
|
-
I recommend rvm to control the version of installed ruby.
|
4
|
+
Fastgem is a terminal client for searching inside your ruby gems.
|
8
5
|
|
6
|
+
https://github.com/Nguyenanh/fastgem
|
9
7
|
|
10
|
-
|
11
|
-
|
8
|
+
Required:
|
9
|
+
- `ruby` 1.9 or greater (see https://www.ruby-lang.org/en/installation/ )
|
10
|
+
- `rubygems` (included with ruby; see https://github.com/rubygems/rubygems )
|
12
11
|
|
12
|
+
Recommended:
|
13
|
+
- `rvm` for controling your versions of ruby (see: https://github.com/rvm/rvm )
|
13
14
|
|
14
15
|
## Installation
|
15
|
-
|
16
|
+
|
17
|
+
Install as you would any other ruby gem:
|
18
|
+
|
16
19
|
```
|
17
20
|
$ gem install fastgem
|
18
21
|
```
|
19
|
-

|
22
|
+

|
20
23
|
|
21
|
-
##
|
22
|
-
|
24
|
+
## Using
|
25
|
+
|
26
|
+
To find which gems contain the string "foo", you would type:
|
23
27
|
```
|
24
|
-
fastgem search '
|
28
|
+
$ fastgem search 'foo'
|
25
29
|
```
|
26
30
|
|
27
31
|
## Contributing
|
28
32
|
|
29
|
-
1. Fork
|
33
|
+
1. Fork the project ( https://github.com/Nguyenanh/fastgem/fork )
|
30
34
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
35
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
36
|
4. Push to the branch (`git push origin my-new-feature`)
|
33
|
-
5. Create new
|
34
|
-
|
35
|
-
## Inspired by
|
37
|
+
5. Create a new pull request with a description of your changes
|
data/bin/fastgem
CHANGED
@@ -4,7 +4,7 @@ require 'fastgem'
|
|
4
4
|
|
5
5
|
include GLI::App
|
6
6
|
|
7
|
-
program_desc 'Search Gem from Rubygem colors'
|
7
|
+
program_desc 'Search Gem from Rubygem.org colors'
|
8
8
|
|
9
9
|
version Fastgem::VERSION
|
10
10
|
|
@@ -21,16 +21,12 @@ flag [:f,:flagname]
|
|
21
21
|
|
22
22
|
|
23
23
|
desc 'Search gem with keywork command line'
|
24
|
-
arg_name '
|
24
|
+
arg_name 'foo'
|
25
25
|
command :search do |c|
|
26
|
-
c.desc '
|
27
|
-
c.switch :
|
28
|
-
|
29
|
-
c.desc 'Describe a flag to new'
|
30
|
-
c.default_value 'default'
|
31
|
-
c.flag :f
|
26
|
+
c.desc 'Order by count downloads'
|
27
|
+
c.switch :d
|
32
28
|
c.action do |global_options,options,args|
|
33
|
-
Fastgem.search(args[0])
|
29
|
+
Fastgem.search(args[0], options)
|
34
30
|
end
|
35
31
|
end
|
36
32
|
exit run(ARGV)
|
data/fastgem.gemspec
CHANGED
@@ -12,14 +12,14 @@ spec = Gem::Specification.new do |s|
|
|
12
12
|
")
|
13
13
|
s.require_paths << 'lib'
|
14
14
|
s.has_rdoc = true
|
15
|
-
s.extra_rdoc_files = ['README.rdoc','fastgem.rdoc']
|
15
|
+
s.extra_rdoc_files = ['README.rdoc', 'fastgem.rdoc']
|
16
16
|
s.rdoc_options << '--title' << 'fastgem' << '--main' << 'README.rdoc' << '--ri'
|
17
17
|
s.bindir = 'bin'
|
18
|
-
s.executables <<
|
18
|
+
s.executables << 'fastgem'
|
19
19
|
s.add_development_dependency('rake')
|
20
20
|
s.add_development_dependency('rdoc')
|
21
21
|
s.add_development_dependency('aruba')
|
22
22
|
s.add_runtime_dependency('rainbow', '2.0')
|
23
|
-
s.add_runtime_dependency('gli','2.13.4')
|
23
|
+
s.add_runtime_dependency('gli', '2.13.4')
|
24
24
|
s.add_runtime_dependency('terminal-table', '1.5.2')
|
25
25
|
end
|
data/lib/fastgem.rb
CHANGED
@@ -2,17 +2,29 @@ require 'fastgem/version.rb'
|
|
2
2
|
require 'fastgem/table.rb'
|
3
3
|
%w(net/https uri thread json).each { |lib| require lib }
|
4
4
|
module Fastgem
|
5
|
-
def self.search(q)
|
5
|
+
def self.search(q, options)
|
6
6
|
uri = URI.parse("https://rubygems.org/api/v1/search.json?query=#{q}")
|
7
7
|
http = Net::HTTP.new(uri.host, uri.port)
|
8
8
|
http.use_ssl = true
|
9
9
|
request = Net::HTTP::Get.new(uri.request_uri)
|
10
10
|
response = http.request(request)
|
11
11
|
results = JSON.parse(response.body)
|
12
|
+
results = sort_downloads(results) if options[:d]
|
13
|
+
template(results)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def self.sort_downloads(results)
|
19
|
+
results.sort!{|a,b| b['downloads'] <=> a['downloads']}
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.template(results)
|
12
23
|
table = Fastgem::Table.new
|
13
24
|
results.each do |result|
|
14
25
|
table.format(result)
|
15
26
|
end
|
16
27
|
table.after
|
17
28
|
end
|
29
|
+
|
18
30
|
end
|
data/lib/fastgem/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastgem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nguyen Anh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|