pretty_search 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 +13 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +70 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/pretty_search +24 -0
- data/lib/pretty_search.rb +26 -0
- data/lib/pretty_search/cli_options.rb +42 -0
- data/lib/pretty_search/collection.rb +22 -0
- data/lib/pretty_search/collection/indexed_collection.rb +36 -0
- data/lib/pretty_search/collection/memory_collection.rb +28 -0
- data/lib/pretty_search/document.rb +11 -0
- data/lib/pretty_search/query.rb +70 -0
- data/lib/pretty_search/version.rb +3 -0
- data/pretty_search.gemspec +41 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d7bc5567430f8bf0915d758e8614f1ec5607e2e4
|
4
|
+
data.tar.gz: f5ac56662cc80c22e32ee4fb4bc56ade97fba438
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 62ac43aeda22179e1070f1f24b199b8879520210f95518fd6ffb90f8022e76d572f7ff81739bd886c7db99c0557b72598d5783311026f563b7975cac8064db76
|
7
|
+
data.tar.gz: 5c8ebc0d596ee5661b9a68db0304cf74578103bdf914245dc091a9c61696c4ba2708c9df5a8b802e5f7f9ce778517b9339a77d110877d4049b941628814e8290
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at skeang@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Song Keang
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# PrettySearch
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/keang/pretty_search.svg?branch=master)](https://travis-ci.org/keang/pretty_search)
|
4
|
+
|
5
|
+
- ruby 2.0.0 or newer
|
6
|
+
|
7
|
+
Searches given collection in json files and return human readable formats
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'pretty_search'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install pretty_search
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
### When you can throw RAM at your problem, and only search once:
|
28
|
+
Return all records:
|
29
|
+
|
30
|
+
`pretty_search --data users.json name='Raylan Givens'`
|
31
|
+
|
32
|
+
Return only first record found:
|
33
|
+
|
34
|
+
`pretty_search --first --data users.json name='Raylan Givens'`
|
35
|
+
|
36
|
+
Chain queries, searching for records where `shared=false` *AND* `suspended=true`:
|
37
|
+
|
38
|
+
`pretty_search --first --data users.json shared=false suspended=true`
|
39
|
+
|
40
|
+
### [TODO] When you are poor on RAM or data is big:
|
41
|
+
`pretty_search --large-data users.json name='Raylan Givens'`
|
42
|
+
|
43
|
+
### [TODO] When you can throw RAM at your problem, and doing many searches:
|
44
|
+
`pretty_search --data users.json start`
|
45
|
+
|
46
|
+
`pretty_search name='Raylan Givens'`
|
47
|
+
|
48
|
+
`pretty_search tags='Foxworth'`
|
49
|
+
|
50
|
+
`pretty_search stop`
|
51
|
+
|
52
|
+
## Development
|
53
|
+
|
54
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
55
|
+
|
56
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
57
|
+
|
58
|
+
## Contributing
|
59
|
+
|
60
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/keang/pretty_search. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
61
|
+
|
62
|
+
## TODO
|
63
|
+
- For large file, read json file in chunk, and search on each chunk in memory
|
64
|
+
- A PrettySearch::CsvCollection to read csv (better for chunked searching)
|
65
|
+
- A PrettySearch::RedisCollection which load records onto a local redis for a persistent searching session, and using the index_field as redis key
|
66
|
+
|
67
|
+
## License
|
68
|
+
|
69
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
70
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'pretty_search'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/pretty_search
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pretty_search'
|
3
|
+
|
4
|
+
options = begin
|
5
|
+
PrettySearch.parse_cli_opts
|
6
|
+
rescue GetoptLong::Error
|
7
|
+
abort
|
8
|
+
end
|
9
|
+
if options[:help]
|
10
|
+
puts PrettySearch::HELP_TEXT
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
|
14
|
+
query = begin
|
15
|
+
PrettySearch::Query.parse(ARGV)
|
16
|
+
rescue => e
|
17
|
+
abort e.message
|
18
|
+
end
|
19
|
+
results = begin
|
20
|
+
PrettySearch.run(query, options)
|
21
|
+
rescue => e
|
22
|
+
abort e.message
|
23
|
+
end
|
24
|
+
puts results
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'yajl/json_gem'
|
2
|
+
require 'yajl'
|
3
|
+
require 'byebug'
|
4
|
+
|
5
|
+
require 'pretty_search/version'
|
6
|
+
require 'pretty_search/cli_options'
|
7
|
+
require 'pretty_search/query'
|
8
|
+
require 'pretty_search/collection'
|
9
|
+
require 'pretty_search/document'
|
10
|
+
|
11
|
+
module PrettySearch
|
12
|
+
class MissingParameter < StandardError; end
|
13
|
+
|
14
|
+
def self.run(query, data: nil, **options)
|
15
|
+
if data.nil?
|
16
|
+
raise MissingParameter, 'Data file is required, please pass in as --data'
|
17
|
+
end
|
18
|
+
collection = PrettySearch::Collection.load(data, options)
|
19
|
+
found = collection.search(query)
|
20
|
+
if found.empty?
|
21
|
+
'No records found.'
|
22
|
+
else
|
23
|
+
found.join("\n")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'getoptlong'
|
2
|
+
|
3
|
+
module PrettySearch
|
4
|
+
class << self
|
5
|
+
# @return [Hash] like:
|
6
|
+
# {
|
7
|
+
# help: [bool],
|
8
|
+
# data: [string],
|
9
|
+
# }
|
10
|
+
#
|
11
|
+
def parse_cli_opts
|
12
|
+
abort 'Ruby 2.0.0 or newer is required' unless defined?(GetoptLong)
|
13
|
+
cli_opts = GetoptLong.new(
|
14
|
+
['--help', '-h', GetoptLong::NO_ARGUMENT],
|
15
|
+
['--first', '-f', GetoptLong::NO_ARGUMENT],
|
16
|
+
['--data', '-d', GetoptLong::REQUIRED_ARGUMENT]
|
17
|
+
)
|
18
|
+
options = {}
|
19
|
+
cli_opts.each do |option, args|
|
20
|
+
# args is "" for options without an argument
|
21
|
+
options[option[2..-1].to_sym] = args == '' ? true : args
|
22
|
+
end
|
23
|
+
options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
HELP_TEXT = <<-EOF.freeze
|
28
|
+
pretty_search [OPTION] ... QUERY
|
29
|
+
|
30
|
+
Example:
|
31
|
+
pretty_search --data ./fixtures/users.json name='Raylan Givens'
|
32
|
+
|
33
|
+
-h, --help:
|
34
|
+
show help
|
35
|
+
|
36
|
+
--data FILE, -d FILE:
|
37
|
+
the file to search on
|
38
|
+
|
39
|
+
--first, -f:
|
40
|
+
returns when first match is found. Omit this flag to return all matches.
|
41
|
+
EOF
|
42
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module PrettySearch
|
2
|
+
# @abstract
|
3
|
+
# PrettySearch::Collection is the abstract class representing
|
4
|
+
# a searchable collection of records.
|
5
|
+
#
|
6
|
+
# Implementations should include:
|
7
|
+
# - #search(PrettySearch::Query) returning Array<PrettySearch::Document>
|
8
|
+
#
|
9
|
+
# See implementations in lib/pretty_search/collection
|
10
|
+
#
|
11
|
+
class Collection
|
12
|
+
# @return [PrettySearch::Collection, #search]
|
13
|
+
# TODO: return IndexedCollection when multiple searches is supported
|
14
|
+
#
|
15
|
+
def self.load(data_file, options = {})
|
16
|
+
PrettySearch::MemoryCollection.new(data_file, first: options[:first])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'pretty_search/collection/memory_collection'
|
22
|
+
require 'pretty_search/collection/indexed_collection'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module PrettySearch
|
2
|
+
# Example extension
|
3
|
+
#
|
4
|
+
# PrettySearch::IndexedCollection is like MemoryCollection, but builds
|
5
|
+
# an index on a given field for faster searching. Ideal for multiple
|
6
|
+
# searches when memory size is not an issue
|
7
|
+
#
|
8
|
+
class IndexedCollection < Collection
|
9
|
+
def initialize(data_file, index_field: nil, first: false)
|
10
|
+
if index_field.nil?
|
11
|
+
raise MissingParameter, 'Field name to be indexed required'
|
12
|
+
end
|
13
|
+
data = Yajl::Parser.parse(File.new(data_file))
|
14
|
+
@index_field = index_field
|
15
|
+
@index = build_index(data, index_field)
|
16
|
+
end
|
17
|
+
|
18
|
+
def search(query)
|
19
|
+
if query[@index_field].nil?
|
20
|
+
raise "indexed field: \"#{@index_field}\" not used in query"
|
21
|
+
end
|
22
|
+
scoped = @index[query[@index_field]]
|
23
|
+
scoped.select { |doc| query.match(doc) }
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def build_index(data, index_field)
|
29
|
+
Hash.new([]).tap do |index|
|
30
|
+
data.each do |doc|
|
31
|
+
index[doc[index_field]] << doc
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module PrettySearch
|
2
|
+
# PrettySearch::MemoryCollection parses the given data_file into hash
|
3
|
+
# and keep everything in memory, and iterates through the records naively
|
4
|
+
# from beginning to end when searching
|
5
|
+
#
|
6
|
+
class MemoryCollection < Collection
|
7
|
+
def initialize(data_file, first: false)
|
8
|
+
@data_file = data_file
|
9
|
+
@first = first
|
10
|
+
end
|
11
|
+
|
12
|
+
# @return [Array<PrettySearch::Document>]
|
13
|
+
def search(query)
|
14
|
+
data = Yajl::Parser.parse(File.new(@data_file))
|
15
|
+
if @first
|
16
|
+
found = data.detect { |doc| query.match(doc) }
|
17
|
+
if found
|
18
|
+
Array(PrettySearch::Document.new(found))
|
19
|
+
else
|
20
|
+
[]
|
21
|
+
end
|
22
|
+
else
|
23
|
+
data.select { |doc| query.match(doc) }
|
24
|
+
.map { |doc| PrettySearch::Document.new doc }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# @abstract
|
2
|
+
class PrettySearch::Query
|
3
|
+
class InvalidQuery < StandardError; end
|
4
|
+
|
5
|
+
# @return [PrettySearch::Query, #match]
|
6
|
+
#
|
7
|
+
def self.parse(args)
|
8
|
+
parse_simple(args)
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return [PrettySearch::SimpleQuery, #match]
|
12
|
+
#
|
13
|
+
def self.parse_simple(q_strs)
|
14
|
+
parsed_queries = {}
|
15
|
+
q_strs.each do |q_str|
|
16
|
+
matches = PrettySearch::SimpleQuery::SIMPLE_PATTERN.match q_str
|
17
|
+
if matches && matches[1] && matches[2]
|
18
|
+
value = matches[2].strip
|
19
|
+
if value.is_a?(String)
|
20
|
+
value = begin
|
21
|
+
Integer(value)
|
22
|
+
rescue
|
23
|
+
value
|
24
|
+
end
|
25
|
+
end
|
26
|
+
if value.is_a?(String)
|
27
|
+
value = begin
|
28
|
+
Float(value)
|
29
|
+
rescue
|
30
|
+
value
|
31
|
+
end
|
32
|
+
end
|
33
|
+
value = true if value == 'true'
|
34
|
+
value = false if value == 'false'
|
35
|
+
parsed_queries[matches[1].strip] = value
|
36
|
+
else
|
37
|
+
raise InvalidQuery, "Cannot understand query: #{q_str}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
PrettySearch::SimpleQuery.new(parsed_queries)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Simple query that matches returns matches when all fields
|
46
|
+
# matches fully
|
47
|
+
class PrettySearch::SimpleQuery < PrettySearch::Query
|
48
|
+
SIMPLE_PATTERN = /\A([\w ]+)=(.+)\z/
|
49
|
+
|
50
|
+
attr_reader :attr
|
51
|
+
|
52
|
+
def initialize(attr)
|
53
|
+
@attr = attr
|
54
|
+
end
|
55
|
+
|
56
|
+
def match(doc)
|
57
|
+
attr.all? do |key, value|
|
58
|
+
doc[key] == value # floats are compared as strings
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def [](key)
|
63
|
+
attr[key]
|
64
|
+
end
|
65
|
+
|
66
|
+
# Used in specs
|
67
|
+
def ==(o)
|
68
|
+
attr == o.attr
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'pretty_search/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'pretty_search'
|
9
|
+
spec.version = PrettySearch::VERSION
|
10
|
+
spec.authors = ['Song Keang']
|
11
|
+
spec.email = ['skeang@gmail.com']
|
12
|
+
|
13
|
+
spec.summary = 'Search your json file'
|
14
|
+
spec.description = 'Simple command line search'
|
15
|
+
spec.homepage = 'http://rubygems.org/gems/pretty_search'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
19
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
20
|
+
if spec.respond_to?(:metadata)
|
21
|
+
#spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
22
|
+
else
|
23
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
24
|
+
'public gem pushes.'
|
25
|
+
end
|
26
|
+
|
27
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
28
|
+
f.match(%r{^(test|spec|features)/})
|
29
|
+
end
|
30
|
+
spec.bindir = 'exe'
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ['lib']
|
33
|
+
|
34
|
+
spec.add_dependency 'yajl-ruby', '~> 1.3.0'
|
35
|
+
|
36
|
+
spec.add_development_dependency 'bundler', '~> 1.14'
|
37
|
+
spec.add_development_dependency 'byebug', '~> 9.0'
|
38
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
40
|
+
spec.add_development_dependency 'simplecov', '~> 0.15.0'
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pretty_search
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Song Keang
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: yajl-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.3.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.3.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.14'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.14'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '9.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '9.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: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.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: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.15.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.15.0
|
97
|
+
description: Simple command line search
|
98
|
+
email:
|
99
|
+
- skeang@gmail.com
|
100
|
+
executables:
|
101
|
+
- pretty_search
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- CODE_OF_CONDUCT.md
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- exe/pretty_search
|
116
|
+
- lib/pretty_search.rb
|
117
|
+
- lib/pretty_search/cli_options.rb
|
118
|
+
- lib/pretty_search/collection.rb
|
119
|
+
- lib/pretty_search/collection/indexed_collection.rb
|
120
|
+
- lib/pretty_search/collection/memory_collection.rb
|
121
|
+
- lib/pretty_search/document.rb
|
122
|
+
- lib/pretty_search/query.rb
|
123
|
+
- lib/pretty_search/version.rb
|
124
|
+
- pretty_search.gemspec
|
125
|
+
homepage: http://rubygems.org/gems/pretty_search
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.6.10
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Search your json file
|
149
|
+
test_files: []
|