https://github.com/sethherr/soulheart
Easy autocomplete: redis, ruby, :heart:
https://github.com/sethherr/soulheart
Last synced: about 1 month ago
JSON representation
Easy autocomplete: redis, ruby, :heart:
- Host: GitHub
- URL: https://github.com/sethherr/soulheart
- Owner: sethherr
- License: mit
- Created: 2015-06-12T15:55:41.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2023-07-31T19:18:14.000Z (almost 2 years ago)
- Last Synced: 2024-06-11T16:11:41.969Z (12 months ago)
- Language: Ruby
- Homepage: https://sethherr.github.io/soulheart/
- Size: 885 KB
- Stars: 72
- Watchers: 4
- Forks: 10
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
#
Soulheart [](https://travis-ci.org/sethherr/soulheart) [](https://codeclimate.com/github/sethherr/soulheart) [](https://codeclimate.com/github/sethherr/soulheart/coverage)
Soulheart is a ready-to-use remote data source for autocomplete. The goal is to provide a solid, flexible tool that's downright easy to set up and use.
- [Intro page](https://sethherr.github.io/soulheart/)
- [Usage documentation (commands)](https://sethherr.github.io/soulheart/commands/)
- [Example data sources](https://github.com/sethherr/soulheart/tree/master/examples)
- [Getting started](#getting-started)
- [Deployment](#deployment)
- [Testing](#testing)
- Example usage [with Selectize](https://sethherr.github.io/soulheart/examples_selectize) & [Select2](https://sethherr.github.io/soulheart/examples_select2)## Features
- **Pagination**
For infinite scrolling of results - wow!
- **Categories**
Match results for specified categories, or not. Your choice
- **Prioritization**
Return results sorted by priority (not just alphabetically)
- **Arbitrary return objects**
Get whatever you want back. IDs, URLs, image links, HTML, :boom:
- **Loads data**
Accepts local or remote data - e.g. you can use a [gist](https://github.com/sethherr/soulheart/blob/master/examples/manufacturers.tsv)
- **Runs Standalone or inside a rails app**[](https://sethherr.github.io/soulheart/)
## Getting started
See the [Soulheart intro page](https://sethherr.github.io/soulheart/) for a step-by-step explanation of setting up a select box that uses Soulheart as a remote data source.
## Deployment
#### With Heroku [](https://heroku.com/deploy)
**You can instantly deploy Soulheart to Heroku for free!** This requires a verified Heroku account—you will have to add a payment method to Heroku but you won't be charged.
To update your Heroku deploy of Soulheart, use the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-command) and redeploy the app:
heroku deploy -a NAME_OF_YOUR_APP_ON_HEROKU
## In a Rails app
Soulheart is a gem. It uses [hiredis](https://github.com/redis/hiredis) on Ruby MRI. Add these lines to your gemfile:
gem 'soulheart'
gem 'hiredis', '~> 0.6.0' # Skip using JRuby
gem 'redis', '>= 3.2.0', require: ['redis', 'redis/connection/hiredis'] # Skip if using JRubyAnd add this in your routes.rb:
require 'soulheart/server'
Rails.application.routes.draw do
# .... your application routesmount Soulheart::Server => '/soulhearts'
endYou can then access the server when your rails app is running. You can run the [Soulheart commands](https://sethherr.github.io/soulheart/commands/) from that directory.
*Hote: On Heroku Soulheart uses `rackup` to start the server. Because of this, there's a `config.ru`, a `Gemfile.lock` and a `app.json`—to make it (and any forks of it) directly deployable. These files aren't in the Gem.*
##### Setting redis url
You can also set the redis url.
```ruby
# config/initializers/soulheart.rbSoulheart.redis = 'redis://127.0.0.1:6379/0'
# or you can asign an existing instance of Redis, Redis::Namespace, etc.
# Soulheart.redis = $redis
```
## TestingTested with rspec. Check out test information at [Code Climate](https://codeclimate.com/github/sethherr/soulheart).
You can run `bundle exec guard` to watch for changes and rerun the tests when files are saved.
## Requirements
Soulheart is a Redis backed Sinatra server. It's tested with the latest MRI (2.2, 2.1, 2.0) and JRuby versions (1.7). Other versions/VMs are untested but might work fine.
It requires Redis >= 3.0
## Additional info
This initially started as a fork of [Soulmate](https://github.com/seatgeek/soulmate) to support the features listed, provide demos and make it instantly deployable to Heroku.
It's MIT licensed.