https://github.com/gd-personal/json_search_cli_app
A CLI application that would search through a list of clients
https://github.com/gd-personal/json_search_cli_app
cli ruby
Last synced: about 2 months ago
JSON representation
A CLI application that would search through a list of clients
- Host: GitHub
- URL: https://github.com/gd-personal/json_search_cli_app
- Owner: GD-Personal
- License: mit
- Created: 2024-09-17T01:01:32.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-20T10:42:16.000Z (over 1 year ago)
- Last Synced: 2025-03-22T15:13:25.551Z (about 1 year ago)
- Topics: cli, ruby
- Language: Ruby
- Homepage:
- Size: 174 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/GD-Personal/clients_search_cli/actions/workflows/ci.yml) [](https://codeclimate.com/github/GD-Personal/clients_search_cli/maintainability) [](https://codeclimate.com/github/GD-Personal/clients_search_cli/test_coverage)
# JSON Dataset Search CLI
## Description
A simple CLI application that would search through any JSON dataset using the [flexi-json](https://github.com/GD-Personal/flexi-json) gem.
Available commands:
- `search`: searches through the given dataset and return those data that is partially matching a given search query
- `find_duplicate_emails`: finds out if there are any data with the same email in the dataset, and show those duplicates if any are found.
## Setup
This application is using ruby 3.2.2 with the following tools:
- [RSpec](https://rspec.info/) for testing
- [standardrb](https://github.com/standardrb/standard) for linting
- [bundler-audit](https://github.com/rubysec/bundler-audit) for checking Gemfile's vulnerability issues
- [Byebug](https://github.com/deivid-rodriguez/byebug) for debugging
- [Make](https://www.gnu.org/software/make/) for build tasks
- [Github Actions](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions) for CI
### 🐳 Docker
The easiest way to run this application is by using docker to make sure you have the correct development environment.
#### Pre-requisites
Docker installed on your machine (See [Docker Installation Guides](https://docs.docker.com/get-started/introduction)).
```
❯ docker-compose build
❯ docker-compose run app
```
### Or you could still run it without docker
#### Intall Ruby with one of the following:
- [Using RVM](https://rvm.io/rvm/install) or with
- [the asdf version manager](https://github.com/asdf-vm/asdf-ruby)
## Run the CLI
```
❯ make run command=search query=john fields=full_name
ruby ./lib/cli.rb search --dataset_path= --query=john --fields=full_name
❯ make run command=search query=william fields=full_name,email
ruby ./lib/cli.rb search --dataset_path= --query=william --fields=full_name,email
❯ make run command=find_duplicate_emails
ruby ./lib/cli.rb find_duplicate_emails --dataset_path= --query= --fields=
❯ make help
ruby ./lib/cli.rb --help
```
### Testing
```
❯ make test
bundle exec rspec
```
### Coding standard
Use `make lint` to check code for style issues.
```
❯ make lint
bundle exec standardrb lib spec
```
### Security audit
Use `make audit` to check vulnerability issues of the gems in Gemfile.lock
```
❯ make audit
bundle exec bundle-audit check --update
```